@lingxiteam/assets 0.9.30-alpha.2 → 0.11.30-alpha-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/es/IconSvg/index.js +7 -13
  2. package/es/error/errorCatch/index.js +0 -0
  3. package/es/error/errorDisplay/Mobile/Drawer/Drawer.js +104 -0
  4. package/es/error/errorDisplay/Mobile/Drawer/Drawer.less +177 -0
  5. package/es/error/errorDisplay/Mobile/Drawer/index.js +132 -0
  6. package/es/error/errorDisplay/Mobile/ErrorMsg/index.js +199 -0
  7. package/es/error/errorDisplay/Mobile/Modal/Modal.js +43 -0
  8. package/es/error/errorDisplay/Mobile/Modal/Modal.less +146 -0
  9. package/es/error/errorDisplay/Mobile/Modal/index.js +119 -0
  10. package/es/error/errorDisplay/Mobile/defaultGlobalConfig.js +12 -0
  11. package/es/error/errorDisplay/SVGstring.js +6 -0
  12. package/es/error/errorDisplay/Web/Drawer/Drawer.js +232 -0
  13. package/es/error/errorDisplay/Web/Drawer/Drawer.less +354 -0
  14. package/es/error/errorDisplay/Web/Drawer/DrawerConnect.js +203 -0
  15. package/es/error/errorDisplay/Web/Drawer/index.js +124 -0
  16. package/es/error/errorDisplay/Web/ErrorMsg/index.js +241 -0
  17. package/es/error/errorDisplay/Web/Notification/Notice.js +151 -0
  18. package/es/error/errorDisplay/Web/Notification/Notification.js +129 -0
  19. package/es/error/errorDisplay/Web/Notification/Notification.less +134 -0
  20. package/es/error/errorDisplay/Web/Notification/index.js +84 -0
  21. package/es/error/errorDisplay/Web/defaultGlobalConfig.js +12 -0
  22. package/es/error/errorDisplay/animation.less +112 -0
  23. package/es/error/errorDisplay/compUtils.js +16 -0
  24. package/es/error/errorDisplay/const.js +44 -0
  25. package/es/error/errorDisplay/http.js +103 -0
  26. package/es/error/errorDisplay/variables.less +1 -0
  27. package/es/error/index.js +3 -0
  28. package/es/images/ico-back.png +0 -0
  29. package/es/index.d.ts +2 -1
  30. package/es/index.js +2 -1
  31. package/es/security/encipher/aes.js +2 -4
  32. package/es/security/encipher/des.js +0 -2
  33. package/es/security/encipher/rsa.js +0 -2
  34. package/es/security/encipher/sign.js +25 -48
  35. package/es/security/fetch.js +41 -86
  36. package/es/security/httpEncryption.js +13 -22
  37. package/es/utils/url.js +4 -11
  38. package/lib/index.js +13 -4
  39. package/package.json +2 -2
  40. package/lib/IconSvg/index.d.ts +0 -6
  41. package/lib/IconSvg/index.js +0 -38
  42. package/lib/index.d.ts +0 -4
  43. package/lib/security/const.d.ts +0 -14
  44. package/lib/security/const.js +0 -30
  45. package/lib/security/encipher/aes.d.ts +0 -2
  46. package/lib/security/encipher/aes.js +0 -49
  47. package/lib/security/encipher/des.d.ts +0 -2
  48. package/lib/security/encipher/des.js +0 -48
  49. package/lib/security/encipher/rsa.d.ts +0 -2
  50. package/lib/security/encipher/rsa.js +0 -34
  51. package/lib/security/encipher/sign.d.ts +0 -6
  52. package/lib/security/encipher/sign.js +0 -157
  53. package/lib/security/fetch.d.ts +0 -9
  54. package/lib/security/fetch.js +0 -263
  55. package/lib/security/httpEncryption.js +0 -95
  56. package/lib/security/index.d.ts +0 -26
  57. package/lib/security/index.js +0 -22
  58. package/lib/svg/check.svg +0 -10
  59. package/lib/svg/normal-check.svg +0 -10
  60. package/lib/utils/img.d.ts +0 -1
  61. package/lib/utils/img.js +0 -12
  62. package/lib/utils/url.d.ts +0 -2
  63. package/lib/utils/url.js +0 -49
@@ -1,115 +1,86 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
-
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
-
7
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
-
9
5
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
10
-
11
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
-
13
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
-
15
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
-
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
-
19
12
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
-
21
13
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
-
23
14
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24
-
25
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
26
-
15
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
27
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
-
29
17
  import { createHttpSignStr } from './encipher/sign';
30
18
  import { RSAEncrypt, RSADecrypt } from './encipher/rsa';
31
19
  import { AESEncrypt, AESDecrypt } from './encipher/aes';
32
20
  import { DESEncrypt, DESDecrypt } from './encipher/des';
33
- import { MODE, signKey, aesKey, rsaPublicKey, rsaPrivKey, desKey, securityHeaderKey } from './const'; // import { store } from './store';
34
-
35
- var originFetch = window.fetch; // const debugData = store('debugData');
21
+ import { MODE, signKey, aesKey, rsaPublicKey, rsaPrivKey, desKey, securityHeaderKey } from './const';
22
+ // import { store } from './store';
23
+ var originFetch = window.fetch;
24
+ // const debugData = store('debugData');
36
25
  // (window as any).debugData = debugData;
37
-
38
26
  var LXREQ = {};
39
27
  window.LXREQ = LXREQ;
40
-
41
28
  function encryptedStr(str, type) {
42
29
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
43
-
44
30
  if (type === MODE.AES) {
45
31
  var _config$aesOptions, _config$aesOptions2;
46
-
47
32
  return AESEncrypt(str, ((_config$aesOptions = config.aesOptions) === null || _config$aesOptions === void 0 ? void 0 : _config$aesOptions.key) || aesKey, (_config$aesOptions2 = config.aesOptions) === null || _config$aesOptions2 === void 0 ? void 0 : _config$aesOptions2.encrypt);
48
33
  } else if (type === MODE.RSA) {
49
34
  var _config$rsaOptions, _config$rsaOptions2;
50
-
51
35
  return RSAEncrypt(str, ((_config$rsaOptions = config.rsaOptions) === null || _config$rsaOptions === void 0 ? void 0 : _config$rsaOptions.publicKey) || rsaPublicKey, (_config$rsaOptions2 = config.rsaOptions) === null || _config$rsaOptions2 === void 0 ? void 0 : _config$rsaOptions2.encrypt);
52
36
  } else if (type === MODE.DES) {
53
37
  var _config$desOptions, _config$desOptions2;
54
-
55
38
  return DESEncrypt(str, ((_config$desOptions = config.desOptions) === null || _config$desOptions === void 0 ? void 0 : _config$desOptions.key) || desKey, (_config$desOptions2 = config.desOptions) === null || _config$desOptions2 === void 0 ? void 0 : _config$desOptions2.encrypt);
56
39
  }
57
-
58
40
  return str;
59
41
  }
60
-
61
42
  function decryptedStr(str, type) {
62
43
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
63
-
64
44
  if (type === MODE.AES) {
65
45
  var _config$aesOptions3, _config$aesOptions4;
66
-
67
46
  return AESDecrypt(str, ((_config$aesOptions3 = config.aesOptions) === null || _config$aesOptions3 === void 0 ? void 0 : _config$aesOptions3.key) || aesKey, (_config$aesOptions4 = config.aesOptions) === null || _config$aesOptions4 === void 0 ? void 0 : _config$aesOptions4.decrypt);
68
47
  } else if (type === MODE.RSA) {
69
48
  var _config$rsaOptions3, _config$rsaOptions4;
70
-
71
49
  return RSADecrypt(str, ((_config$rsaOptions3 = config.rsaOptions) === null || _config$rsaOptions3 === void 0 ? void 0 : _config$rsaOptions3.privKey) || rsaPrivKey, (_config$rsaOptions4 = config.rsaOptions) === null || _config$rsaOptions4 === void 0 ? void 0 : _config$rsaOptions4.decrypt) || '';
72
50
  } else if (type === MODE.DES) {
73
51
  var _config$desOptions3, _config$desOptions4;
74
-
75
52
  return DESDecrypt(str, ((_config$desOptions3 = config.desOptions) === null || _config$desOptions3 === void 0 ? void 0 : _config$desOptions3.key) || desKey, (_config$desOptions4 = config.desOptions) === null || _config$desOptions4 === void 0 ? void 0 : _config$desOptions4.decrypt);
76
53
  }
77
-
78
54
  return str;
79
- } // 统一请求参数加密
80
-
81
-
55
+ }
56
+ // 统一请求参数加密
82
57
  function encrypted(url, opts, type) {
83
58
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
84
59
  var reqId = arguments.length > 4 ? arguments[4] : undefined;
85
60
  var isFormData = opts.body instanceof FormData;
86
61
  var headerReqId = reqId ? {
87
62
  'LX-REQ-ID': "LXREQ.".concat(reqId)
88
- } : {}; // search 部分加密
89
-
63
+ } : {};
64
+ // search 部分加密
90
65
  var encryptedUrl = url.indexOf('?') !== -1 ? url.replace(/(?!\?)([^?])+$/g, function (search) {
91
66
  var params = search.split('&').map(function (param) {
92
67
  var _param$split = param.split('='),
93
- _param$split2 = _slicedToArray(_param$split, 2),
94
- k = _param$split2[0],
95
- v = _param$split2[1];
96
-
68
+ _param$split2 = _slicedToArray(_param$split, 2),
69
+ k = _param$split2[0],
70
+ v = _param$split2[1];
97
71
  return "".concat(encodeURIComponent(k), "=").concat(encodeURIComponent(encryptedStr(v, type, config)));
98
72
  });
99
73
  return params.join('&');
100
- }) : url; // body参数加密
101
-
74
+ }) : url;
75
+ // body参数加密
102
76
  var encryptedOpts = Object.assign({}, opts);
103
77
  encryptedOpts.headers = _objectSpread(_objectSpread(_objectSpread({}, opts.headers), headerReqId), {}, _defineProperty({}, securityHeaderKey, type));
104
-
105
78
  if (isFormData) {
106
79
  // formData 加密
107
80
  var formData = new FormData();
108
81
  var reqBody = opts.body;
109
-
110
82
  var _iterator = _createForOfIteratorHelper(reqBody.keys()),
111
- _step;
112
-
83
+ _step;
113
84
  try {
114
85
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
115
86
  var key = _step.value;
@@ -121,15 +92,14 @@ function encrypted(url, opts, type) {
121
92
  } finally {
122
93
  _iterator.f();
123
94
  }
124
-
125
95
  encryptedOpts.body = formData;
126
96
  } else if (opts.body) {
127
97
  // 文本加密
128
98
  encryptedOpts.body = encryptedStr(opts.body, type, config);
129
99
  }
130
-
131
100
  return [encryptedUrl, encryptedOpts];
132
- } // 将解密数据
101
+ }
102
+ // 将解密数据
133
103
  // function debugRecords(id: string, value: any) {
134
104
  // // sessionStorage.setItem(id, JSON.stringify(value));
135
105
  // Object.defineProperty(LXREQ, id, {
@@ -139,36 +109,31 @@ function encrypted(url, opts, type) {
139
109
  // },
140
110
  // });
141
111
  // }
142
-
143
-
144
112
  var fetch = function fetch(url) {
145
113
  var fetchOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
146
114
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
147
-
148
115
  var opts = _objectSpread({}, fetchOptions);
149
-
150
116
  var optSecurityHeaderKey = (opts.headers || {})[securityHeaderKey];
151
- var isDebug = (config === null || config === void 0 ? void 0 : config.debug) || window.lxDebug || !!window.localStorage.getItem('lxDebug') || true; // ------ 参数签名(默认) ------
152
-
153
- if ( // 配置开启加密
154
- (config.mode === MODE.SIGN_KEY || config.mode === MODE.SIGN) && (fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.disabledSignKey) !== true || // 请求头开启加密
117
+ var isDebug = (config === null || config === void 0 ? void 0 : config.debug) || window.lxDebug || !!window.localStorage.getItem('lxDebug') || true;
118
+ // ------ 参数签名(默认) ------
119
+ if (
120
+ // 配置开启加密
121
+ (config.mode === MODE.SIGN_KEY || config.mode === MODE.SIGN) && (fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.disabledSignKey) !== true ||
122
+ // 请求头开启加密
155
123
  optSecurityHeaderKey === '1.0') {
156
124
  var _config$signKeyOption;
157
-
158
125
  opts.headers = _objectSpread(_objectSpread({}, opts.headers), {}, _defineProperty({}, (config === null || config === void 0 ? void 0 : (_config$signKeyOption = config.signKeyOptions) === null || _config$signKeyOption === void 0 ? void 0 : _config$signKeyOption.key) || signKey, createHttpSignStr(url, fetchOptions)));
159
126
  return originFetch(url, opts);
160
- } // ------ 参数加密 ------
161
-
162
-
127
+ }
128
+ // ------ 参数加密 ------
163
129
  if ((config.mode === MODE.RSA || config.mode === MODE.AES) && (fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.disabledEncrypted) !== true || optSecurityHeaderKey === '2.0' || optSecurityHeaderKey === '3.0' || optSecurityHeaderKey === '4.0') {
164
130
  // 标记请求ID,用于获取解密数据
165
- var reqId = "XA".concat(+new Date()); // search和body加密
166
-
131
+ var reqId = "XA".concat(+new Date());
132
+ // search和body加密
167
133
  var _encrypted = encrypted(url, opts, config.mode || optSecurityHeaderKey, config, reqId),
168
- _encrypted2 = _slicedToArray(_encrypted, 2),
169
- encryptedUrl = _encrypted2[0],
170
- encryptedOpts = _encrypted2[1];
171
-
134
+ _encrypted2 = _slicedToArray(_encrypted, 2),
135
+ encryptedUrl = _encrypted2[0],
136
+ encryptedOpts = _encrypted2[1];
172
137
  return originFetch(encryptedUrl, encryptedOpts).then( /*#__PURE__*/function () {
173
138
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
174
139
  var securityType, respResult, result, json, blob;
@@ -178,22 +143,18 @@ var fetch = function fetch(url) {
178
143
  case 0:
179
144
  // 响应解密
180
145
  securityType = response.headers.get(securityHeaderKey);
181
-
182
146
  if (!(securityType && response.body)) {
183
147
  _context.next = 22;
184
148
  break;
185
149
  }
186
-
187
150
  _context.next = 4;
188
151
  return response.text();
189
-
190
152
  case 4:
191
153
  respResult = _context.sent;
192
154
  _context.prev = 5;
193
155
  result = decryptedStr(respResult, securityType, config);
194
156
  _context.next = 18;
195
157
  break;
196
-
197
158
  case 9:
198
159
  _context.prev = 9;
199
160
  _context.t0 = _context["catch"](5);
@@ -207,12 +168,12 @@ var fetch = function fetch(url) {
207
168
  status: 400,
208
169
  statusText: String(_context.t0)
209
170
  }));
210
-
211
171
  case 18:
212
172
  // 开启调试模式,记录解密数据
213
- if (isDebug || true) {// debugRecords(reqId, result);
214
- } // 覆盖响应值
215
-
173
+ if (isDebug || true) {
174
+ // debugRecords(reqId, result);
175
+ }
176
+ // 覆盖响应值
216
177
 
217
178
  try {
218
179
  json = JSON.parse(result);
@@ -220,15 +181,12 @@ var fetch = function fetch(url) {
220
181
  json = result;
221
182
  console.warn("reqId: ".concat(reqId, " \u8F6C\u6362JSON\u5931\u8D25, \u5185\u5BB9\u4E3A"), result);
222
183
  }
223
-
224
184
  blob = new Blob([JSON.stringify(json, null, 2)], {
225
185
  type: 'application/json'
226
186
  });
227
187
  return _context.abrupt("return", new Response(blob));
228
-
229
188
  case 22:
230
189
  return _context.abrupt("return", response);
231
-
232
190
  case 23:
233
191
  case "end":
234
192
  return _context.stop();
@@ -236,15 +194,12 @@ var fetch = function fetch(url) {
236
194
  }
237
195
  }, _callee, null, [[5, 9]]);
238
196
  }));
239
-
240
- return function (_x) {
197
+ return function (_x2) {
241
198
  return _ref.apply(this, arguments);
242
199
  };
243
200
  }());
244
- } // 其他
245
-
246
-
201
+ }
202
+ // 其他
247
203
  return originFetch(url, opts);
248
204
  };
249
-
250
205
  export default fetch;
@@ -1,42 +1,39 @@
1
1
  /* eslint-disable no-console */
2
-
3
2
  /*
4
3
  * @Author: 张国永 zhang.guoyong2@iwhalecloud.com
5
4
  * @Date: 2022-08-08 15:08:58
6
5
  * @Description: 一个简单的http请求安全加密处理
7
6
  */
7
+
8
8
  // TODO 支持XMLHttpRequest拦截、参数混淆、响应拦截
9
+
9
10
  // 使用方式1: 使用fetch请求模块,start({ mode: signKey }),适应经过封装的fetch模块
10
11
  // 使用方式2: 使用fetch请求模块,将window.fetch 替换成 fetch,适应自己封装的fetch模块
11
12
  // 使用方式3: 不使用fetch请求模块,使用createHttpSignStr自己获取签名,自行在header上添加参数
12
- import { createHttpSignStr } from './encipher/sign'; // eslint-disable-next-line import/no-named-as-default, import/no-named-as-default-member
13
13
 
14
+ import { createHttpSignStr } from './encipher/sign';
15
+ // eslint-disable-next-line import/no-named-as-default, import/no-named-as-default-member
14
16
  import fetch from './fetch';
15
17
  var isHttpEncryption = false;
16
18
  var originFetch = window.fetch;
17
-
18
19
  function start(_ref) {
19
20
  var _ref$mode = _ref.mode,
20
- mode = _ref$mode === void 0 ? '1.0' : _ref$mode,
21
- _ref$signKeyOptions = _ref.signKeyOptions,
22
- signKeyOptions = _ref$signKeyOptions === void 0 ? {} : _ref$signKeyOptions,
23
- _ref$aesOptions = _ref.aesOptions,
24
- aesOptions = _ref$aesOptions === void 0 ? {} : _ref$aesOptions,
25
- _ref$desOptions = _ref.desOptions,
26
- desOptions = _ref$desOptions === void 0 ? {} : _ref$desOptions,
27
- _ref$rsaOptions = _ref.rsaOptions,
28
- rsaOptions = _ref$rsaOptions === void 0 ? {} : _ref$rsaOptions;
29
-
21
+ mode = _ref$mode === void 0 ? '1.0' : _ref$mode,
22
+ _ref$signKeyOptions = _ref.signKeyOptions,
23
+ signKeyOptions = _ref$signKeyOptions === void 0 ? {} : _ref$signKeyOptions,
24
+ _ref$aesOptions = _ref.aesOptions,
25
+ aesOptions = _ref$aesOptions === void 0 ? {} : _ref$aesOptions,
26
+ _ref$desOptions = _ref.desOptions,
27
+ desOptions = _ref$desOptions === void 0 ? {} : _ref$desOptions,
28
+ _ref$rsaOptions = _ref.rsaOptions,
29
+ rsaOptions = _ref$rsaOptions === void 0 ? {} : _ref$rsaOptions;
30
30
  if (!mode) {
31
31
  console.error('http加密开启失败,缺少mode参数');
32
32
  return false;
33
33
  }
34
-
35
34
  if (isHttpEncryption) return true;
36
-
37
35
  switch (mode) {
38
36
  case 'signKey': // 兼容旧数据
39
-
40
37
  case '1.0':
41
38
  case '2.0':
42
39
  case '3.0':
@@ -44,7 +41,6 @@ function start(_ref) {
44
41
  {
45
42
  if (typeof window.fetch === 'function') {
46
43
  isHttpEncryption = true;
47
-
48
44
  window.fetch = function (url) {
49
45
  var fetchOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
50
46
  return fetch(url, fetchOptions, {
@@ -58,23 +54,18 @@ function start(_ref) {
58
54
  } else {
59
55
  console.error('http加密开启失败,目前仅支持window.fetch方式');
60
56
  }
61
-
62
57
  break;
63
58
  }
64
-
65
59
  default:
66
60
  console.error("http\u52A0\u5BC6\u5F00\u542F\u5931\u8D25\uFF0C\u4E0D\u652F\u6301".concat(mode, "\u6A21\u5F0F"));
67
61
  break;
68
62
  }
69
-
70
63
  return isHttpEncryption;
71
64
  }
72
-
73
65
  function stop() {
74
66
  isHttpEncryption = false;
75
67
  window.fetch = originFetch;
76
68
  }
77
-
78
69
  export default {
79
70
  start: start,
80
71
  stop: stop,
package/es/utils/url.js CHANGED
@@ -1,15 +1,9 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
7
  export var obj2QueryString = function obj2QueryString(params) {
14
8
  var queryString = Object.keys(params).map(function (key) {
15
9
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(params[key]));
@@ -25,10 +19,9 @@ export var getSearchObj = function getSearchObj() {
25
19
  var obj = {};
26
20
  objs.forEach(function (value) {
27
21
  var _value$split = value.split('='),
28
- _value$split2 = _slicedToArray(_value$split, 2),
29
- k = _value$split2[0],
30
- v = _value$split2[1];
31
-
22
+ _value$split2 = _slicedToArray(_value$split, 2),
23
+ k = _value$split2[0],
24
+ v = _value$split2[1];
32
25
  if (v) {
33
26
  obj[decodeURIComponent(k)] = decodeURIComponent(v);
34
27
  }
package/lib/index.js CHANGED
@@ -3,20 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "ErrorMsg", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _error.ErrorMsg;
10
+ }
11
+ });
6
12
  exports.IconNormalCheckSvg = exports.IconCheckSvg = void 0;
13
+ Object.defineProperty(exports, "MobileErrorMsg", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _error.MobileErrorMsg;
17
+ }
18
+ });
7
19
  Object.defineProperty(exports, "security", {
8
20
  enumerable: true,
9
21
  get: function get() {
10
22
  return _security.default;
11
23
  }
12
24
  });
13
-
14
25
  var _img = require("./utils/img");
15
-
16
26
  var _security = _interopRequireDefault(require("./security"));
17
-
27
+ var _error = require("./error");
18
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
29
  var IconCheckSvg = (0, _img.getSvgImageBase64)("<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"22px\" height=\"22px\" viewBox=\"0 0 22 22\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>\u5168\u5C40\u6837\u5F0F:20/\u539F\u5B50\u7EA7\u63A7\u4EF6/\u590D\u9009/\u72B6\u6001:#\u9009\u4E2D</title><g id=\"\u63A7\u4EF6\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"system-complete\"><path d=\"M11,0 C17.075904,0 22,4.92409598 22,11 C22,17.075904 17.0734732,22 11,22 C4.92652679,22 0,17.0734732 0,11 C0,4.92652679 4.92409598,0 11,0 Z\" id=\"Shape\" fill=\"#1890FF\"></path><path d=\"M9.42871875,12.9681652 L7.2069029,10.7463493 C6.90006126,10.4395077 6.40257267,10.4395077 6.09573103,10.7463493 C5.78889035,11.05319 5.78889035,11.550677 6.09573103,11.8575177 C6.09573161,11.8575183 6.0957322,11.8575189 6.09573278,11.8575195 L8.72212536,14.4838955 C9.11265701,14.8744045 9.74581424,14.874407 10.136349,14.483901 L10.5404063,14.0798527 L10.5404063,14.0798527 L16.2813591,8.33795955 C16.588183,8.03108543 16.5881626,7.53359119 16.2813136,7.22674219 C15.974472,6.91990055 15.4769834,6.91990055 15.1701417,7.22674219 L9.42871875,12.9681652 L9.42871875,12.9681652 Z\" id=\"Path\" fill=\"#FFFFFF\"></path></g></g></svg>");
21
30
  exports.IconCheckSvg = IconCheckSvg;
22
31
  var IconNormalCheckSvg = (0, _img.getSvgImageBase64)("<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"22px\" height=\"22px\" viewBox=\"0 0 22 22\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>\u5168\u5C40\u6837\u5F0F:20/\u539F\u5B50\u7EA7\u63A7\u4EF6/\u590D\u9009/\u72B6\u6001:\u672A\u9009\u4E2D</title><g id=\"\u63A7\u4EF6\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"\u5143\u7D20/\u9009\u62E9/\u672A\u9009\u4E2D\"><path d=\"M11,22 C4.93492502,22 0,17.0653546 0,10.999496 C0,4.9337633 4.93492502,0 11,0 C17.065075,0 22,4.93464539 22,10.999496 C22,17.0644725 17.0660846,22 11,22\" id=\"Fill\" fill=\"#FFFFFF\"></path><path d=\"M11,0.5 C13.8998633,0.5 16.5248731,1.67505184 18.4249106,3.57508938 C20.3249482,5.47512693 21.5,8.10013672 21.5,11 C21.5,13.8995696 20.3245821,16.5243277 18.4245965,18.4243132 C16.5242275,20.3246822 13.8989967,21.5 11,21.5 C8.10129687,21.5 5.47631792,20.324316 3.57600094,18.4239991 C1.67568396,16.5236821 0.5,13.8987031 0.5,11 C0.5,8.10100334 1.67531776,5.47577251 3.57568679,3.57540349 C5.47567234,1.67541793 8.10043037,0.5 11,0.5 Z\" id=\"Shape\" stroke=\"#CCCCCC\"></path></g></g></svg>");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/assets",
3
- "version": "0.9.30-alpha.2",
3
+ "version": "0.11.30-alpha-2",
4
4
  "description": "灵犀低代码平台移动端 - 工具类",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -9,7 +9,7 @@
9
9
  "authors": [],
10
10
  "files": [
11
11
  "es",
12
- "lib",
12
+ "dist",
13
13
  "*.md"
14
14
  ],
15
15
  "publishConfig": {
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface SvgIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
3
- src: string;
4
- }
5
- declare const IconSvg: React.FC<SvgIconProps>;
6
- export default IconSvg;
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _jsxRuntime = require("react/jsx-runtime");
9
-
10
- var _img = require("../utils/img");
11
-
12
- var _excluded = ["style", "src"];
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
-
18
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
-
20
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
-
22
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
23
-
24
- var IconSvg = function IconSvg(props) {
25
- var _props$style = props.style,
26
- style = _props$style === void 0 ? {} : _props$style,
27
- src = props.src,
28
- restProps = _objectWithoutProperties(props, _excluded);
29
-
30
- return (0, _jsxRuntime.jsx)("i", _objectSpread(_objectSpread({}, restProps), {}, {
31
- style: _objectSpread(_objectSpread({}, restProps), {}, {
32
- backgroundImage: (0, _img.getSvgImageBase64)(src)
33
- })
34
- }));
35
- };
36
-
37
- var _default = IconSvg;
38
- exports.default = _default;
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import security from './security';
2
- export declare const IconCheckSvg: string;
3
- export declare const IconNormalCheckSvg: string;
4
- export { security };
@@ -1,14 +0,0 @@
1
- export declare const securityHeaderKey = "XA-TYPE";
2
- export declare const defaultSignKey = "X-SIGN";
3
- export declare const MODE: {
4
- SIGN_KEY: string;
5
- SIGN: string;
6
- RSA: string;
7
- AES: string;
8
- DES: string;
9
- };
10
- export declare const signKey: string;
11
- export declare const rsaPublicKey: string | undefined;
12
- export declare const rsaPrivKey: string | undefined;
13
- export declare const aesKey: string;
14
- export declare const desKey: string;
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.signKey = exports.securityHeaderKey = exports.rsaPublicKey = exports.rsaPrivKey = exports.desKey = exports.defaultSignKey = exports.aesKey = exports.MODE = void 0;
7
- var defaultAESKey = 'd86d7bab3d6ac01a';
8
- var defaultDESKey = '91THRABY';
9
- var securityHeaderKey = 'XA-TYPE';
10
- exports.securityHeaderKey = securityHeaderKey;
11
- var defaultSignKey = 'X-SIGN';
12
- exports.defaultSignKey = defaultSignKey;
13
- var MODE = {
14
- SIGN_KEY: 'signKey',
15
- SIGN: '1.0',
16
- RSA: '2.0',
17
- AES: '3.0',
18
- DES: '4.0'
19
- };
20
- exports.MODE = MODE;
21
- var signKey = process.env.LINGXI_HTTP_SIGN_HEADER_KEY || process.env.REACT_APP_HTTP_SIGN_HEADER_KEY || process.env.UMI_APP_HTTP_SIGN_HEADER_KEY || process.env.FISHX_APP_HTTP_SIGN_HEADER_KEY || defaultSignKey;
22
- exports.signKey = signKey;
23
- var rsaPublicKey = process.env.LINGXI_HTTP_RSA_PUBLIC_KEY || process.env.REACT_APP_HTTP_RSA_PUBLIC_KEY || process.env.UMI_APP_HTTP_RSA_PUBLIC_KEY || process.env.FISHX_APP_HTTP_RSA_PUBLIC_KEY;
24
- exports.rsaPublicKey = rsaPublicKey;
25
- var rsaPrivKey = process.env.LINGXI_HTTP_RSA_PRIV_KEY || process.env.REACT_APP_HTTP_RSA_PRIV_KEY || process.env.UMI_APP_HTTP_RSA_PRIV_KEY || process.env.FISHX_APP_HTTP_RSA_PRIV_KEY;
26
- exports.rsaPrivKey = rsaPrivKey;
27
- var aesKey = process.env.LINGXI_HTTP_AES_KEY || process.env.REACT_APP_HTTP_AES_KEY || process.env.UMI_APP_HTTP_AES_KEY || process.env.FISHX_APP_HTTP_AES_KEY || defaultAESKey;
28
- exports.aesKey = aesKey;
29
- var desKey = process.env.LINGXI_HTTP_DES_KEY || process.env.REACT_APP_HTTP_DES_KEY || process.env.UMI_APP_HTTP_DES_KEY || process.env.FISHX_APP_HTTP_DES_KEY || defaultDESKey;
30
- exports.desKey = desKey;
@@ -1,2 +0,0 @@
1
- export declare const AESEncrypt: (value: any, aesKey: string, handle?: any) => any;
2
- export declare const AESDecrypt: (value: string, aesKey: string, handle?: any) => any;