Revert to rs.js release
This commit is contained in:
2 files changed
+28
-470
No files matched your search
Vendored
+27
-469
@@ -1,469 +1,27 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define("RemoteStorage", [], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["RemoteStorage"] = factory();
|
||||
else
|
||||
root["RemoteStorage"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ "./node_modules/base64-js/index.js":
|
||||
/*!*****************************************!*\
|
||||
!*** ./node_modules/base64-js/index.js ***!
|
||||
\*****************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack://RemoteStorage/./node_modules/base64-js/index.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/buffer/index.js":
|
||||
/*!**************************************!*\
|
||||
!*** ./node_modules/buffer/index.js ***!
|
||||
\**************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <http://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nvar ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nvar isArray = __webpack_require__(/*! isarray */ \"./node_modules/isarray/index.js\")\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/ieee754/index.js":
|
||||
/*!***************************************!*\
|
||||
!*** ./node_modules/ieee754/index.js ***!
|
||||
\***************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack://RemoteStorage/./node_modules/ieee754/index.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/isarray/index.js":
|
||||
/*!***************************************!*\
|
||||
!*** ./node_modules/isarray/index.js ***!
|
||||
\***************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n//# sourceURL=webpack://RemoteStorage/./node_modules/isarray/index.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/tv4/tv4.js":
|
||||
/*!*********************************!*\
|
||||
!*** ./node_modules/tv4/tv4.js ***!
|
||||
\*********************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*\r\nAuthor: Geraint Luff and others\r\nYear: 2013\r\n\r\nThis code is released into the \"public domain\" by its author(s). Anybody may use, alter and distribute the code without restriction. The author makes no guarantees, and takes no liability of any kind for use of this code.\r\n\r\nIf you find a bug or make an improvement, it would be courteous to let the author know, but it is not compulsory.\r\n*/\r\n(function (global, factory) {\r\n if (true) {\r\n // AMD. Register as an anonymous module.\r\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r\n } else {}\r\n}(this, function () {\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2Fkeys\r\nif (!Object.keys) {\r\n\tObject.keys = (function () {\r\n\t\tvar hasOwnProperty = Object.prototype.hasOwnProperty,\r\n\t\t\thasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\r\n\t\t\tdontEnums = [\r\n\t\t\t\t'toString',\r\n\t\t\t\t'toLocaleString',\r\n\t\t\t\t'valueOf',\r\n\t\t\t\t'hasOwnProperty',\r\n\t\t\t\t'isPrototypeOf',\r\n\t\t\t\t'propertyIsEnumerable',\r\n\t\t\t\t'constructor'\r\n\t\t\t],\r\n\t\t\tdontEnumsLength = dontEnums.length;\r\n\r\n\t\treturn function (obj) {\r\n\t\t\tif (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {\r\n\t\t\t\tthrow new TypeError('Object.keys called on non-object');\r\n\t\t\t}\r\n\r\n\t\t\tvar result = [];\r\n\r\n\t\t\tfor (var prop in obj) {\r\n\t\t\t\tif (hasOwnProperty.call(obj, prop)) {\r\n\t\t\t\t\tresult.push(prop);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (hasDontEnumBug) {\r\n\t\t\t\tfor (var i=0; i < dontEnumsLength; i++) {\r\n\t\t\t\t\tif (hasOwnProperty.call(obj, dontEnums[i])) {\r\n\t\t\t\t\t\tresult.push(dontEnums[i]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t};\r\n\t})();\r\n}\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create\r\nif (!Object.create) {\r\n\tObject.create = (function(){\r\n\t\tfunction F(){}\r\n\r\n\t\treturn function(o){\r\n\t\t\tif (arguments.length !== 1) {\r\n\t\t\t\tthrow new Error('Object.create implementation only accepts one parameter.');\r\n\t\t\t}\r\n\t\t\tF.prototype = o;\r\n\t\t\treturn new F();\r\n\t\t};\r\n\t})();\r\n}\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FisArray\r\nif(!Array.isArray) {\r\n\tArray.isArray = function (vArg) {\r\n\t\treturn Object.prototype.toString.call(vArg) === \"[object Array]\";\r\n\t};\r\n}\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FindexOf\r\nif (!Array.prototype.indexOf) {\r\n\tArray.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\r\n\t\tif (this === null) {\r\n\t\t\tthrow new TypeError();\r\n\t\t}\r\n\t\tvar t = Object(this);\r\n\t\tvar len = t.length >>> 0;\r\n\r\n\t\tif (len === 0) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tvar n = 0;\r\n\t\tif (arguments.length > 1) {\r\n\t\t\tn = Number(arguments[1]);\r\n\t\t\tif (n !== n) { // shortcut for verifying if it's NaN\r\n\t\t\t\tn = 0;\r\n\t\t\t} else if (n !== 0 && n !== Infinity && n !== -Infinity) {\r\n\t\t\t\tn = (n > 0 || -1) * Math.floor(Math.abs(n));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (n >= len) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tvar k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\r\n\t\tfor (; k < len; k++) {\r\n\t\t\tif (k in t && t[k] === searchElement) {\r\n\t\t\t\treturn k;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n}\r\n\r\n// Grungey Object.isFrozen hack\r\nif (!Object.isFrozen) {\r\n\tObject.isFrozen = function (obj) {\r\n\t\tvar key = \"tv4_test_frozen_key\";\r\n\t\twhile (obj.hasOwnProperty(key)) {\r\n\t\t\tkey += Math.random();\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tobj[key] = true;\r\n\t\t\tdelete obj[key];\r\n\t\t\treturn false;\r\n\t\t} catch (e) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n}\r\n// Based on: https://github.com/geraintluff/uri-templates, but with all the de-substitution stuff removed\r\n\r\nvar uriTemplateGlobalModifiers = {\r\n\t\"+\": true,\r\n\t\"#\": true,\r\n\t\".\": true,\r\n\t\"/\": true,\r\n\t\";\": true,\r\n\t\"?\": true,\r\n\t\"&\": true\r\n};\r\nvar uriTemplateSuffices = {\r\n\t\"*\": true\r\n};\r\n\r\nfunction notReallyPercentEncode(string) {\r\n\treturn encoLine truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/webfinger.js/node_modules/xhr2/lib/browser.js":
|
||||
/*!********************************************************************!*\
|
||||
!*** ./node_modules/webfinger.js/node_modules/xhr2/lib/browser.js ***!
|
||||
\********************************************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("module.exports = XMLHttpRequest;\n\n\n//# sourceURL=webpack://RemoteStorage/./node_modules/webfinger.js/node_modules/xhr2/lib/browser.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/webfinger.js/src/webfinger.js":
|
||||
/*!****************************************************!*\
|
||||
!*** ./node_modules/webfinger.js/src/webfinger.js ***!
|
||||
\****************************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* global define */\n/*!\n * webfinger.js\n * version 2.7.0\n * http://github.com/silverbucket/webfinger.js\n *\n * Developed and Maintained by:\n * Nick Jennings <nick@silverbucket.net> 2012\n *\n * webfinger.js is released under the AGPL (see LICENSE).\n *\n * You don't have to do anything special to choose one license or the other and you don't\n * have to notify anyone which license you are using.\n * Please see the corresponding license file for details of these licenses.\n * You are free to use, modify and distribute this software, but all copyright\n * information must remain.\n *\n */\n\nif (typeof fetch !== 'function' && typeof XMLHttpRequest !== 'function') {\n // XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;\n XMLHttpRequest = __webpack_require__(/*! xhr2 */ \"./node_modules/webfinger.js/node_modules/xhr2/lib/browser.js\");\n}\n\n(function (global) {\n\n // URI to property name map\n var LINK_URI_MAPS = {\n 'http://webfist.org/spec/rel': 'webfist',\n 'http://webfinger.net/rel/avatar': 'avatar',\n 'remotestorage': 'remotestorage',\n 'http://tools.ietf.org/id/draft-dejong-remotestorage': 'remotestorage',\n 'remoteStorage': 'remotestorage',\n 'http://www.packetizer.com/rel/share': 'share',\n 'http://webfinger.net/rel/profile-page': 'profile',\n 'me': 'profile',\n 'vcard': 'vcard',\n 'blog': 'blog',\n 'http://packetizer.com/rel/blog': 'blog',\n 'http://schemas.google.com/g/2010#updates-from': 'updates',\n 'https://camlistore.org/rel/server': 'camilstore'\n };\n\n var LINK_PROPERTIES = {\n 'avatar': [],\n 'remotestorage': [],\n 'blog': [],\n 'vcard': [],\n 'updates': [],\n 'share': [],\n 'profile': [],\n 'webfist': [],\n 'camlistore': []\n };\n\n // list of endpoints to try, fallback from beginning to end.\n var URIS = ['webfinger', 'host-meta', 'host-meta.json'];\n\n function generateErrorObject(obj) {\n obj.toString = function () {\n return this.message;\n };\n return obj;\n }\n\n // given a URL ensures it's HTTPS.\n // returns false for null string or non-HTTPS URL.\n function isSecure(url) {\n if (typeof url !== 'string') {\n return false;\n }\n var parts = url.split('://');\n if (parts[0] === 'https') {\n return true;\n }\n return false;\n }\n\n /**\n * Function: WebFinger\n *\n * WebFinger constructor\n *\n * Returns:\n *\n * return WebFinger object\n */\n function WebFinger(config) {\n if (typeof config !== 'object') {\n config = {};\n }\n\n this.config = {\n tls_only: (typeof config.tls_only !== 'undefined') ? config.tls_only : true,\n webfist_fallback: (typeof config.webfist_fallback !== 'undefined') ? config.webfist_fallback : false,\n uri_fallback: (typeof config.uri_fallback !== 'undefined') ? config.uri_fallback : false,\n request_timeout: (typeof config.request_timeout !== 'undefined') ? config.request_timeout : 10000\n };\n }\n\n // make an http request and look for JRD response, fails if request fails\n // or response not json.\n WebFinger.prototype.__fetchJRD = function (url, errorHandler, sucessHandler) {\n if (typeof fetch === 'function') {\n return this.__fetchJRD_fetch(url, errorHandler, sucessHandler);\n } else if (typeof XMLHttpRequest === 'function') {\n return this.__fetchJRD_XHR(url, errorHandler, sucessHandler);\n } else {\n throw new Error(\"add a polyfill for fetch or XMLHttpRequest\");\n }\n };\n WebFinger.prototype.__fetchJRD_fetch = function (url, errorHandler, sucessHandler) {\n var webfinger = this;\n var abortController;\n if (typeof AbortController === 'function') {\n abortController = new AbortController();\n }\n var networkPromise = fetch(url, {\n headers: {'Accept': 'application/jrd+json, application/json'},\n signal: abortController ? abortController.signal : undefined\n }).\n then(function (response) {\n if (response.ok) {\n return response.text();\n } else if (response.status === 404) {\n throw generateErrorObject({\n message: 'resource not found',\n url: url,\n status: response.status\n });\n } else { // other HTTP status (redirects are handled transparently)\n throw generateErrorObject({\n message: 'error during request',\n url: url,\n status: response.status\n });\n }\n },\n function (err) { // connection refused, etc.\n throw generateErrorObject({\n message: 'error during request',\n url: url,\n status: undefined,\n err: err\n })\n }).\n then(function (responseText) {\n if (webfinger.__isValidJSON(responseText)) {\n return responseText;\n } else {\n throw generateErrorObject({\n message: 'invalid json',\n ur
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/webpack/buildin/global.js":
|
||||
/*!***********************************!*\
|
||||
!*** (webpack)/buildin/global.js ***!
|
||||
\***********************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n//# sourceURL=webpack://RemoteStorage/(webpack)/buildin/global.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/access.js":
|
||||
/*!***********************!*\
|
||||
!*** ./src/access.js ***!
|
||||
\***********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("/**\n * @class Access\n *\n * Keeps track of claimed access and scopes.\n */\nvar Access = function Access() {\n this.reset();\n};\n\nAccess.prototype = {\n /**\n * Claim access on a given scope with given mode.\n *\n * @param {string} scope - An access scope, such as \"contacts\" or \"calendar\"\n * @param {string} mode - Access mode. Either \"r\" for read-only or \"rw\" for read/write\n */\n claim: function claim(scope, mode) {\n if (typeof scope !== 'string' || scope.indexOf('/') !== -1 || scope.length === 0) {\n throw new Error('Scope should be a non-empty string without forward slashes');\n }\n\n if (!mode.match(/^rw?$/)) {\n throw new Error('Mode should be either \\'r\\' or \\'rw\\'');\n }\n\n this._adjustRootPaths(scope);\n\n this.scopeModeMap[scope] = mode;\n },\n\n /**\n * Get the access mode for a given scope.\n *\n * @param {string} scope - Access scope\n * @returns {string} Access mode\n */\n get: function get(scope) {\n return this.scopeModeMap[scope];\n },\n\n /**\n * Remove access for the given scope.\n *\n * @param {string} scope - Access scope\n */\n remove: function remove(scope) {\n var savedMap = {};\n var name;\n\n for (name in this.scopeModeMap) {\n savedMap[name] = this.scopeModeMap[name];\n }\n\n this.reset();\n delete savedMap[scope];\n\n for (name in savedMap) {\n this.set(name, savedMap[name]);\n }\n },\n\n /**\n * Verify permission for a given scope.\n *\n * @param {string} scope - Access scope\n * @param {string} mode - Access mode\n * @returns {boolean} true if the requested access mode is active, false otherwise\n */\n checkPermission: function checkPermission(scope, mode) {\n var actualMode = this.get(scope);\n return actualMode && (mode === 'r' || actualMode === 'rw');\n },\n\n /**\n * Verify permission for a given path.\n *\n * @param {string} path - Path\n * @param {string} mode - Access mode\n * @returns {boolean} true if the requested access mode is active, false otherwise\n */\n checkPathPermission: function checkPathPermission(path, mode) {\n if (this.checkPermission('*', mode)) {\n return true;\n }\n\n return !!this.checkPermission(this._getModuleName(path), mode);\n },\n\n /**\n * Reset all access permissions.\n */\n reset: function reset() {\n this.rootPaths = [];\n this.scopeModeMap = {};\n },\n\n /**\n * Return the module name for a given path.\n *\n * @private\n */\n _getModuleName: function _getModuleName(path) {\n if (path[0] !== '/') {\n throw new Error('Path should start with a slash');\n }\n\n var moduleMatch = path.replace(/^\\/public/, '').match(/^\\/([^/]*)\\//);\n return moduleMatch ? moduleMatch[1] : '*';\n },\n\n /**\n * TODO: document\n *\n * @param {string} newScope\n *\n * @private\n */\n _adjustRootPaths: function _adjustRootPaths(newScope) {\n if ('*' in this.scopeModeMap || newScope === '*') {\n this.rootPaths = ['/'];\n } else if (!(newScope in this.scopeModeMap)) {\n this.rootPaths.push('/' + newScope + '/');\n this.rootPaths.push('/public/' + newScope + '/');\n }\n },\n\n /**\n * TODO: document\n *\n * @param {string} scope\n * @returns {string}\n *\n * @private\n */\n _scopeNameForParameter: function _scopeNameForParameter(scope) {\n if (scope.name === '*' && this.storageType) {\n if (this.storageType === '2012.04') {\n return '';\n } else if (this.storageType.match(/remotestorage-0[01]/)) {\n return 'root';\n }\n }\n\n return scope.name;\n },\n\n /**\n * Set the storage type of the remote.\n *\n * @param {string} type - Storage type\n */\n setStorageType: function setStorageType(type) {\n this.storageType = type;\n }\n};\n/**\n * Property: scopes\n *\n * Holds an array of claimed scopes in the form\n * > { name: \"<scope-name>\", mode: \"<mode>\" }\n */\n\nObject.defineProperty(Access.prototype, 'scopes', {\n get: function get() {\n return Object.keys(this.scopeModeMap).map(function (key) {\n return {\n name: key,\n mode: this.scopeModeMap[key]\n };\n }.bind(this));\n }\n});\nObject.defineProperty(Access.prototype, 'scopeParameter', {\n get: function get() {\n return this.scopes.map(function (scope) {\n return this._scopeNameForParameter(scope) + ':' + scope.mode;\n }.bind(this)).join(' ');\n }\n});\n\nAccess._rs_init = function () {};\n\nmodule.exports = Access;\n\n//# sourceURL=webpack://RemoteStorage/./src/access.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/authorize.js":
|
||||
/*!**************************!*\
|
||||
!*** ./src/authorize.js ***!
|
||||
\**************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nfunction extractParams(url) {\n // FF already decodes the URL fragment in document.location.hash, so use this instead:\n var location = url || Authorize.getLocation().href;\n var hashPos = location.indexOf('#');\n\n if (hashPos === -1) {\n return;\n }\n\n var hash = location.substring(hashPos + 1); // if hash is not of the form #key=val&key=val, it's probably not for us\n\n if (hash.indexOf('=') === -1) {\n return;\n }\n\n return hash.split('&').reduce(function (params, kvs) {\n var kv = kvs.split('=');\n\n if (kv[0] === 'state' && kv[1].match(/rsDiscovery/)) {\n // extract rsDiscovery data from the state param\n var stateValue = decodeURIComponent(kv[1]);\n var encodedData = stateValue.substr(stateValue.indexOf('rsDiscovery=')).split('&')[0].split('=')[1];\n params['rsDiscovery'] = JSON.parse(atob(encodedData)); // remove rsDiscovery param\n\n stateValue = stateValue.replace(new RegExp('&?rsDiscovery=' + encodedData), '');\n\n if (stateValue.length > 0) {\n params['state'] = stateValue;\n }\n } else {\n params[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);\n }\n\n return params;\n }, {});\n}\n\nfunction buildOAuthURL(authURL, redirectUri, scope, clientId) {\n var hashPos = redirectUri.indexOf('#');\n var url = authURL;\n url += authURL.indexOf('?') > 0 ? '&' : '?';\n url += 'redirect_uri=' + encodeURIComponent(redirectUri.replace(/#.*$/, ''));\n url += '&scope=' + encodeURIComponent(scope);\n url += '&client_id=' + encodeURIComponent(clientId);\n\n if (hashPos !== -1 && hashPos + 1 !== redirectUri.length) {\n url += '&state=' + encodeURIComponent(redirectUri.substring(hashPos + 1));\n }\n\n url += '&response_type=token';\n return url;\n}\n\nvar Authorize = function Authorize(remoteStorage, _ref) {\n var authURL = _ref.authURL,\n scope = _ref.scope,\n redirectUri = _ref.redirectUri,\n clientId = _ref.clientId;\n log('[Authorize] authURL = ', authURL, 'scope = ', scope, 'redirectUri = ', redirectUri, 'clientId = ', clientId); // keep track of the discovery data during redirect if we can't save it in localStorage\n\n if (!util.localStorageAvailable() && remoteStorage.backend === 'remotestorage') {\n redirectUri += redirectUri.indexOf('#') > 0 ? '&' : '#';\n var discoveryData = {\n userAddress: remoteStorage.remote.userAddress,\n href: remoteStorage.remote.href,\n storageApi: remoteStorage.remote.storageApi,\n properties: remoteStorage.remote.properties\n };\n redirectUri += 'rsDiscovery=' + btoa(JSON.stringify(discoveryData));\n }\n\n var url = buildOAuthURL(authURL, redirectUri, scope, clientId);\n\n if (util.globalContext.cordova) {\n return Authorize.openWindow(url, redirectUri, 'location=yes,clearsessioncache=yes,clearcache=yes').then(function (authResult) {\n remoteStorage.remote.configure({\n token: authResult.access_token\n });\n });\n }\n\n Authorize.setLocation(url);\n};\n\nAuthorize.IMPLIED_FAKE_TOKEN = false;\n\nAuthorize.Unauthorized = function (message) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.name = 'Unauthorized';\n\n if (typeof message === 'undefined') {\n this.message = 'App authorization expired or revoked.';\n } else {\n this.message = message;\n }\n\n if (typeof options.code !== 'undefined') {\n this.code = options.code;\n }\n\n this.stack = new Error().stack;\n};\n\nAuthorize.Unauthorized.prototype = Object.create(Error.prototype);\nAuthorize.Unauthorized.prototype.constructor = Authorize.Unauthorized;\n/**\n * Get current document location\n *\n * Override this method if access to document.location is forbidden\n */\n\nAuthorize.getLocation = function () {\n return document.location;\n};\n/**\n * Set current document location\n *\n * Override this method if access to document.location is forbidden\n */\n\n\nAuthorize.setLocation = function (location) {\n if (typeof location === 'string') {\n document.location.href = location;\n } else if (_typeof(location) === 'object') {\n document.location = location;\n } else {\n throw \"Invalid location \" + location;\n }\n};\n/**\n * Open new InAppBrowser window for OAuth in Cordova\n */\n\n\nAuthorize.openWindow = function (url, redirectUri, options) {\n return new Promise(function (resolve, reject) {\n var newWindow = open(url, '_blank', options);\n\n if (!neLine truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/baseclient.js":
|
||||
/*!***************************!*\
|
||||
!*** ./src/baseclient.js ***!
|
||||
\***************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n\nvar tv4 = __webpack_require__(/*! tv4 */ \"./node_modules/tv4/tv4.js\");\n\nvar Types = __webpack_require__(/*! ./types */ \"./src/types.js\");\n\nvar SchemaNotFound = Types.SchemaNotFound;\n/**\n * Provides a high-level interface to access data below a given root path.\n */\n\nvar BaseClient = function BaseClient(storage, base) {\n if (base[base.length - 1] !== '/') {\n throw \"Not a folder: \" + base;\n }\n\n if (base === '/') {\n // allow absolute and relative paths for the root scope.\n this.makePath = function (path) {\n return (path[0] === '/' ? '' : '/') + path;\n };\n }\n /**\n * The <RemoteStorage> instance this <BaseClient> operates on.\n */\n\n\n this.storage = storage;\n /**\n * Base path, which this <BaseClient> operates on.\n *\n * For the module's privateClient this would be /<moduleName>/, for the\n * corresponding publicClient /public/<moduleName>/.\n */\n\n this.base = base;\n /**\n * TODO: document what this does exactly\n */\n\n var parts = this.base.split('/');\n\n if (parts.length > 2) {\n this.moduleName = parts[1];\n } else {\n this.moduleName = 'root';\n }\n\n eventHandling(this, 'change');\n this.on = this.on.bind(this);\n storage.onChange(this.base, this._fireChange.bind(this));\n};\n\nBaseClient.Types = Types;\nBaseClient.prototype = {\n /**\n * Instantiate a new client, scoped to a subpath of the current client's\n * path.\n *\n * @param {string} path - The path to scope the new client to.\n *\n * @returns {BaseClient} A new client operating on a subpath of the current\n * base path.\n */\n scope: function scope(path) {\n return new BaseClient(this.storage, this.makePath(path));\n },\n\n /**\n * Get a list of child nodes below a given path.\n *\n * @param {string} path - The path to query. It MUST end with a forward slash.\n * @param {number} maxAge - (optional) Either ``false`` or the maximum age of\n * cached listing in milliseconds. See :ref:`max-age`.\n *\n * @returns {Promise} A promise for an object representing child nodes\n */\n getListing: function getListing(path, maxAge) {\n if (typeof path !== 'string') {\n path = '';\n } else if (path.length > 0 && path[path.length - 1] !== '/') {\n return Promise.reject(\"Not a folder: \" + path);\n }\n\n return this.storage.get(this.makePath(path), maxAge).then(function (r) {\n return r.statusCode === 404 ? {} : r.body;\n });\n },\n\n /**\n * Get all objects directly below a given path.\n *\n * @param {string} path - Path to the folder. Must end in a forward slash.\n * @param {number} maxAge - (optional) Either ``false`` or the maximum age of\n * cached objects in milliseconds. See :ref:`max-age`.\n *\n * @returns {Promise} A promise for an object\n */\n getAll: function getAll(path, maxAge) {\n if (typeof path !== 'string') {\n path = '';\n } else if (path.length > 0 && path[path.length - 1] !== '/') {\n return Promise.reject(\"Not a folder: \" + path);\n }\n\n return this.storage.get(this.makePath(path), maxAge).then(function (r) {\n if (r.statusCode === 404) {\n return {};\n }\n\n if (_typeof(r.body) === 'object') {\n var keys = Object.keys(r.body);\n\n if (keys.length === 0) {\n // treat this like 404. it probably means a folder listing that\n // has changes that haven't been pushed out yet.\n return {};\n }\n\n var calls = keys.map(function (key) {\n return this.storage.get(this.makePath(path + key), maxAge).then(function (o) {\n if (typeof o.body === 'string') {\n try {\n o.body = JSON.parse(o.body);\n } catch (e) {// empty\n }\n }\n\n if (_typeof(o.body) === 'object') {\n r.body[key] = o.body;\n }\n });\n }.bind(this));\n return Promise.all(calls).then(function () {\n return r.body;\n });\n }\n }.bind(this));\n },\n\n /**\n * Get the file at the given path. A file is raw data, as opposed to\n * a JSON object (use :func:`getObject` for that).\n *\n * @param {string} path - Relative path from the module root (without
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/caching.js":
|
||||
/*!************************!*\
|
||||
!*** ./src/caching.js ***!
|
||||
\************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("/**\n * @class Caching\n *\n * Holds/manages caching configuration.\n **/\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar containingFolder = util.containingFolder;\n\nvar Caching = function Caching() {\n this.reset();\n};\n\nCaching.prototype = {\n pendingActivations: [],\n\n /**\n * Configure caching for a given path explicitly.\n *\n * Not needed when using ``enable``/``disable``.\n *\n * @param {string} path - Path to cache\n * @param {string} strategy - Caching strategy. One of 'ALL', 'SEEN', or 'FLUSH'.\n *\n */\n set: function set(path, strategy) {\n if (typeof path !== 'string') {\n throw new Error('path should be a string');\n }\n\n if (!util.isFolder(path)) {\n throw new Error('path should be a folder');\n }\n\n if (this._remoteStorage && this._remoteStorage.access && !this._remoteStorage.access.checkPathPermission(path, 'r')) {\n throw new Error('No access to path \"' + path + '\". You have to claim access to it first.');\n }\n\n if (!strategy.match(/^(FLUSH|SEEN|ALL)$/)) {\n throw new Error(\"strategy should be 'FLUSH', 'SEEN', or 'ALL'\");\n }\n\n this._rootPaths[path] = strategy;\n\n if (strategy === 'ALL') {\n if (this.activateHandler) {\n this.activateHandler(path);\n } else {\n this.pendingActivations.push(path);\n }\n }\n },\n\n /**\n * Enable caching for a given path.\n *\n * Uses caching strategy ``ALL``.\n *\n * @param {string} path - Path to enable caching for\n */\n enable: function enable(path) {\n this.set(path, 'ALL');\n },\n\n /**\n * Disable caching for a given path.\n *\n * Uses caching strategy ``FLUSH`` (meaning items are only cached until\n * successfully pushed to the remote).\n *\n * @param {string} path - Path to disable caching for\n */\n disable: function disable(path) {\n this.set(path, 'FLUSH');\n },\n\n /**\n * Set a callback for when caching is activated for a path.\n *\n * @param {function} callback - Callback function\n */\n onActivate: function onActivate(cb) {\n var i;\n log('[Caching] Setting activate handler', cb, this.pendingActivations);\n this.activateHandler = cb;\n\n for (i = 0; i < this.pendingActivations.length; i++) {\n cb(this.pendingActivations[i]);\n }\n\n delete this.pendingActivations;\n },\n\n /**\n * Retrieve caching setting for a given path, or its next parent\n * with a caching strategy set.\n *\n * @param {string} path - Path to retrieve setting for\n * @returns {string} caching strategy for the path\n **/\n checkPath: function checkPath(path) {\n if (this._rootPaths[path] !== undefined) {\n return this._rootPaths[path];\n } else if (path === '/') {\n return 'SEEN';\n } else {\n return this.checkPath(containingFolder(path));\n }\n },\n\n /**\n * Reset the state of caching by deleting all caching information.\n **/\n reset: function reset() {\n this._rootPaths = {};\n this._remoteStorage = null;\n }\n};\n/**\n * Setup function that is called on initialization.\n *\n * @private\n **/\n\nCaching._rs_init = function (remoteStorage) {\n this._remoteStorage = remoteStorage;\n};\n\nmodule.exports = Caching;\n\n//# sourceURL=webpack://RemoteStorage/./src/caching.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/cachinglayer.js":
|
||||
/*!*****************************!*\
|
||||
!*** ./src/cachinglayer.js ***!
|
||||
\*****************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n/**\n * This module defines functions that are mixed into remoteStorage.local when\n * it is instantiated (currently one of indexeddb.js, localstorage.js, or\n * inmemorystorage.js).\n *\n * All remoteStorage.local implementations should therefore implement\n * this.getNodes, this.setNodes, and this.forAllNodes. The rest is blended in\n * here to create a GPD (get/put/delete) interface which the BaseClient can\n * talk to.\n *\n * @interface\n *\n */\n\n\nvar isFolder = util.isFolder;\nvar isDocument = util.isDocument;\nvar deepClone = util.deepClone;\n\nfunction getLatest(node) {\n if (_typeof(node) !== 'object' || typeof node.path !== 'string') {\n return;\n }\n\n if (isFolder(node.path)) {\n if (node.local && node.local.itemsMap) {\n return node.local;\n }\n\n if (node.common && node.common.itemsMap) {\n return node.common;\n }\n } else {\n if (node.local) {\n if (node.local.body && node.local.contentType) {\n return node.local;\n }\n\n if (node.local.body === false) {\n return;\n }\n }\n\n if (node.common && node.common.body && node.common.contentType) {\n return node.common;\n } // Migration code! Once all apps use at least this version of the lib, we\n // can publish clean-up code that migrates over any old-format data, and\n // stop supporting it. For now, new apps will support data in both\n // formats, thanks to this:\n\n\n if (node.body && node.contentType) {\n return {\n body: node.body,\n contentType: node.contentType\n };\n }\n }\n}\n\nfunction isOutdated(nodes, maxAge) {\n var path;\n\n for (path in nodes) {\n if (nodes[path] && nodes[path].remote) {\n return true;\n }\n\n var nodeVersion = getLatest(nodes[path]);\n\n if (nodeVersion && nodeVersion.timestamp && new Date().getTime() - nodeVersion.timestamp <= maxAge) {\n return false;\n } else if (!nodeVersion) {\n return true;\n }\n }\n\n return true;\n}\n\nvar pathsFromRoot = util.pathsFromRoot;\n\nfunction makeNode(path) {\n var node = {\n path: path,\n common: {}\n };\n\n if (isFolder(path)) {\n node.common.itemsMap = {};\n }\n\n return node;\n}\n\nfunction updateFolderNodeWithItemName(node, itemName) {\n if (!node.common) {\n node.common = {\n itemsMap: {}\n };\n }\n\n if (!node.common.itemsMap) {\n node.common.itemsMap = {};\n }\n\n if (!node.local) {\n node.local = deepClone(node.common);\n }\n\n if (!node.local.itemsMap) {\n node.local.itemsMap = node.common.itemsMap;\n }\n\n node.local.itemsMap[itemName] = true;\n return node;\n}\n\nvar methods = {\n // TODO: improve our code structure so that this function\n // could call sync.queueGetRequest directly instead of needing\n // this hacky third parameter as a callback\n get: function get(path, maxAge, queueGetRequest) {\n var self = this;\n\n if (typeof maxAge === 'number') {\n return self.getNodes(pathsFromRoot(path)).then(function (objs) {\n var node = getLatest(objs[path]);\n\n if (isOutdated(objs, maxAge)) {\n return queueGetRequest(path);\n } else if (node) {\n return {\n statusCode: 200,\n body: node.body || node.itemsMap,\n contentType: node.contentType\n };\n } else {\n return {\n statusCode: 404\n };\n }\n });\n } else {\n return self.getNodes([path]).then(function (objs) {\n var node = getLatest(objs[path]);\n\n if (node) {\n if (isFolder(path)) {\n for (var i in node.itemsMap) {\n // the hasOwnProperty check here is only because our jshint settings require it:\n if (node.itemsMap.hasOwnProperty(i) && node.itemsMap[i] === false) {\n delete node.itemsMap[i];\n }\n }\n }\n\n return {\n statusCode: 200,\n body: node.body || node.itemsMap,\n contentType: node.contentType\n };\n } else {\n return {\n statusCode: 404\n };\n }\n });\n }\n },\n put: function put(path, body, contentType) {\n var paths = pathsFromRoot(path);\n\n function _processNodes(nodePaths, nodes) {\n try {\n for (var i = 0, len = nodePaths.length; i <
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/config.js":
|
||||
/*!***********************!*\
|
||||
!*** ./src/config.js ***!
|
||||
\***********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("/**\n * The default config, merged with the object passed to the constructor of the\n * RemoteStorage object\n */\nvar config = {\n cache: true,\n changeEvents: {\n local: true,\n window: false,\n remote: true,\n conflict: true\n },\n cordovaRedirectUri: undefined,\n logging: false,\n modules: [],\n // the following are not public and will probably be moved away from the\n // default config\n backgroundSyncInterval: 60000,\n disableFeatures: [],\n discoveryTimeout: 10000,\n isBackground: false,\n requestTimeout: 30000,\n syncInterval: 10000\n};\nmodule.exports = config;\n\n//# sourceURL=webpack://RemoteStorage/./src/config.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/discover.js":
|
||||
/*!*************************!*\
|
||||
!*** ./src/discover.js ***!
|
||||
\*************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar WebFinger = __webpack_require__(/*! webfinger.js */ \"./node_modules/webfinger.js/src/webfinger.js\"); // feature detection flags\n\n\nvar haveXMLHttpRequest, hasLocalStorage; // used to store settings in localStorage\n\nvar SETTINGS_KEY = 'remotestorage:discover'; // cache loaded from localStorage\n\nvar cachedInfo = {};\n/**\n * This function deals with the Webfinger lookup, discovering a connecting\n * user's storage details.\n *\n * @param {string} userAddress - user@host\n *\n * @returns {Promise} A promise for an object with the following properties.\n * href - Storage base URL,\n * storageApi - RS protocol version,\n * authUrl - OAuth URL,\n * properties - Webfinger link properties\n **/\n\nvar Discover = function Discover(userAddress) {\n return new Promise(function (resolve, reject) {\n if (userAddress in cachedInfo) {\n return resolve(cachedInfo[userAddress]);\n }\n\n var webFinger = new WebFinger({\n tls_only: false,\n uri_fallback: true,\n request_timeout: 5000\n });\n return webFinger.lookup(userAddress, function (err, response) {\n if (err) {\n return reject(err);\n } else if (_typeof(response.idx.links.remotestorage) !== 'object' || typeof response.idx.links.remotestorage.length !== 'number' || response.idx.links.remotestorage.length <= 0) {\n log(\"[Discover] WebFinger record for \" + userAddress + \" does not have remotestorage defined in the links section \", JSON.stringify(response.json));\n return reject(\"WebFinger record for \" + userAddress + \" does not have remotestorage defined in the links section.\");\n }\n\n var rs = response.idx.links.remotestorage[0];\n var authURL = rs.properties['http://tools.ietf.org/html/rfc6749#section-4.2'] || rs.properties['auth-endpoint'];\n var storageApi = rs.properties['http://remotestorage.io/spec/version'] || rs.type; // cache fetched data\n\n cachedInfo[userAddress] = {\n href: rs.href,\n storageApi: storageApi,\n authURL: authURL,\n properties: rs.properties\n };\n\n if (hasLocalStorage) {\n localStorage[SETTINGS_KEY] = JSON.stringify({\n cache: cachedInfo\n });\n }\n\n return resolve(cachedInfo[userAddress]);\n });\n });\n};\n\nDiscover.DiscoveryError = function (message) {\n this.name = 'DiscoveryError';\n this.message = message;\n this.stack = new Error().stack;\n};\n\nDiscover.DiscoveryError.prototype = Object.create(Error.prototype);\nDiscover.DiscoveryError.prototype.constructor = Discover.DiscoveryError;\n\nDiscover._rs_init = function ()\n/*remoteStorage*/\n{\n hasLocalStorage = util.localStorageAvailable();\n\n if (hasLocalStorage) {\n var settings;\n\n try {\n settings = JSON.parse(localStorage[SETTINGS_KEY]);\n } catch (e) {\n /* empty */\n }\n\n if (settings) {\n cachedInfo = settings.cache;\n }\n }\n};\n\nDiscover._rs_supported = function () {\n haveXMLHttpRequest = !!util.globalContext.XMLHttpRequest;\n return haveXMLHttpRequest;\n};\n\nDiscover._rs_cleanup = function () {\n if (hasLocalStorage) {\n delete localStorage[SETTINGS_KEY];\n }\n};\n\nmodule.exports = Discover;\n\n//# sourceURL=webpack://RemoteStorage/./src/discover.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/dropbox.js":
|
||||
/*!************************!*\
|
||||
!*** ./src/dropbox.js ***!
|
||||
\************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar Authorize = __webpack_require__(/*! ./authorize */ \"./src/authorize.js\");\n\nvar BaseClient = __webpack_require__(/*! ./baseclient */ \"./src/baseclient.js\");\n\nvar WireClient = __webpack_require__(/*! ./wireclient */ \"./src/wireclient.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar RevisionCache = __webpack_require__(/*! ./revisioncache */ \"./src/revisioncache.js\");\n\nvar Sync = __webpack_require__(/*! ./sync */ \"./src/sync.js\");\n/**\n * WORK IN PROGRESS, NOT RECOMMENDED FOR PRODUCTION USE\n *\n * Dropbox backend for RemoteStorage.js\n * This file exposes a get/put/delete interface which is compatible with\n * <WireClient>.\n *\n * When remoteStorage.backend is set to 'dropbox', this backend will\n * initialize and replace remoteStorage.remote with remoteStorage.dropbox.\n *\n * In order to ensure compatibility with the public folder, <BaseClient.getItemURL>\n * gets hijacked to return the Dropbox public share URL.\n *\n * To use this backend, you need to specify the Dropbox app key like so:\n *\n * @example\n * remoteStorage.setApiKeys({\n * dropbox: 'your-app-key'\n * });\n *\n * An app key can be obtained by registering your app at https://www.dropbox.com/developers/apps\n *\n * Known issues:\n *\n * - Storing files larger than 150MB is not yet supported\n * - Listing and deleting folders with more than 10'000 files will cause problems\n * - Content-Type is not fully supported due to limitations of the Dropbox API\n * - Dropbox preserves cases but is not case-sensitive\n * - getItemURL is asynchronous which means it returns useful values\n * after the syncCycle\n */\n\n\nvar hasLocalStorage;\nvar AUTH_URL = 'https://www.dropbox.com/oauth2/authorize';\nvar SETTINGS_KEY = 'remotestorage:dropbox';\nvar PATH_PREFIX = '/remotestorage';\nvar isFolder = util.isFolder;\nvar cleanPath = util.cleanPath;\nvar shouldBeTreatedAsBinary = util.shouldBeTreatedAsBinary;\nvar getJSONFromLocalStorage = util.getJSONFromLocalStorage;\nvar getTextFromArrayBuffer = util.getTextFromArrayBuffer;\n/**\n * Map a local path to a path in Dropbox.\n *\n * @param {string} path - Path\n * @returns {string} Actual path in Dropbox\n *\n * @private\n */\n\nvar getDropboxPath = function getDropboxPath(path) {\n return cleanPath(PATH_PREFIX + '/' + path).replace(/\\/$/, '');\n};\n\nvar compareApiError = function compareApiError(response, expect) {\n return new RegExp('^' + expect.join('\\\\/') + '(\\\\/|$)').test(response.error_summary);\n};\n\nvar isBinaryData = function isBinaryData(data) {\n return data instanceof ArrayBuffer || WireClient.isArrayBufferView(data);\n};\n/**\n * @class\n */\n\n\nvar Dropbox = function Dropbox(rs) {\n this.rs = rs;\n this.connected = false;\n this.rs = rs;\n this._initialFetchDone = false;\n eventHandling(this, 'connected', 'not-connected');\n this.clientId = rs.apiKeys.dropbox.appKey;\n this._revCache = new RevisionCache('rev');\n this._fetchDeltaCursor = null;\n this._fetchDeltaPromise = null;\n this._itemRefs = {};\n hasLocalStorage = util.localStorageAvailable();\n\n if (hasLocalStorage) {\n var settings = getJSONFromLocalStorage(SETTINGS_KEY);\n\n if (settings) {\n this.configure(settings);\n }\n\n this._itemRefs = getJSONFromLocalStorage(\"\".concat(SETTINGS_KEY, \":shares\")) || {};\n }\n\n if (this.connected) {\n setTimeout(this._emit.bind(this), 0, 'connected');\n }\n};\n\nDropbox.prototype = {\n online: true,\n\n /**\n * Set the backed to 'dropbox' and start the authentication flow in order\n * to obtain an API token from Dropbox.\n */\n connect: function connect() {\n // TODO handling when token is already present\n this.rs.setBackend('dropbox');\n\n if (this.token) {\n hookIt(this.rs);\n } else {\n this.rs.authorize({\n authURL: AUTH_URL,\n scope: '',\n clientId: this.clientId\n });\n }\n },\n\n /**\n * Sets the connected flag\n * Accepts its parameters according to the <WireClient>.\n * @param {Object} settings\n * @param {string} [settings.userAddress] - The user's email address\n * @param {string} [settings.token] - Authorization token\n *\n * @protected\n **/\n configure: function configure(settings) {\n // We only update this.userAddress if settings.userAddress is set to a string or to null:\n if (typeof settings.userAddress !== 'undefined') {\n this.userAddress = settings.userAddress;\n } // Same for this.token.
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/env.js":
|
||||
/*!********************!*\
|
||||
!*** ./src/env.js ***!
|
||||
\********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar mode = typeof window !== 'undefined' ? 'browser' : 'node',\n env = {};\n\nvar Env = function Env() {\n return env;\n};\n\nEnv.isBrowser = function () {\n return mode === \"browser\";\n};\n\nEnv.isNode = function () {\n return mode === \"node\";\n};\n\nEnv.goBackground = function () {\n Env._emit(\"background\");\n};\n\nEnv.goForeground = function () {\n Env._emit(\"foreground\");\n};\n\nEnv._rs_init = function ()\n/* remoteStorage */\n{\n eventHandling(Env, \"background\", \"foreground\");\n\n function visibility() {\n if (document[env.hiddenProperty]) {\n Env.goBackground();\n } else {\n Env.goForeground();\n }\n }\n\n if (mode === 'browser') {\n if (typeof document.hidden !== \"undefined\") {\n env.hiddenProperty = \"hidden\";\n env.visibilityChangeEvent = \"visibilitychange\";\n } else if (typeof document.mozHidden !== \"undefined\") {\n env.hiddenProperty = \"mozHidden\";\n env.visibilityChangeEvent = \"mozvisibilitychange\";\n } else if (typeof document.msHidden !== \"undefined\") {\n env.hiddenProperty = \"msHidden\";\n env.visibilityChangeEvent = \"msvisibilitychange\";\n } else if (typeof document.webkitHidden !== \"undefined\") {\n env.hiddenProperty = \"webkitHidden\";\n env.visibilityChangeEvent = \"webkitvisibilitychange\";\n }\n\n document.addEventListener(env.visibilityChangeEvent, visibility, false);\n visibility();\n }\n};\n\nEnv._rs_cleanup = function ()\n/* remoteStorage */\n{};\n\nmodule.exports = Env;\n\n//# sourceURL=webpack://RemoteStorage/./src/env.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/eventhandling.js":
|
||||
/*!******************************!*\
|
||||
!*** ./src/eventhandling.js ***!
|
||||
\******************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n/**\n * @interface\n */\n\n\nvar methods = {\n /**\n * Install an event handler for the given event name\n */\n addEventListener: function addEventListener(eventName, handler) {\n if (typeof eventName !== 'string') {\n throw new Error('Argument eventName should be a string');\n }\n\n if (typeof handler !== 'function') {\n throw new Error('Argument handler should be a function');\n }\n\n log('[Eventhandling] Adding event listener', eventName);\n\n this._validateEvent(eventName);\n\n this._handlers[eventName].push(handler);\n },\n\n /**\n * Remove a previously installed event handler\n */\n removeEventListener: function removeEventListener(eventName, handler) {\n this._validateEvent(eventName);\n\n var hl = this._handlers[eventName].length;\n\n for (var i = 0; i < hl; i++) {\n if (this._handlers[eventName][i] === handler) {\n this._handlers[eventName].splice(i, 1);\n\n return;\n }\n }\n },\n _emit: function _emit(eventName) {\n this._validateEvent(eventName);\n\n var args = Array.prototype.slice.call(arguments, 1);\n\n this._handlers[eventName].slice().forEach(function (handler) {\n handler.apply(this, args);\n });\n },\n _validateEvent: function _validateEvent(eventName) {\n if (!(eventName in this._handlers)) {\n throw new Error(\"Unknown event: \" + eventName);\n }\n },\n _delegateEvent: function _delegateEvent(eventName, target) {\n target.on(eventName, function (event) {\n this._emit(eventName, event);\n }.bind(this));\n },\n _addEvent: function _addEvent(eventName) {\n this._handlers[eventName] = [];\n }\n};\n/**\n * Alias for ``addEventListener``\n **/\n\nmethods.on = methods.addEventListener;\n/**\n * Alias for ``removeEventListener``\n **/\n\nmethods.off = methods.removeEventListener;\n/**\n * Mixes event handling functionality into an object.\n *\n * The first parameter is always the object to be extended.\n * All remaining parameter are expected to be strings, interpreted as valid event\n * names.\n *\n * @example\n * var MyConstructor = function () {\n * eventHandling(this, 'connected', 'disconnected');\n *\n * this._emit('connected');\n * this._emit('disconnected');\n * // This would throw an exception:\n * // this._emit('something-else');\n * };\n *\n * var myObject = new MyConstructor();\n * myObject.on('connected', function () { console.log('connected'); });\n * myObject.on('disconnected', function () { console.log('disconnected'); });\n * // This would throw an exception as well:\n * // myObject.on('something-else', function () {});\n */\n\nmodule.exports = function (object) {\n var eventNames = Array.prototype.slice.call(arguments, 1);\n\n for (var key in methods) {\n object[key] = methods[key];\n }\n\n object._handlers = {};\n eventNames.forEach(function (eventName) {\n object._addEvent(eventName);\n });\n};\n\n//# sourceURL=webpack://RemoteStorage/./src/eventhandling.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/features.js":
|
||||
/*!*************************!*\
|
||||
!*** ./src/features.js ***!
|
||||
\*************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar SyncedGetPutDelete = __webpack_require__(/*! ./syncedgetputdelete */ \"./src/syncedgetputdelete.js\");\n\nvar config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n\nvar Features = {\n features: [],\n featuresDone: 0,\n readyFired: false,\n loadFeatures: function loadFeatures() {\n var _this = this;\n\n this.features = [];\n this.featuresDone = 0;\n this.readyFired = false;\n this.featureModules = {\n 'WireClient': __webpack_require__(/*! ./wireclient */ \"./src/wireclient.js\"),\n 'Dropbox': __webpack_require__(/*! ./dropbox */ \"./src/dropbox.js\"),\n 'GoogleDrive': __webpack_require__(/*! ./googledrive */ \"./src/googledrive.js\"),\n 'Access': __webpack_require__(/*! ./access */ \"./src/access.js\"),\n 'Discover': __webpack_require__(/*! ./discover */ \"./src/discover.js\"),\n 'Authorize': __webpack_require__(/*! ./authorize */ \"./src/authorize.js\"),\n 'BaseClient': __webpack_require__(/*! ./baseclient */ \"./src/baseclient.js\"),\n 'Env': __webpack_require__(/*! ./env */ \"./src/env.js\")\n }; // enable caching related modules if needed\n\n if (config.cache) {\n util.extend(this.featureModules, {\n 'Caching': __webpack_require__(/*! ./caching */ \"./src/caching.js\"),\n 'IndexedDB': __webpack_require__(/*! ./indexeddb */ \"./src/indexeddb.js\"),\n 'LocalStorage': __webpack_require__(/*! ./localstorage */ \"./src/localstorage.js\"),\n 'InMemoryStorage': __webpack_require__(/*! ./inmemorystorage */ \"./src/inmemorystorage.js\"),\n 'Sync': __webpack_require__(/*! ./sync */ \"./src/sync.js\")\n });\n } // disable features set in the config object passed to the RemoteStorage\n // constructor\n // For example: ['IndexedDB']\n\n\n config.disableFeatures.forEach(function (feature) {\n if (_this.featureModules[feature]) {\n // this.featureModules[feature] = undefined\n delete _this.featureModules[feature];\n }\n });\n this._allLoaded = false;\n\n for (var featureName in this.featureModules) {\n // FIXME: this has to push the promised return value into an\n // array of promises and use Promise.all to emit `ready`\n // instead of increment a counter of loaded features. -les\n this.loadFeature(featureName);\n }\n },\n\n /**\n * Method: hasFeature\n *\n * Checks whether a feature is enabled or not within remoteStorage.\n * Returns a boolean.\n *\n * Parameters:\n * name - Capitalized name of the feature. e.g. Authorize, or IndexedDB\n *\n * Example:\n * (start code)\n * if (remoteStorage.hasFeature('LocalStorage')) {\n * console.log('LocalStorage is enabled!');\n * }\n * (end code)\n *\n */\n hasFeature: function hasFeature(feature) {\n for (var i = this.features.length - 1; i >= 0; i--) {\n if (this.features[i].name === feature) {\n return this.features[i].supported;\n }\n }\n\n return false;\n },\n loadFeature: function loadFeature(featureName) {\n var _this2 = this;\n\n var feature = this.featureModules[featureName];\n\n var supported = !feature._rs_supported || feature._rs_supported();\n\n log(\"[RemoteStorage] [FEATURE \".concat(featureName, \"] initializing ...\"));\n\n if (_typeof(supported) === 'object') {\n supported.then(function () {\n _this2.featureSupported(featureName, true);\n\n _this2.initFeature(featureName);\n }, function () {\n _this2.featureSupported(featureName, false);\n });\n } else if (typeof supported === 'boolean') {\n this.featureSupported(featureName, supported);\n\n if (supported) {\n this.initFeature(featureName);\n }\n } else {\n this.featureSupported(featureName, false);\n }\n },\n initFeature: function initFeature(featureName) {\n var _this3 = this;\n\n var feature = this.featureModules[featureName];\n var initResult;\n\n try {\n initResult = feature._rs_init(this);\n } catch (e) {\n this.featureFailed(featureName, e);\n return;\n }\n\n if (_typeof(initResult) === 'object' && typeof initResult.then === 'function') {\n initResult.then(function () {\n _this3.featureInitialized(featureName);\n }, function (err) {\n _this3.featureFailed(featureName, err);\n });\n } else {\n this.featureInitialized(featureName);\n }\n },\n featurLine truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/googledrive.js":
|
||||
/*!****************************!*\
|
||||
!*** ./src/googledrive.js ***!
|
||||
\****************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * @class GoogleDrive\n *\n * To use this backend, you need to specify the app's client ID like so:\n *\n * @example\n * remoteStorage.setApiKeys({\n * googledrive: 'your-client-id'\n * });\n *\n * A client ID can be obtained by registering your app in the Google\n * Developers Console: https://console.developers.google.com/flows/enableapi?apiid=drive\n *\n * Docs: https://developers.google.com/drive/v3/web/quickstart/js\n**/\nvar BaseClient = __webpack_require__(/*! ./baseclient */ \"./src/baseclient.js\");\n\nvar WireClient = __webpack_require__(/*! ./wireclient */ \"./src/wireclient.js\");\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar BASE_URL = 'https://www.googleapis.com';\nvar AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';\nvar AUTH_SCOPE = 'https://www.googleapis.com/auth/drive';\nvar SETTINGS_KEY = 'remotestorage:googledrive';\nvar PATH_PREFIX = '/remotestorage';\nvar GD_DIR_MIME_TYPE = 'application/vnd.google-apps.folder';\nvar RS_DIR_MIME_TYPE = 'application/json; charset=UTF-8';\nvar isFolder = util.isFolder;\nvar cleanPath = util.cleanPath;\nvar shouldBeTreatedAsBinary = util.shouldBeTreatedAsBinary;\nvar getJSONFromLocalStorage = util.getJSONFromLocalStorage;\nvar getTextFromArrayBuffer = util.getTextFromArrayBuffer;\nvar hasLocalStorage;\n/**\n * Produce a title from a filename for metadata.\n *\n * @param {string} filename\n * @returns {string} title\n *\n * @private\n */\n\nfunction metaTitleFromFileName(filename) {\n if (filename.substr(-1) === '/') {\n filename = filename.substr(0, filename.length - 1);\n }\n\n return decodeURIComponent(filename);\n}\n/**\n * Get the parent directory for the given path.\n *\n * @param {string} path\n * @returns {string} parent directory\n *\n * @private\n */\n\n\nfunction parentPath(path) {\n return path.replace(/[^\\/]+\\/?$/, '');\n}\n/**\n * Get only the filename from a full path.\n *\n * @param {string} path\n * @returns {string} filename\n *\n * @private\n */\n\n\nfunction baseName(path) {\n var parts = path.split('/');\n\n if (path.substr(-1) === '/') {\n return parts[parts.length - 2] + '/';\n } else {\n return parts[parts.length - 1];\n }\n}\n/**\n * Prepend the path with the remoteStorage base directory.\n *\n * @param {string} path - Path\n * @returns {string} Actual path on Google Drive\n *\n * @private\n */\n\n\nfunction googleDrivePath(path) {\n return cleanPath(\"\".concat(PATH_PREFIX, \"/\").concat(path));\n}\n/**\n * Remove surrounding quotes from a string.\n *\n * @param {string} string - string with surrounding quotes\n * @returns {string} string without surrounding quotes\n *\n * @private\n */\n\n\nfunction removeQuotes(string) {\n return string.replace(/^[\"'](.*)[\"']$/, \"$1\");\n}\n/**\n * Internal cache object for storing Google file IDs.\n *\n * @param {number} maxAge - Maximum age (in seconds) the content should be cached for\n */\n\n\nvar Cache = function Cache(maxAge) {\n this.maxAge = maxAge;\n this._items = {};\n};\n\nCache.prototype = {\n get: function get(key) {\n var item = this._items[key];\n var now = new Date().getTime();\n return item && item.t >= now - this.maxAge ? item.v : undefined;\n },\n set: function set(key, value) {\n this._items[key] = {\n v: value,\n t: new Date().getTime()\n };\n }\n};\n\nvar GoogleDrive = function GoogleDrive(remoteStorage, clientId) {\n eventHandling(this, 'connected', 'not-connected');\n this.rs = remoteStorage;\n this.clientId = clientId;\n this._fileIdCache = new Cache(60 * 5); // IDs expire after 5 minutes (is this a good idea?)\n\n hasLocalStorage = util.localStorageAvailable();\n\n if (hasLocalStorage) {\n var settings = getJSONFromLocalStorage(SETTINGS_KEY);\n\n if (settings) {\n this.configure(settings);\n }\n }\n};\n\nGoogleDrive.prototype = {\n connected: false,\n online: true,\n\n /**\n * Configure the Google Drive backend.\n *\n * Fetches the user info from Google when no ``userAddress`` is given.\n *\n * @param {Object} settings\n * @param {string} [settings.userAddress] - The user's email address\n * @param {string} [settings.token] - Authorization token\n *\n * @protected\n */\n configure: function configure(settings) {\n var _this = this;\n\n // Settings parameter compatible with WireClient\n // We only update this.userAddress if settings.userAddress is set to a string or to null\n if (typeof settings.userAddress !== 'undefined') {\n t
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/indexeddb.js":
|
||||
/*!**************************!*\
|
||||
!*** ./src/indexeddb.js ***!
|
||||
\**************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * TODO rewrite, doesn't expose GPD anymore, it's in cachinglayer now\n *\n * This file exposes a get/put/delete interface, accessing data in an IndexedDB.\n *\n * There are multiple parts to this interface:\n *\n * The RemoteStorage integration:\n * - IndexedDB._rs_supported() determines if IndexedDB support\n * is available. If it isn't, RemoteStorage won't initialize the feature.\n * - IndexedDB._rs_init() initializes the feature. It returns\n * a promise that is fulfilled as soon as the database has been opened and\n * migrated.\n *\n * The storage interface (IndexedDB object):\n * - Usually this is accessible via \"remoteStorage.local\"\n * - #get() takes a path and returns a promise.\n * - #put() takes a path, body and contentType and also returns a promise.\n * - #delete() takes a path and also returns a promise.\n * - #on('change', ...) events, being fired whenever something changes in\n * the storage. Change events roughly follow the StorageEvent pattern.\n * They have \"oldValue\" and \"newValue\" properties, which can be used to\n * distinguish create/update/delete operations and analyze changes in\n * change handlers. In addition they carry a \"origin\" property, which\n * is either \"window\", \"local\", or \"remote\". \"remote\" events are fired\n * whenever a change comes in from Sync.\n *\n * The sync interface (also on IndexedDB object):\n * - #getNodes([paths]) returns the requested nodes in a promise.\n * - #setNodes(map) stores all the nodes given in the (path -> node) map.\n *\n * @interface\n */\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar cachingLayer = __webpack_require__(/*! ./cachinglayer */ \"./src/cachinglayer.js\");\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar DB_VERSION = 2;\nvar DEFAULT_DB_NAME = 'remotestorage';\nvar DEFAULT_DB;\n\nvar IndexedDB = function IndexedDB(database) {\n this.db = database || DEFAULT_DB;\n\n if (!this.db) {\n log(\"[IndexedDB] Failed to open DB\");\n return undefined;\n }\n\n cachingLayer(this);\n eventHandling(this, 'change', 'local-events-done');\n this.getsRunning = 0;\n this.putsRunning = 0;\n /**\n * Given a node for which uncommitted changes exist, this cache\n * stores either the entire uncommitted node, or false for a deletion.\n * The node's path is used as the key.\n *\n * changesQueued stores changes for which no IndexedDB transaction has\n * been started yet.\n */\n\n this.changesQueued = {};\n /**\n * Given a node for which uncommitted changes exist, this cache\n * stores either the entire uncommitted node, or false for a deletion.\n * The node's path is used as the key.\n *\n * At any time there is at most one IndexedDB transaction running.\n * changesRunning stores the changes that are included in that currently\n * running IndexedDB transaction, or if none is running, of the last one\n * that ran.\n */\n\n this.changesRunning = {};\n};\n\nIndexedDB.prototype = {\n /**\n * TODO: Document\n */\n getNodes: function getNodes(paths) {\n var misses = [],\n fromCache = {};\n\n for (var i = 0, len = paths.length; i < len; i++) {\n if (this.changesQueued[paths[i]] !== undefined) {\n fromCache[paths[i]] = util.deepClone(this.changesQueued[paths[i]] || undefined);\n } else if (this.changesRunning[paths[i]] !== undefined) {\n fromCache[paths[i]] = util.deepClone(this.changesRunning[paths[i]] || undefined);\n } else {\n misses.push(paths[i]);\n }\n }\n\n if (misses.length > 0) {\n return this.getNodesFromDb(misses).then(function (nodes) {\n for (var _i in fromCache) {\n nodes[_i] = fromCache[_i];\n }\n\n return nodes;\n });\n } else {\n return Promise.resolve(fromCache);\n }\n },\n\n /**\n * TODO: Document\n */\n setNodes: function setNodes(nodes) {\n for (var i in nodes) {\n this.changesQueued[i] = nodes[i] || false;\n }\n\n this.maybeFlush();\n return Promise.resolve();\n },\n\n /**\n * TODO: Document\n */\n maybeFlush: function maybeFlush() {\n if (this.putsRunning === 0) {\n this.flushChangesQueued();\n } else {\n if (!this.commitSlownessWarning) {\n this.commitSlownessWarning = setInterval(function () {\n console.warn('WARNING: waited more than 10 seconds for previous commit to fiLine truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/inmemorystorage.js":
|
||||
/*!********************************!*\
|
||||
!*** ./src/inmemorystorage.js ***!
|
||||
\********************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar cachingLayer = __webpack_require__(/*! ./cachinglayer */ \"./src/cachinglayer.js\");\n/**\n * In-memory caching adapter. Used when no IndexedDB or localStorage\n * available.\n *\n * @class\n **/\n\n\nvar InMemoryStorage = function InMemoryStorage() {\n cachingLayer(this);\n log('[InMemoryStorage] Registering events');\n eventHandling(this, 'change', 'local-events-done');\n this._storage = {};\n};\n\nInMemoryStorage.prototype = {\n getNodes: function getNodes(paths) {\n var nodes = {};\n\n for (var i = 0, len = paths.length; i < len; i++) {\n nodes[paths[i]] = this._storage[paths[i]];\n }\n\n return Promise.resolve(nodes);\n },\n setNodes: function setNodes(nodes) {\n for (var path in nodes) {\n if (nodes[path] === undefined) {\n delete this._storage[path];\n } else {\n this._storage[path] = nodes[path];\n }\n }\n\n return Promise.resolve();\n },\n forAllNodes: function forAllNodes(cb) {\n for (var path in this._storage) {\n cb(this.migrate(this._storage[path]));\n }\n\n return Promise.resolve();\n }\n};\n/**\n * Initialize the InMemoryStorage backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n\nInMemoryStorage._rs_init = function () {};\n/**\n * Inform about the availability of the InMemoryStorage backend.\n *\n * @returns {Boolean}\n *\n * @protected\n */\n\n\nInMemoryStorage._rs_supported = function () {\n // In-memory storage is always supported\n return true;\n};\n/**\n * Remove InMemoryStorage as a backend.\n *\n * @protected\n */\n\n\nInMemoryStorage._rs_cleanup = function () {};\n\nmodule.exports = InMemoryStorage;\n\n//# sourceURL=webpack://RemoteStorage/./src/inmemorystorage.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/localstorage.js":
|
||||
/*!*****************************!*\
|
||||
!*** ./src/localstorage.js ***!
|
||||
\*****************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var cachingLayer = __webpack_require__(/*! ./cachinglayer */ \"./src/cachinglayer.js\");\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n/**\n * localStorage caching adapter. Used when no IndexedDB available.\n **/\n\n\nvar NODES_PREFIX = \"remotestorage:cache:nodes:\";\nvar CHANGES_PREFIX = \"remotestorage:cache:changes:\";\n\nvar LocalStorage = function LocalStorage() {\n cachingLayer(this);\n log('[LocalStorage] Registering events');\n eventHandling(this, 'change', 'local-events-done');\n};\n\nfunction isRemoteStorageKey(key) {\n return key.substr(0, NODES_PREFIX.length) === NODES_PREFIX || key.substr(0, CHANGES_PREFIX.length) === CHANGES_PREFIX;\n}\n\nfunction isNodeKey(key) {\n return key.substr(0, NODES_PREFIX.length) === NODES_PREFIX;\n}\n\nLocalStorage.prototype = {\n getNodes: function getNodes(paths) {\n var nodes = {};\n\n for (var i = 0, len = paths.length; i < len; i++) {\n try {\n nodes[paths[i]] = JSON.parse(localStorage[NODES_PREFIX + paths[i]]);\n } catch (e) {\n nodes[paths[i]] = undefined;\n }\n }\n\n return Promise.resolve(nodes);\n },\n setNodes: function setNodes(nodes) {\n for (var path in nodes) {\n // TODO shouldn't we use getItem/setItem?\n localStorage[NODES_PREFIX + path] = JSON.stringify(nodes[path]);\n }\n\n return Promise.resolve();\n },\n forAllNodes: function forAllNodes(cb) {\n var node;\n\n for (var i = 0, len = localStorage.length; i < len; i++) {\n if (isNodeKey(localStorage.key(i))) {\n try {\n node = this.migrate(JSON.parse(localStorage[localStorage.key(i)]));\n } catch (e) {\n node = undefined;\n }\n\n if (node) {\n cb(node);\n }\n }\n }\n\n return Promise.resolve();\n }\n};\n/**\n * Initialize the LocalStorage backend.\n *\n * @protected\n */\n\nLocalStorage._rs_init = function () {};\n/**\n * Inform about the availability of the LocalStorage backend.\n *\n * @returns {Boolean}\n *\n * @protected\n */\n\n\nLocalStorage._rs_supported = function () {\n return util.localStorageAvailable();\n};\n/**\n * Remove LocalStorage as a backend.\n *\n * @protected\n *\n * TODO: tests missing!\n */\n\n\nLocalStorage._rs_cleanup = function () {\n var keys = [];\n\n for (var i = 0, len = localStorage.length; i < len; i++) {\n var key = localStorage.key(i);\n\n if (isRemoteStorageKey(key)) {\n keys.push(key);\n }\n }\n\n keys.forEach(function (key) {\n log('[LocalStorage] Removing', key);\n delete localStorage[key];\n });\n};\n\nmodule.exports = LocalStorage;\n\n//# sourceURL=webpack://RemoteStorage/./src/localstorage.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/log.js":
|
||||
/*!********************!*\
|
||||
!*** ./src/log.js ***!
|
||||
\********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n/**\n * Log using console.log, when remoteStorage logging is enabled.\n *\n * You can enable logging with ``RemoteStorage#enableLog``.\n *\n * (In node.js you can also enable logging during remoteStorage object\n * creation. See: {@link RemoteStorage}).\n */\n\n\nfunction log() {\n if (config.logging) {\n // eslint-disable-next-line no-console\n console.log.apply(console, arguments);\n }\n}\n\nmodule.exports = log;\n\n//# sourceURL=webpack://RemoteStorage/./src/log.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/modules.js":
|
||||
/*!************************!*\
|
||||
!*** ./src/modules.js ***!
|
||||
\************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("var BaseClient = __webpack_require__(/*! ./baseclient */ \"./src/baseclient.js\");\n\nvar RemoteStorage = __webpack_require__(/*! ./remotestorage */ \"./src/remotestorage.js\");\n/*\n * Add remoteStorage data module\n *\n * @param {Object} module - module object needs following properies:\n * @param {string} [module.name] - Name of the module\n * @param {function} [module.builder] - Builder function defining the module\n *\n * The module builder function should return an object containing another\n * object called exports, which will be exported to this <RemoteStorage>\n * instance under the module's name. So when defining a locations module,\n * like in the example below, it would be accessible via\n * `remoteStorage.locations`, which would in turn have a `features` and a\n * `collections` property.\n *\n * The function receives a private and a public client, which are both\n * instances of <RemoteStorage.BaseClient>. In the following example, the\n * scope of privateClient is `/locations` and the scope of publicClient is\n * `/public/locations`.\n *\n * @example\n * RemoteStorage.addModule({name: 'locations', builder: function (privateClient, publicClient) {\n * return {\n * exports: {\n * features: privateClient.scope('features/').defaultType('feature'),\n * collections: privateClient.scope('collections/').defaultType('feature-collection')\n * }\n * };\n * }});\n*/\n\n\nRemoteStorage.prototype.addModule = function (module) {\n var moduleName = module.name;\n var moduleBuilder = module.builder;\n Object.defineProperty(this, moduleName, {\n configurable: true,\n get: function get() {\n var instance = this._loadModule(moduleName, moduleBuilder);\n\n Object.defineProperty(this, moduleName, {\n value: instance\n });\n return instance;\n }\n });\n\n if (moduleName.indexOf('-') !== -1) {\n var camelizedName = moduleName.replace(/\\-[a-z]/g, function (s) {\n return s[1].toUpperCase();\n });\n Object.defineProperty(this, camelizedName, {\n get: function get() {\n return this[moduleName];\n }\n });\n }\n};\n/*\n * Load module\n *\n * @private\n *\n */\n\n\nRemoteStorage.prototype._loadModule = function (moduleName, moduleBuilder) {\n if (moduleBuilder) {\n var module = moduleBuilder(new BaseClient(this, '/' + moduleName + '/'), new BaseClient(this, '/public/' + moduleName + '/'));\n return module.exports;\n } else {\n throw \"Unknown module: \" + moduleName;\n }\n};\n\n//# sourceURL=webpack://RemoteStorage/./src/modules.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/remotestorage.js":
|
||||
/*!******************************!*\
|
||||
!*** ./src/remotestorage.js ***!
|
||||
\******************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar Dropbox = __webpack_require__(/*! ./dropbox */ \"./src/dropbox.js\");\n\nvar GoogleDrive = __webpack_require__(/*! ./googledrive */ \"./src/googledrive.js\");\n\nvar Discover = __webpack_require__(/*! ./discover */ \"./src/discover.js\");\n\nvar BaseClient = __webpack_require__(/*! ./baseclient */ \"./src/baseclient.js\");\n\nvar config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n\nvar Authorize = __webpack_require__(/*! ./authorize */ \"./src/authorize.js\");\n\nvar Sync = __webpack_require__(/*! ./sync */ \"./src/sync.js\");\n\nvar _log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar Features = __webpack_require__(/*! ./features */ \"./src/features.js\");\n\nvar globalContext = util.getGlobalContext();\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar getJSONFromLocalStorage = util.getJSONFromLocalStorage;\nvar hasLocalStorage; // TODO document and/or refactor (seems weird)\n\nfunction emitUnauthorized(r) {\n if (r.statusCode === 403 || r.statusCode === 401) {\n this._emit('error', new Authorize.Unauthorized());\n }\n\n return Promise.resolve(r);\n}\n/**\n * Constructor for the remoteStorage object.\n *\n * This class primarily contains feature detection code and convenience API.\n *\n * Depending on which features are built in, it contains different attributes\n * and functions. See the individual features for more information.\n *\n * @param {object} config - an optional configuration object\n * @class\n */\n\n\nvar RemoteStorage = function RemoteStorage(cfg) {\n // Initial configuration property settings.\n if (_typeof(cfg) === 'object') {\n util.extend(config, cfg);\n }\n\n eventHandling(this, 'ready', 'authing', 'connecting', 'connected', 'disconnected', 'not-connected', 'conflict', 'error', 'features-loaded', 'sync-interval-change', 'sync-req-done', 'sync-done', 'wire-busy', 'wire-done', 'network-offline', 'network-online');\n /**\n * Pending get/put/delete calls\n *\n * @private\n */\n\n this._pending = [];\n /**\n * TODO: document\n *\n * @private\n */\n\n this._setGPD({\n get: this._pendingGPD('get'),\n put: this._pendingGPD('put'),\n \"delete\": this._pendingGPD('delete')\n });\n /**\n * TODO: document\n *\n * @private\n */\n\n\n this._cleanups = [];\n /**\n * TODO: document\n *\n * @private\n */\n\n this._pathHandlers = {\n change: {}\n };\n /**\n * Holds OAuth app keys for Dropbox, Google Drive\n *\n * @private\n */\n\n this.apiKeys = {};\n hasLocalStorage = util.localStorageAvailable();\n\n if (hasLocalStorage) {\n this.apiKeys = getJSONFromLocalStorage('remotestorage:api-keys') || {};\n this.setBackend(localStorage.getItem('remotestorage:backend') || 'remotestorage');\n } // Keep a reference to the orginal `on` function\n\n\n var origOn = this.on;\n /**\n * Register an event handler. See :ref:`rs-events` for available event names.\n *\n * @param {string} eventName - Name of the event\n * @param {function} handler - Event handler\n */\n\n this.on = function (eventName, handler) {\n if (this._allLoaded) {\n // check if the handler should be called immediately, because the\n // event has happened already\n switch (eventName) {\n case 'features-loaded':\n setTimeout(handler, 0);\n break;\n\n case 'ready':\n if (this.remote) {\n setTimeout(handler, 0);\n }\n\n break;\n\n case 'connected':\n if (this.remote && this.remote.connected) {\n setTimeout(handler, 0);\n }\n\n break;\n\n case 'not-connected':\n if (this.remote && !this.remote.connected) {\n setTimeout(handler, 0);\n }\n\n break;\n }\n }\n\n return origOn.call(this, eventName, handler);\n }; // load all features and emit `ready`\n\n\n this._init();\n /**\n * TODO: document\n */\n\n\n this.fireInitial = function () {\n if (this.local) {\n setTimeout(this.local.fireInitial.bind(this.local), 0);\n }\n }.bind(this);\n\n this.on('ready', this.fireInitial.bind(this));\n this.loadModules();\n}; // FIXME: Instead of doing this, would be better to only\n// export setAuthURL / getAuthURL from RemoteStorage prototype\n\n\nRemoteStorage.Authorize = Authorize;\nRemoteStorage.SyncError = Sync.SyncError;\nRemoteStorage.Unauthorized = Authorize.Unauthorized;\nRemoteStorage.DiscoveryError = Discover.Discove
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/revisioncache.js":
|
||||
/*!******************************!*\
|
||||
!*** ./src/revisioncache.js ***!
|
||||
\******************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("/**\n * A cache which can propagate changes up to parent folders and generate new\n * revision ids for them. The generated revision id is consistent across\n * different sessions. The keys for the cache are case-insensitive.\n *\n * @param defaultValue {string} the value that is returned for all keys that\n * don't exist in the cache\n *\n * @class\n */\nfunction RevisionCache(defaultValue) {\n this.defaultValue = defaultValue;\n this._canPropagate = false;\n this._storage = {};\n this._itemsRev = {};\n this.activatePropagation();\n}\n\nRevisionCache.prototype = {\n /**\n * Get a value from the cache or defaultValue, if the key is not in the\n * cache\n */\n get: function get(key) {\n key = key.toLowerCase();\n var stored = this._storage[key];\n\n if (typeof stored === 'undefined') {\n stored = this.defaultValue;\n this._storage[key] = stored;\n }\n\n return stored;\n },\n\n /**\n * Set a value\n */\n set: function set(key, value) {\n key = key.toLowerCase();\n\n if (this._storage[key] === value) {\n return value;\n }\n\n this._storage[key] = value;\n\n if (!value) {\n delete this._itemsRev[key];\n }\n\n this._updateParentFolderItemRev(key, value);\n\n if (this._canPropagate) {\n this._propagate(key);\n }\n\n return value;\n },\n\n /**\n * Delete a value\n */\n \"delete\": function _delete(key) {\n return this.set(key, null);\n },\n\n /**\n * Disables automatic update of folder revisions when a key value is updated\n */\n deactivatePropagation: function deactivatePropagation() {\n this._canPropagate = false;\n return true;\n },\n\n /**\n * Enables automatic update of folder revisions when a key value is updated\n * and refreshes the folder revision ids for entire tree.\n */\n activatePropagation: function activatePropagation() {\n if (this._canPropagate) {\n return true;\n }\n\n this._generateFolderRev(\"/\");\n\n this._canPropagate = true;\n return true;\n },\n\n /**\n * Returns a hash code for a string.\n */\n _hashCode: function _hashCode(str) {\n var hash = 0,\n i,\n chr;\n\n if (str.length === 0) {\n return hash;\n }\n\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i); // eslint-disable-next-line no-bitwise\n\n hash = (hash << 5) - hash + chr; // eslint-disable-next-line no-bitwise\n\n hash |= 0; // Convert to 32bit integer\n }\n\n return hash;\n },\n\n /**\n * Takes an array of strings and returns a hash of the items\n */\n _generateHash: function _generateHash(items) {\n // We sort the items before joining them to ensure correct hash generation\n // every time\n var files = items.sort().join('|');\n\n var hash = \"\" + this._hashCode(files);\n\n return hash;\n },\n\n /**\n * Update the revision of a key in it's parent folder data\n */\n _updateParentFolderItemRev: function _updateParentFolderItemRev(key, rev) {\n if (key !== '/') {\n var parentFolder = this._getParentFolder(key);\n\n if (!this._itemsRev[parentFolder]) {\n this._itemsRev[parentFolder] = {};\n }\n\n var parentFolderItemsRev = this._itemsRev[parentFolder];\n\n if (!rev) {\n delete parentFolderItemsRev[key];\n } else {\n parentFolderItemsRev[key] = rev;\n } //reset revision until root\n\n\n this._updateParentFolderItemRev(parentFolder, this.defaultValue);\n }\n },\n _getParentFolder: function _getParentFolder(key) {\n return key.substr(0, key.lastIndexOf(\"/\", key.length - 2) + 1);\n },\n\n /**\n * Propagate the changes to the parent folders and generate new revision ids\n * for them\n */\n _propagate: function _propagate(key) {\n if (key !== '/') {\n var parentFolder = this._getParentFolder(key);\n\n var parentFolderItemsRev = this._itemsRev[parentFolder];\n var hashItems = [];\n\n for (var path in parentFolderItemsRev) {\n hashItems.push(parentFolderItemsRev[path]);\n }\n\n var newRev = this._generateHash(hashItems);\n\n this.set(parentFolder, newRev);\n }\n },\n\n /**\n * Generate revision id for a folder and it's subfolders, by hashing it's\n * listing\n */\n _generateFolderRev: function _generateFolderRev(folder) {\n var itemsRev = this._itemsRev[folder];\n var hash = this.defaultValue;\n\n if (itemsRev) {\n var hashItems = [];\n\n for (var path in itemsRev) {\n var isDir = path.substr(-1) === '/';\n var hashItem = void 0;\n\n if (isDir) {\n hashItem = this._generateFolderRev(path);\n } else {\n hashItem = itemsRev[path];\n }\n\n hashItems.push(hashItem);\n }\n\n if (hashItems.length > 0) {\n hash = this._generateHash(hashItems);\n }\n }\n\n this.set(folder, hash);\n return hash;\n }\n};\nmodule.exports = RevisioLine truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/sync.js":
|
||||
/*!*********************!*\
|
||||
!*** ./src/sync.js ***!
|
||||
\*********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar _require = __webpack_require__(/*! ./util */ \"./src/util.js\"),\n isFolder = _require.isFolder,\n isDocument = _require.isDocument,\n equal = _require.equal,\n deepClone = _require.deepClone,\n pathsFromRoot = _require.pathsFromRoot;\n\nvar Env = __webpack_require__(/*! ./env */ \"./src/env.js\");\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar Authorize = __webpack_require__(/*! ./authorize */ \"./src/authorize.js\");\n\nvar config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n\nvar syncCycleCb, _syncOnConnect;\n\nfunction taskFor(action, path, promise) {\n return {\n action: action,\n path: path,\n promise: promise\n };\n}\n\nfunction nodeChanged(node, etag) {\n return node.common.revision !== etag && (!node.remote || node.remote.revision !== etag);\n}\n\nfunction isStaleChild(node) {\n return node.remote && node.remote.revision && !node.remote.itemsMap && !node.remote.body;\n}\n\nfunction hasCommonRevision(node) {\n return node.common && node.common.reLine truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/syncedgetputdelete.js":
|
||||
/*!***********************************!*\
|
||||
!*** ./src/syncedgetputdelete.js ***!
|
||||
\***********************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nfunction shareFirst(path) {\n return this.backend === 'dropbox' && path.match(/^\\/public\\/.*[^\\/]$/);\n}\n\nfunction defaultMaxAge(context) {\n if (_typeof(context.remote) === 'object' && context.remote.connected && context.remote.online) {\n return 2 * context.getSyncInterval();\n } else {\n log('Not setting default maxAge, because remote is offline or not connected');\n return false;\n }\n}\n\nvar SyncedGetPutDelete = {\n get: function get(path, maxAge) {\n if (!this.local) {\n return this.remote.get(path);\n } else {\n if (typeof maxAge === 'undefined') {\n maxAge = defaultMaxAge(this);\n } else if (typeof maxAge !== 'number' && maxAge !== false) {\n return Promise.reject(\"Argument 'maxAge' must be 'false' or a number\");\n }\n\n return this.local.get(path, maxAge, this.sync.queueGetRequest.bind(this.sync));\n }\n },\n put: function put(path, body, contentType) {\n if (shareFirst.bind(this)(path)) {\n return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.put(path, body, contentType));\n } else if (this.local) {\n return this.local.put(path, body, contentType);\n } else {\n return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.put(path, body, contentType));\n }\n },\n 'delete': function _delete(path) {\n if (this.local) {\n return this.local[\"delete\"](path);\n } else {\n return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote[\"delete\"](path));\n }\n },\n _wrapBusyDone: function _wrapBusyDone(result) {\n var self = this;\n\n this._emit('wire-busy');\n\n return result.then(function (r) {\n self._emit('wire-done', {\n success: true\n });\n\n return Promise.resolve(r);\n }, function (err) {\n self._emit('wire-done', {\n success: false\n });\n\n return Promise.reject(err);\n });\n }\n};\nmodule.exports = SyncedGetPutDelete;\n\n//# sourceURL=webpack://RemoteStorage/./src/syncedgetputdelete.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/types.js":
|
||||
/*!**********************!*\
|
||||
!*** ./src/types.js ***!
|
||||
\**********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("/**\n * @class BaseClient.Types\n *\n * - Manages and validates types of remoteStorage objects, using JSON-LD and\n * JSON Schema\n * - Adds schema declaration/validation methods to BaseClient instances.\n **/\nvar Types = {\n /**\n * <alias> -> <uri>\n */\n uris: {},\n\n /**\n * Contains schema objects of all types known to the BaseClient instance\n *\n * <uri> -> <schema>\n */\n schemas: {},\n\n /**\n * <uri> -> <alias>\n */\n aliases: {},\n\n /**\n * Called via public function BaseClient.declareType()\n *\n * @private\n */\n declare: function declare(moduleName, alias, uri, schema) {\n var fullAlias = moduleName + '/' + alias;\n\n if (schema[\"extends\"]) {\n var extendedAlias;\n var parts = schema[\"extends\"].split('/');\n\n if (parts.length === 1) {\n extendedAlias = moduleName + '/' + parts.shift();\n } else {\n extendedAlias = parts.join('/');\n }\n\n var extendedUri = this.uris[extendedAlias];\n\n if (!extendedUri) {\n throw \"Type '\" + fullAlias + \"' tries to extend unknown schema '\" + extendedAlias + \"'\";\n }\n\n schema[\"extends\"] = this.schemas[extendedUri];\n }\n\n this.uris[fullAlias] = uri;\n this.aliases[uri] = fullAlias;\n this.schemas[uri] = schema;\n },\n resolveAlias: function resolveAlias(alias) {\n return this.uris[alias];\n },\n getSchema: function getSchema(uri) {\n return this.schemas[uri];\n },\n inScope: function inScope(moduleName) {\n var ml = moduleName.length;\n var schemas = {};\n\n for (var alias in this.uris) {\n if (alias.substr(0, ml + 1) === moduleName + '/') {\n var uri = this.uris[alias];\n schemas[uri] = this.schemas[uri];\n }\n }\n\n return schemas;\n }\n};\n\nvar SchemaNotFound = function SchemaNotFound(uri) {\n var error = new Error(\"Schema not found: \" + uri);\n error.name = \"SchemaNotFound\";\n return error;\n};\n\nSchemaNotFound.prototype = Error.prototype;\nTypes.SchemaNotFound = SchemaNotFound;\nmodule.exports = Types;\n\n//# sourceURL=webpack://RemoteStorage/./src/types.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/util.js":
|
||||
/*!*********************!*\
|
||||
!*** ./src/util.js ***!
|
||||
\*********************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("/* WEBPACK VAR INJECTION */(function(global, Buffer) {function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n// Reusable utility functions\n\n/**\n * Takes an object and its copy as produced by the _deepClone function\n * below, and finds and fixes any ArrayBuffers that were cast to `{}` instead\n * of being cloned to new ArrayBuffers with the same content.\n *\n * It recurses into sub-objects, but skips arrays if they occur.\n */\nfunction fixArrayBuffers(srcObj, dstObj) {\n var field, srcArr, dstArr;\n\n if (_typeof(srcObj) !== 'object' || Array.isArray(srcObj) || srcObj === null) {\n return;\n }\n\n for (field in srcObj) {\n if (_typeof(srcObj[field]) === 'object' && srcObj[field] !== null) {\n if (srcObj[field].toString() === '[object ArrayBuffer]') {\n dstObj[field] = new ArrayBuffer(srcObj[field].byteLength);\n srcArr = new Int8Array(srcObj[field]);\n dstArr = new Int8Array(dstObj[field]);\n dstArr.set(srcArr);\n } else {\n fixArrayBuffers(srcObj[field], dstObj[field]);\n }\n }\n }\n}\n\nvar util = {\n logError: function logError(error) {\n if (typeof error === 'string') {\n console.error(error);\n } else {\n console.error(error.message, error.stack);\n }\n },\n globalContext: typeof window !== 'undefined' ? window : (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === 'object' ? self : global,\n getGlobalContext: function getGlobalContext() {\n return typeof window !== 'undefined' ? window : (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === 'object' ? self : global;\n },\n extend: function extend(target) {\n var sources = Array.prototype.slice.call(arguments, 1);\n sources.forEach(function (source) {\n for (var key in source) {\n target[key] = source[key];\n }\n });\n return target;\n },\n containingFolder: function containingFolder(path) {\n if (path === '') {\n return '/';\n }\n\n if (!path) {\n throw \"Path not given!\";\n }\n\n return path.replace(/\\/+/g, '/').replace(/[^\\/]+\\/?$/, '');\n },\n isFolder: function isFolder(path) {\n return path.substr(-1) === '/';\n },\n isDocument: function isDocument(path) {\n return !util.isFolder(path);\n },\n baseName: function baseName(path) {\n var parts = path.split('/');\n\n if (util.isFolder(path)) {\n return parts[parts.length - 2] + '/';\n } else {\n return parts[parts.length - 1];\n }\n },\n cleanPath: function cleanPath(path) {\n return path.replace(/\\/+/g, '/').split('/').map(encodeURIComponent).join('/').replace(/'/g, '%27');\n },\n bindAll: function bindAll(object) {\n for (var key in this) {\n if (typeof object[key] === 'function') {\n object[key] = object[key].bind(object);\n }\n }\n },\n equal: function equal(a, b, seen) {\n var key;\n seen = seen || [];\n\n if (_typeof(a) !== _typeof(b)) {\n return false;\n }\n\n if (typeof a === 'number' || typeof a === 'boolean' || typeof a === 'string') {\n return a === b;\n }\n\n if (typeof a === 'function') {\n return a.toString() === b.toString();\n }\n\n if (a instanceof ArrayBuffer && b instanceof ArrayBuffer) {\n // Without the following conversion the browsers wouldn't be able to\n // tell the ArrayBuffer instances apart.\n a = new Uint8Array(a);\n b = new Uint8Array(b);\n } // If this point has been reached, a and b are either arrays or objects.\n\n\n if (a instanceof Array) {\n if (a.length !== b.length) {\n return false;\n }\n\n for (var i = 0, c = a.length; i < c; i++) {\n if (!util.equal(a[i], b[i], seen)) {\n return false;\n }\n }\n } else {\n // Check that keys from a exist in b\n for (key in a) {\n if (a.hasOwnProperty(key) && !(key in b)) {\n return false;\n }\n } // Check that keys from b exist in a, and compare the values\n\n\n for (key in b) {\n if (!b.hasOwnProperty(key)) {\n continue;\n }\n\n if (!(key in a)) {\n return false;\n }\n\n var seenArg;\n\n if (_typeof(b[key]) === 'object') {\n if (seen.indexOf(b[key]) >= 0) {\n // Circular reference, don't attempt to compare this object.\n // If nothing else returns false, the objects match.\n continue;\n }\n\n seenArg = seen.slice();\n seenArg.push(b[key]);\n }\n\n if (!util.equal(a[key], b[key], seenArg)) {\n return false;\n }\n }\n
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/wireclient.js":
|
||||
/*!***************************!*\
|
||||
!*** ./src/wireclient.js ***!
|
||||
\***************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar log = __webpack_require__(/*! ./log */ \"./src/log.js\");\n\nvar util = __webpack_require__(/*! ./util */ \"./src/util.js\");\n\nvar eventHandling = __webpack_require__(/*! ./eventhandling */ \"./src/eventhandling.js\");\n\nvar Authorize = __webpack_require__(/*! ./authorize */ \"./src/authorize.js\");\n\nvar config = __webpack_require__(/*! ./config */ \"./src/config.js\");\n/**\n * This file exposes a get/put/delete interface on top of fetch() or XMLHttpRequest.\n * It requires to be configured with parameters about the remotestorage server to\n * connect to.\n * Each instance of WireClient is always associated with a single remotestorage\n * server and access token.\n *\n * Usually the WireClient instance can be accessed via `remoteStorage.remote`.\n *\n * This is the get/put/delete interface:\n *\n * - #get() takes a path and optionally a ifNoneMatch option carrying a version\n * string to check. It returns a promise that will be fulfilled with the HTTP\n * response status, the response body, the MIME type as returned in the\n * 'Content-Type' header and the current revision, as returned in the 'ETag'\n * header.\n * - #put() takes a path, the request body and a content type string. It also\n * accepts the ifMatch and ifNoneMatch options, that map to the If-Match and\n * If-None-Match headers respectively. See the remotestorage-01 specification\n * for details on handling these headers. It returns a promise, fulfilled with\n * the same values as the one for #get().\n * - #delete() takes a path and the ifMatch option as well. It returns a promise\n * fulfilled with the same values as the one for #get().\n *\n * In addition to this, the WireClient has some compatibility features to work with\n * remotestorage 2012.04 compatible storages. For example it will cache revisions\n * from folder listings in-memory and return them accordingly as the \"revision\"\n * parameter in response to #get() requests. Similarly it will return 404 when it\n * receives an empty folder listing, to mimic remotestorage-01 behavior. Note\n * that it is not always possible to know the revision beforehand, hence it may\n * be undefined at times (especially for caching-roots).\n *\n * @interface\n */\n\n\nvar hasLocalStorage;\nvar SETTINGS_KEY = 'remotestorage:wireclient';\nvar API_2012 = 1,\n API_00 = 2,\n API_01 = 3,\n API_02 = 4,\n API_HEAD = 5;\nvar STORAGE_APIS = {\n 'draft-dejong-remotestorage-00': API_00,\n 'draft-dejong-remotestorage-01': API_01,\n 'draft-dejong-remotestorage-02': API_02,\n 'https://www.w3.org/community/rww/wiki/read-write-web-00#simple': API_2012\n};\nvar isArrayBufferView;\n\nif (typeof ArrayBufferView === 'function') {\n isArrayBufferView = function isArrayBufferView(object) {\n return object && object instanceof ArrayBufferView;\n };\n} else {\n var arrayBufferViews = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];\n\n isArrayBufferView = function isArrayBufferView(object) {\n for (var i = 0; i < 8; i++) {\n if (object instanceof arrayBufferViews[i]) {\n return true;\n }\n }\n\n return false;\n };\n}\n\nvar isFolder = util.isFolder;\nvar cleanPath = util.cleanPath;\nvar shouldBeTreatedAsBinary = util.shouldBeTreatedAsBinary;\nvar getJSONFromLocalStorage = util.getJSONFromLocalStorage;\nvar getTextFromArrayBuffer = util.getTextFromArrayBuffer;\n\nfunction addQuotes(str) {\n if (typeof str !== 'string') {\n return str;\n }\n\n if (str === '*') {\n return '*';\n }\n\n return '\"' + str + '\"';\n}\n\nfunction stripQuotes(str) {\n if (typeof str !== 'string') {\n return str;\n }\n\n return str.replace(/^[\"']|[\"']$/g, '');\n}\n\nfunction determineCharset(mimeType) {\n var charset = 'UTF-8';\n var charsetMatch;\n\n if (mimeType) {\n charsetMatch = mimeType.match(/charset=(.+)$/);\n\n if (charsetMatch) {\n charset = charsetMatch[1];\n }\n }\n\n return charset;\n}\n\nfunction isFolderDescription(body) {\n return body['@context'] === 'http://remotestorage.io/spec/folder-description' && _typeof(body['items']) === 'object';\n}\n\nfunction isSuccessStatus(status) {\n return [201, 204, 304].indexOf(status) >= 0;\n}\n\nfunction isErrorStatus(status) {\n return [401, 403, 404, 412].indexOf(status) >= 0;\n}\n/**\n * Class : WireClient\n **/\n\n\nvar WireClient = function WireClient(rs) {\n this.rs = rs;\n this.connected = false;\n /**\n * Event: connected\n * Fired when the wireclient connect method realizes that it is in\n *
Line truncated
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 0:
|
||||
/*!************************************!*\
|
||||
!*** multi ./src/remotestorage.js ***!
|
||||
\************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("module.exports = __webpack_require__(/*! ./src/remotestorage.js */\"./src/remotestorage.js\");\n\n\n//# sourceURL=webpack://RemoteStorage/multi_./src/remotestorage.js?");
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
});
|
||||
/*! remotestorage.js 1.2.3, https://remotestorage.io, MIT licensed */
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RemoteStorage",[],t):"object"==typeof exports?exports.RemoteStorage=t():e.RemoteStorage=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){(function(t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o={logError:function(e){"string"==typeof e?console.error(e):console.error(e.message,e.stack)},globalContext:"undefined"!=typeof window?window:"object"===("undefined"==typeof self?"undefined":n(self))?self:t,getGlobalContext:function(){return"undefined"!=typeof window?window:"object"===("undefined"==typeof self?"undefined":n(self))?self:t},extend:function(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach((function(t){for(var r in t)e[r]=t[r]})),e},containingFolder:function(e){if(""===e)return"/";if(!e)throw"Path not given!";return e.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},isFolder:function(e){return"/"===e.substr(-1)},isDocument:function(e){return!o.isFolder(e)},baseName:function(e){var t=e.split("/");return o.isFolder(e)?t[t.length-2]+"/":t[t.length-1]},cleanPath:function(e){return e.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27")},bindAll:function(e){for(var t in this)"function"==typeof e[t]&&(e[t]=e[t].bind(e))},equal:function(e,t,r){var i;if(r=r||[],n(e)!==n(t))return!1;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e===t;if("function"==typeof e)return e.toString()===t.toString();if(e instanceof ArrayBuffer&&t instanceof ArrayBuffer&&(e=new Uint8Array(e),t=new Uint8Array(t)),e instanceof Array){if(e.length!==t.length)return!1;for(var s=0,a=e.length;s<a;s++)if(!o.equal(e[s],t[s],r))return!1}else{for(i in e)if(e.hasOwnProperty(i)&&!(i in t))return!1;for(i in t)if(t.hasOwnProperty(i)){if(!(i in e))return!1;var u;if("object"===n(t[i])){if(r.indexOf(t[i])>=0)continue;(u=r.slice()).push(t[i])}if(!o.equal(e[i],t[i],u))return!1}}return!0},deepClone:function(e){var t;return void 0===e?void 0:(function e(t,r){var o,i;if("object"===n(t)&&!Array.isArray(t)&&null!==t)for(o in t)"object"===n(t[o])&&null!==t[o]&&("[object ArrayBuffer]"===t[o].toString()?(r[o]=new ArrayBuffer(t[o].byteLength),i=new Int8Array(t[o]),new Int8Array(r[o]).set(i)):e(t[o],r[o]))}(e,t=JSON.parse(JSON.stringify(e))),t)},pathsFromRoot:function(e){for(var t=[e],r=e.replace(/\/$/,"").split("/");r.length>1;)r.pop(),t.push(r.join("/")+"/");return t},localStorageAvailable:function(){var e=o.getGlobalContext();if(!("localStorage"in e))return!1;try{return e.localStorage.setItem("rs-check",1),e.localStorage.removeItem("rs-check"),!0}catch(e){return!1}},getJSONFromLocalStorage:function(e){var t=o.getGlobalContext();try{return JSON.parse(t.localStorage.getItem(e))}catch(e){}},shouldBeTreatedAsBinary:function(e,t){return t&&t.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\uFFFD]/.test(e)},getTextFromArrayBuffer:function(e,n){return new Promise((function(i){if("undefined"==typeof Blob){var s=new r(new Uint8Array(e));i(s.toString(n))}else{var a;if(o.globalContext.BlobBuilder=o.globalContext.BlobBuilder||o.globalContext.WebKitBlobBuilder,void 0!==o.globalContext.BlobBuilder){var u=new t.BlobBuilder;u.append(e),a=u.getBlob()}else a=new Blob([e]);var c=new FileReader;"function"==typeof c.addEventListener?c.addEventListener("loadend",(function(e){i(e.target.result)})):c.onloadend=function(e){i(e.target.result)},c.readAsText(a,n)}}))}};e.exports=o}).call(this,r(10),r(18).Buffer)},function(e,t,r){var n=r(3);e.exports=function(){n.logging&&console.log.apply(console,arguments)}},function(e,t,r){var n=r(1),o={addEventListener:function(e,t){if("string"!=typeof e)throw new Error("Argument eventName should be a string");if("function"!=typeof t)throw new Error("Argument handler should be a function");n("[Eventhandling] Adding event listener",e),this._validateEvent(e),this._handlers[e].pushLine truncated
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <http://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
var n=r(19),o=r(20),i=r(21);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),o=(e=a(e,n)).write(t,r);o!==n&&(e=e.slice(0,o));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|d(t.length);return 0===(e=a(e,r)).length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):f(e,t);if("Buffer"===t.type&&i(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(l(t),e=a(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|d(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,o);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,o){var i,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=r;i<a;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*s}else-1!==l&&(i-=i-l),l=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var h=!0,f=0;f<u;f++)if(c(e,i+f)!==c(t,f)){h=!1;break}if(h)return i}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function _(e,t,r,n){return J(B(t,e.length-r),e,r,n)}function w(e,t,r,n){return J(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function P(e,t,r,n){return w(e,t,r,n)}function E(e,t,r,n){return J(q(t),e,r,Line truncated
|
||||
/*!
|
||||
* webfinger.js
|
||||
* version 2.7.0
|
||||
* http://github.com/silverbucket/webfinger.js
|
||||
*
|
||||
* Developed and Maintained by:
|
||||
* Nick Jennings <nick@silverbucket.net> 2012
|
||||
*
|
||||
* webfinger.js is released under the AGPL (see LICENSE).
|
||||
*
|
||||
* You don't have to do anything special to choose one license or the other and you don't
|
||||
* have to notify anyone which license you are using.
|
||||
* Please see the corresponding license file for details of these licenses.
|
||||
* You are free to use, modify and distribute this software, but all copyright
|
||||
* information must remain.
|
||||
*
|
||||
*/"function"!=typeof fetch&&"function"!=typeof XMLHttpRequest&&(XMLHttpRequest=r(26)),function(r){var o={"http://webfist.org/spec/rel":"webfist","http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage","http://tools.ietf.org/id/draft-dejong-remotestorage":"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},i={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},s=["webfinger","host-meta","host-meta.json"];function a(e){return e.toString=function(){return this.message},e}function u(e){"object"!=typeof e&&(e={}),this.config={tls_only:void 0===e.tls_only||e.tls_only,webfist_fallback:void 0!==e.webfist_fallback&&e.webfist_fallback,uri_fallback:void 0!==e.uri_fallback&&e.uri_fallback,request_timeout:void 0!==e.request_timeout?e.request_timeout:1e4}}u.prototype.__fetchJRD=function(e,t,r){if("function"==typeof fetch)return this.__fetchJRD_fetch(e,t,r);if("function"==typeof XMLHttpRequest)return this.__fetchJRD_XHR(e,t,r);throw new Error("add a polyfill for fetch or XMLHttpRequest")},u.prototype.__fetchJRD_fetch=function(e,t,r){var n,o=this;"function"==typeof AbortController&&(n=new AbortController);var i=fetch(e,{headers:{Accept:"application/jrd+json, application/json"},signal:n?n.signal:void 0}).then((function(t){if(t.ok)return t.text();throw 404===t.status?a({message:"resource not found",url:e,status:t.status}):a({message:"error during request",url:e,status:t.status})}),(function(t){throw a({message:"error during request",url:e,status:void 0,err:t})})).then((function(t){if(o.__isValidJSON(t))return t;throw a({message:"invalid json",url:e,status:void 0})})),s=new Promise((function(t,r){setTimeout((function(){r(a({message:"request timed out",url:e,status:void 0})),n&&n.abort()}),o.config.request_timeout)}));Promise.race([i,s]).then((function(e){r(e)})).catch((function(e){t(e)}))},u.prototype.__fetchJRD_XHR=function(e,t,r){var n=this,o=!1,i=new XMLHttpRequest;function s(){if(!o){if(o=!0,200===i.status)return n.__isValidJSON(i.responseText)?r(i.responseText):t(a({message:"invalid json",url:e,status:i.status}));if(404===i.status)return t(a({message:"resource not found",url:e,status:i.status}));if(i.status>=301&&i.status<=302){var s=i.getResponseHeader("Location");return function(e){return"string"==typeof e&&"https"===e.split("://")[0]}(s)?u():t(a({message:"no redirect URL found",url:e,status:i.status}))}return t(a({message:"error during request",url:e,status:i.status}))}}function u(){i.onreadystatechange=function(){4===i.readyState&&s()},i.onload=function(){s()},i.ontimeout=function(){return t(a({message:"request timed out",url:e,status:i.status}))},i.open("GET",e,!0),i.timeout=n.config.request_timeout,i.setRequestHeader("Accept","application/jrd+json, application/json"),i.send()}return u()},u.prototype.__isValidJSON=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},u.prototype.__isLocalhost=function(e){return/^localhost(\.localdomain)?(\:[0-9]+)?$/.test(e)},u.prototype.__processJRD=function(e,t,r,n){var s=JSON.parse(t);if("object"!=typeof s||"object"!=typeof s.links)return void 0!==s.error?r(a({message:s.error,request:e})):r(a({message:"unknown response from server",request:e}));var u=s.links;Array.isArray(u)||(u=[]);var c={object:s,json:t,idx:{}};c.idx.properties={name:void 0},c.idx.links=JSON.parse(JSON.stringify(i)),u.map((function(e,t){if(o.hasOwnProperty(e.rel)&&c.idx.links[o[e.rel]]){var r={};Object.keys(e).map((function(t,n){r[t]=e[t]})),c.idx.links[o[e.rel]].push(r)}}));var l=JSON.parse(t).properties;for(var h in l)l.hasOwnProperty(h)&&"http://packetizer.com/ns/name"===h&&(c.idx.properties.name=l[h]);return n(c)},u.prototype.lookup=function(e,t){if("string"!=typeof e)throw new Error("first parameter must be a user address");if("function"!=typeof t)throw new Error("second parameter must be a callback");var r=this,n="";n=e.indexOf("://")>-1?e.replace(/ /g,"").split("/")[2]:e.replace(/ /g,"").split("@")[1];var o=0,i="https";function a(){var t="";return e.split("://")[1]||(t="acct:"),i+"://"+n+"/.well-known/"+s[o]+"?resource="+t+e}function u(e){if(r.config.uri_fallback&&"webfist.org"!==n&&o!==s.length-1)return o+=1,c();if(!r.config.tls_only&&"https"===i)return o=0,i="http",c();if(!r.config.webfist_fallback||"webfist.org"===n)return t(e);o=0,i="http",n="webfist.org";var u=a();r.__fetchJRD(u,t,(function(e){r.__processJRD(u,e,t,(function(e){"object"==typeof e.idx.links.webfist&&"string"==typeof e.idx.links.webfist[0].href&&r.__fetchJRD(e.idx.links.webfist[0].href,t,(function(e){r.__processJRD(u,e,t,(function(e){return t(null,t)}))}))}))}))}function c(){var e=a();r.__fetchJRD(e,u,(function(n){r.__processJRD(e,n,t,(function(e){t(null,e)}))}))}return(r.__isLocalhost(n)&&(i=
Line truncated
|
||||
//# sourceMappingURL=remotestorage.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["webpack://RemoteStorage/webpack/universalModuleDefinition","webpack://RemoteStorage/webpack/bootstrap","webpack://RemoteStorage/./src/util.js","webpack://RemoteStorage/./src/log.js","webpack://RemoteStorage/./src/eventhandling.js","webpack://RemoteStorage/./src/config.js","webpack://RemoteStorage/./src/authorize.js","webpack://RemoteStorage/./src/baseclient.js","webpack://RemoteStorage/./src/wireclient.js","webpack://RemoteStorage/./src/sync.js","webpack://RemoteStorage/./src/cachinglayer.js","webpack://RemoteStorage/./src/remotestorage.js","webpack://RemoteStorage/(webpack)/buildin/global.js","webpack://RemoteStorage/./src/dropbox.js","webpack://RemoteStorage/./src/env.js","webpack://RemoteStorage/./src/googledrive.js","webpack://RemoteStorage/./src/discover.js","webpack://RemoteStorage/./src/access.js","webpack://RemoteStorage/./src/caching.js","webpack://RemoteStorage/./node_modules/buffer/index.js","webpack://RemoteStorage/./node_modules/base64-js/index.js","webpack://RemoteStorage/./node_modules/ieee754/index.js","webpack://RemoteStorage/./node_modules/isarray/index.js","webpack://RemoteStorage/./node_modules/tv4/tv4.js","webpack://RemoteStorage/./src/types.js","webpack://RemoteStorage/./src/revisioncache.js","webpack://RemoteStorage/./node_modules/webfinger.js/src/webfinger.js","webpack://RemoteStorage/./node_modules/webfinger.js/node_modules/xhr2/lib/browser.js","webpack://RemoteStorage/./src/features.js","webpack://RemoteStorage/./src/syncedgetputdelete.js","webpack://RemoteStorage/./src/indexeddb.js","webpack://RemoteStorage/./src/localstorage.js","webpack://RemoteStorage/./src/inmemorystorage.js","webpack://RemoteStorage/./src/modules.js"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","util","logError","error","console","message","stack","globalContext","window","self","global","getGlobalContext","extend","target","sources","Array","slice","arguments","forEach","source","containingFolder","path","replace","isFolder","substr","isDocument","baseName","parts","split","length","cleanPath","map","encodeURIComponent","join","bindAll","equal","a","b","seen","toString","ArrayBuffer","Uint8Array","seenArg","indexOf","push","deepClone","obj","clone","undefined","fixArrayBuffers","srcObj","dstObj","field","srcArr","isArray","byteLength","Int8Array","set","JSON","parse","stringify","pathsFromRoot","paths","pop","localStorageAvailable","context","localStorage","setItem","removeItem","getJSONFromLocalStorage","getItem","e","shouldBeTreatedAsBinary","content","mimeType","match","test","getTextFromArrayBuffer","arrayBuffer","encoding","Promise","resolve","Blob","buffer","Buffer","blob","BlobBuilder","WebKitBlobBuilder","bb","append","getBlob","fileReader","FileReader","addEventListener","evt","result","onloadend","readAsText","config","require","logging","log","apply","methods","eventName","handler","Error","_validateEvent","_handlers","removeEventListener","hl","splice","_emit","args","_delegateEvent","on","event","_addEvent","off","eventNames","cache","changeEvents","local","remote","conflict","cordovaRedirectUri","backgroundSyncInterval","disableFeatures","discoveryTimeout","isBackground","requestTimeout","syncInterval","extractParams","url","location","Authorize","getLocation","href","hashPos","hash","substring","reduce","params","kvs","kv","stateValue","decodeURIComponent","encodedData","atob","RegExp","onFeaturesLoaded","remoteStorage","authURL","scope","redirectUri","clientId","backend","discoveryData","userAddress","storageApi","properties","btoa","buildOAuthURL","cordova","openWindow","then","authResult","configure","token","access_token","setLocation","IMPLIED_FAKE_TOKEN","Unauthorized","options","code","constructor","document","reject","newWindow","open","closed","handleExit","close","_rs_supported","_rs_init","authParamsUsed","rsDiscovery","remotestorage","connect","state","stopWaitingForToken","_rs_cleanup","eventHandling","tv4","Types","SchemaNotFound","BaseClient","storage","base","makePath","moduleName","onChange","_fireChange","getListing","maxAge","statusCode","body","getAll","keys","calls","all","getFile","data","contentType","revision","storeFile","access","checkPathPermission","warn","put","getObject","storeObject","typeAlias","_attachType","validationResult","validate","valid","exc","remove","getItemURL","connected","_cleanPath","strategy","caching","flush","declareType","alias","uri","schema","_defaultTypeURI","declare","getSchema","validateResult","schemas","configurable","inScope","resolveAlias","origin","fieldNamePrefix","exec","hasLocalStorage","isArrayBufferView","SETTINGS_KEY","STORAGE_APIS","ArrayBufferView","arrayBufferViews","Int16Array","ULine truncated
|
||||
{"version":3,"sources":["webpack://RemoteStorage/webpack/universalModuleDefinition","webpack://RemoteStorage/webpack/bootstrap","webpack://RemoteStorage/./src/util.js","webpack://RemoteStorage/./src/log.js","webpack://RemoteStorage/./src/eventhandling.js","webpack://RemoteStorage/./src/config.js","webpack://RemoteStorage/./src/authorize.js","webpack://RemoteStorage/./src/baseclient.js","webpack://RemoteStorage/./src/wireclient.js","webpack://RemoteStorage/./src/sync.js","webpack://RemoteStorage/./src/cachinglayer.js","webpack://RemoteStorage/./src/remotestorage.js","webpack://RemoteStorage/(webpack)/buildin/global.js","webpack://RemoteStorage/./src/dropbox.js","webpack://RemoteStorage/./src/env.js","webpack://RemoteStorage/./src/googledrive.js","webpack://RemoteStorage/./src/discover.js","webpack://RemoteStorage/./src/access.js","webpack://RemoteStorage/./src/caching.js","webpack://RemoteStorage/./node_modules/buffer/index.js","webpack://RemoteStorage/./node_modules/base64-js/index.js","webpack://RemoteStorage/./node_modules/ieee754/index.js","webpack://RemoteStorage/./node_modules/isarray/index.js","webpack://RemoteStorage/./node_modules/tv4/tv4.js","webpack://RemoteStorage/./src/types.js","webpack://RemoteStorage/./src/revisioncache.js","webpack://RemoteStorage/./node_modules/webfinger.js/src/webfinger.js","webpack://RemoteStorage/./node_modules/webfinger.js/node_modules/xhr2/lib/browser.js","webpack://RemoteStorage/./src/features.js","webpack://RemoteStorage/./src/syncedgetputdelete.js","webpack://RemoteStorage/./src/indexeddb.js","webpack://RemoteStorage/./src/localstorage.js","webpack://RemoteStorage/./src/inmemorystorage.js","webpack://RemoteStorage/./src/modules.js"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","util","logError","error","console","message","stack","globalContext","window","self","global","getGlobalContext","extend","target","sources","Array","slice","arguments","forEach","source","containingFolder","path","replace","isFolder","substr","isDocument","baseName","parts","split","length","cleanPath","map","encodeURIComponent","join","bindAll","equal","a","b","seen","toString","ArrayBuffer","Uint8Array","seenArg","indexOf","push","deepClone","obj","clone","undefined","fixArrayBuffers","srcObj","dstObj","field","srcArr","isArray","byteLength","Int8Array","set","JSON","parse","stringify","pathsFromRoot","paths","pop","localStorageAvailable","context","localStorage","setItem","removeItem","getJSONFromLocalStorage","getItem","e","shouldBeTreatedAsBinary","content","mimeType","match","test","getTextFromArrayBuffer","arrayBuffer","encoding","Promise","resolve","Blob","buffer","Buffer","blob","BlobBuilder","WebKitBlobBuilder","bb","append","getBlob","fileReader","FileReader","addEventListener","evt","result","onloadend","readAsText","config","require","logging","log","apply","methods","eventName","handler","Error","_validateEvent","_handlers","removeEventListener","hl","splice","_emit","args","_delegateEvent","on","event","_addEvent","off","eventNames","cache","changeEvents","local","remote","conflict","cordovaRedirectUri","backgroundSyncInterval","disableFeatures","discoveryTimeout","isBackground","requestTimeout","syncInterval","extractParams","url","hash","location","Authorize","getLocation","href","hashPos","substring","reduce","params","kvs","kv","stateValue","decodeURIComponent","encodedData","atob","RegExp","onFeaturesLoaded","remoteStorage","authURL","scope","redirectUri","clientId","backend","discoveryData","userAddress","storageApi","properties","btoa","buildOAuthURL","cordova","openWindow","then","authResult","configure","token","access_token","setLocation","IMPLIED_FAKE_TOKEN","Unauthorized","options","code","constructor","document","reject","newWindow","open","closed","handleExit","close","_rs_supported","_rs_init","authParamsUsed","rsDiscovery","remotestorage","connect","state","stopWaitingForToken","_rs_cleanup","eventHandling","tv4","Types","SchemaNotFound","BaseClient","storage","base","makePath","moduleName","onChange","_fireChange","getListing","maxAge","statusCode","body","getAll","keys","calls","all","getFile","data","contentType","revision","storeFile","access","checkPathPermission","warn","put","getObject","storeObject","typeAlias","_attachType","validationResult","validate","valid","exc","remove","getItemURL","connected","_cleanPath","strategy","caching","flush","declareType","alias","uri","schema","_defaultTypeURI","declare","getSchema","validateResult","schemas","configurable","inScope","resolveAlias","origin","fieldNamePrefix","exec","hasLocalStorage","isArrayBufferView","SETTINGS_KEY","STORAGE_APIS","ArrayBufferView","arrayBufferViews","Int16Array","ULine truncated
|
||||
Reference in new issue
Block a user