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.

Files changed (107) hide show
  1. package/README.md +3 -3
  2. package/config/dev.env.js +37 -0
  3. package/config/hap.amend.js +29 -0
  4. package/config/index.js +8 -0
  5. package/config/prod.env.js +28 -0
  6. package/index.d.ts +130 -0
  7. package/index.js +1 -0
  8. package/package.json +44 -3
  9. package/src/index.html +12 -0
  10. package/src/lib/app.js +103 -0
  11. package/src/lib/axios/CHANGELOG.md +245 -0
  12. package/src/lib/axios/LICENSE +19 -0
  13. package/src/lib/axios/README.md +625 -0
  14. package/src/lib/axios/UPGRADE_GUIDE.md +162 -0
  15. package/src/lib/axios/dist/axios.js +1603 -0
  16. package/src/lib/axios/dist/axios.map +1 -0
  17. package/src/lib/axios/dist/axios.min.js +9 -0
  18. package/src/lib/axios/dist/axios.min.map +1 -0
  19. package/src/lib/axios/index.d.ts +131 -0
  20. package/src/lib/axios/index.js +1 -0
  21. package/src/lib/axios/lib/adapters/README.md +37 -0
  22. package/src/lib/axios/lib/adapters/http.js +237 -0
  23. package/src/lib/axios/lib/adapters/xhr.js +180 -0
  24. package/src/lib/axios/lib/axios.js +52 -0
  25. package/src/lib/axios/lib/cancel/Cancel.js +19 -0
  26. package/src/lib/axios/lib/cancel/CancelToken.js +57 -0
  27. package/src/lib/axios/lib/cancel/isCancel.js +5 -0
  28. package/src/lib/axios/lib/core/Axios.js +79 -0
  29. package/src/lib/axios/lib/core/InterceptorManager.js +52 -0
  30. package/src/lib/axios/lib/core/README.md +7 -0
  31. package/src/lib/axios/lib/core/createError.js +18 -0
  32. package/src/lib/axios/lib/core/dispatchRequest.js +86 -0
  33. package/src/lib/axios/lib/core/enhanceError.js +21 -0
  34. package/src/lib/axios/lib/core/settle.js +26 -0
  35. package/src/lib/axios/lib/core/transformData.js +20 -0
  36. package/src/lib/axios/lib/defaults.js +96 -0
  37. package/src/lib/axios/lib/helpers/README.md +7 -0
  38. package/src/lib/axios/lib/helpers/bind.js +11 -0
  39. package/src/lib/axios/lib/helpers/btoa.js +36 -0
  40. package/src/lib/axios/lib/helpers/buildURL.js +66 -0
  41. package/src/lib/axios/lib/helpers/combineURLs.js +14 -0
  42. package/src/lib/axios/lib/helpers/cookies.js +53 -0
  43. package/src/lib/axios/lib/helpers/deprecatedMethod.js +24 -0
  44. package/src/lib/axios/lib/helpers/isAbsoluteURL.js +14 -0
  45. package/src/lib/axios/lib/helpers/isURLSameOrigin.js +68 -0
  46. package/src/lib/axios/lib/helpers/normalizeHeaderName.js +12 -0
  47. package/src/lib/axios/lib/helpers/parseHeaders.js +53 -0
  48. package/src/lib/axios/lib/helpers/spread.js +27 -0
  49. package/src/lib/axios/lib/utils.js +303 -0
  50. package/src/lib/axios/modules/debug/CHANGELOG.md +395 -0
  51. package/src/lib/axios/modules/debug/LICENSE +19 -0
  52. package/src/lib/axios/modules/debug/README.md +437 -0
  53. package/src/lib/axios/modules/debug/dist/debug.js +886 -0
  54. package/src/lib/axios/modules/debug/node.js +1 -0
  55. package/src/lib/axios/modules/debug/package.json +96 -0
  56. package/src/lib/axios/modules/debug/src/browser.js +180 -0
  57. package/src/lib/axios/modules/debug/src/common.js +249 -0
  58. package/src/lib/axios/modules/debug/src/index.js +12 -0
  59. package/src/lib/axios/modules/debug/src/node.js +174 -0
  60. package/src/lib/axios/modules/follow-redirects/LICENSE +18 -0
  61. package/src/lib/axios/modules/follow-redirects/README.md +145 -0
  62. package/src/lib/axios/modules/follow-redirects/http.js +1 -0
  63. package/src/lib/axios/modules/follow-redirects/https.js +1 -0
  64. package/src/lib/axios/modules/follow-redirects/index.js +452 -0
  65. package/src/lib/axios/modules/follow-redirects/package.json +92 -0
  66. package/src/lib/axios/modules/is-buffer/LICENSE +21 -0
  67. package/src/lib/axios/modules/is-buffer/README.md +53 -0
  68. package/src/lib/axios/modules/is-buffer/index.js +21 -0
  69. package/src/lib/axios/modules/is-buffer/package.json +90 -0
  70. package/src/lib/axios/modules/is-buffer/test/basic.js +24 -0
  71. package/src/lib/axios/modules/ms/index.js +162 -0
  72. package/src/lib/axios/modules/ms/license.md +21 -0
  73. package/src/lib/axios/modules/ms/package.json +72 -0
  74. package/src/lib/axios/modules/ms/readme.md +60 -0
  75. package/src/lib/axios/package-lock.json +10437 -0
  76. package/src/lib/axios/package.json +111 -0
  77. package/src/lib/axios.min.js +10 -0
  78. package/src/lib/axiosRequest.js +84 -0
  79. package/src/lib/bmob.js +36 -0
  80. package/src/lib/common.js +227 -0
  81. package/src/lib/config.dev.js +62 -0
  82. package/src/lib/config.js +69 -0
  83. package/src/lib/dataType.js +17 -0
  84. package/src/lib/error.js +32 -0
  85. package/src/lib/file.js +250 -0
  86. package/src/lib/hapRequest.js +68 -0
  87. package/src/lib/hapStorage.js +62 -0
  88. package/src/lib/init.js +0 -0
  89. package/src/lib/nodestorage.js +14 -0
  90. package/src/lib/pay.js +19 -0
  91. package/src/lib/pointer.js +18 -0
  92. package/src/lib/query.js +689 -0
  93. package/src/lib/relation.js +45 -0
  94. package/src/lib/request.js +21 -0
  95. package/src/lib/sms.js +40 -0
  96. package/src/lib/socket.js +292 -0
  97. package/src/lib/storage.js +21 -0
  98. package/src/lib/user.js +225 -0
  99. package/src/lib/utf8md5.js +205 -0
  100. package/src/lib/utils.js +61 -0
  101. package/src/lib/webstorage.js +32 -0
  102. package/src/lib/wxRequest.js +88 -0
  103. package/src/lib/wxstorage.js +27 -0
  104. package/src/main.js +27 -0
  105. package/test/index.html +15 -0
  106. package/test/index.js +12 -0
  107. package/tsconfig.json +100 -0
@@ -0,0 +1,205 @@
1
+ function safeAdd(x, y) {
2
+ var lsw = (x & 0xffff) + (y & 0xffff)
3
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
4
+ return (msw << 16) | (lsw & 0xffff)
5
+ }
6
+
7
+ /*
8
+ * Bitwise rotate a 32-bit number to the left.
9
+ */
10
+ function rol(num, cnt) {
11
+ return (num << cnt) | (num >>> (32 - cnt))
12
+ }
13
+
14
+ /*
15
+ * These functions implement the four basic operations the algorithm uses.
16
+ */
17
+ function cmn(q, a, b, x, s, t) {
18
+ return safeAdd(rol(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)
19
+ }
20
+
21
+ function ff(a, b, c, d, x, s, t) {
22
+ return cmn((b & c) | (~b & d), a, b, x, s, t)
23
+ }
24
+ function gg(a, b, c, d, x, s, t) {
25
+ return cmn((b & d) | (c & ~d), a, b, x, s, t)
26
+ }
27
+ function hh(a, b, c, d, x, s, t) {
28
+ return cmn(b ^ c ^ d, a, b, x, s, t)
29
+ }
30
+ function ii(a, b, c, d, x, s, t) {
31
+ return cmn(c ^ (b | ~d), a, b, x, s, t)
32
+ }
33
+
34
+ /*
35
+ * Calculate the MD5 of an array of little-endian words, producing an array
36
+ * of little-endian words.
37
+ */
38
+ function coreMD5(x) {
39
+ var a = 1732584193
40
+ var b = -271733879
41
+ var c = -1732584194
42
+ var d = 271733878
43
+
44
+ for (var i = 0; i < x.length; i += 16) {
45
+ var olda = a
46
+ var oldb = b
47
+ var oldc = c
48
+ var oldd = d
49
+
50
+ a = ff(a, b, c, d, x[i + 0], 7, -680876936)
51
+ d = ff(d, a, b, c, x[i + 1], 12, -389564586)
52
+ c = ff(c, d, a, b, x[i + 2], 17, 606105819)
53
+ b = ff(b, c, d, a, x[i + 3], 22, -1044525330)
54
+ a = ff(a, b, c, d, x[i + 4], 7, -176418897)
55
+ d = ff(d, a, b, c, x[i + 5], 12, 1200080426)
56
+ c = ff(c, d, a, b, x[i + 6], 17, -1473231341)
57
+ b = ff(b, c, d, a, x[i + 7], 22, -45705983)
58
+ a = ff(a, b, c, d, x[i + 8], 7, 1770035416)
59
+ d = ff(d, a, b, c, x[i + 9], 12, -1958414417)
60
+ c = ff(c, d, a, b, x[i + 10], 17, -42063)
61
+ b = ff(b, c, d, a, x[i + 11], 22, -1990404162)
62
+ a = ff(a, b, c, d, x[i + 12], 7, 1804603682)
63
+ d = ff(d, a, b, c, x[i + 13], 12, -40341101)
64
+ c = ff(c, d, a, b, x[i + 14], 17, -1502002290)
65
+ b = ff(b, c, d, a, x[i + 15], 22, 1236535329)
66
+
67
+ a = gg(a, b, c, d, x[i + 1], 5, -165796510)
68
+ d = gg(d, a, b, c, x[i + 6], 9, -1069501632)
69
+ c = gg(c, d, a, b, x[i + 11], 14, 643717713)
70
+ b = gg(b, c, d, a, x[i + 0], 20, -373897302)
71
+ a = gg(a, b, c, d, x[i + 5], 5, -701558691)
72
+ d = gg(d, a, b, c, x[i + 10], 9, 38016083)
73
+ c = gg(c, d, a, b, x[i + 15], 14, -660478335)
74
+ b = gg(b, c, d, a, x[i + 4], 20, -405537848)
75
+ a = gg(a, b, c, d, x[i + 9], 5, 568446438)
76
+ d = gg(d, a, b, c, x[i + 14], 9, -1019803690)
77
+ c = gg(c, d, a, b, x[i + 3], 14, -187363961)
78
+ b = gg(b, c, d, a, x[i + 8], 20, 1163531501)
79
+ a = gg(a, b, c, d, x[i + 13], 5, -1444681467)
80
+ d = gg(d, a, b, c, x[i + 2], 9, -51403784)
81
+ c = gg(c, d, a, b, x[i + 7], 14, 1735328473)
82
+ b = gg(b, c, d, a, x[i + 12], 20, -1926607734)
83
+
84
+ a = hh(a, b, c, d, x[i + 5], 4, -378558)
85
+ d = hh(d, a, b, c, x[i + 8], 11, -2022574463)
86
+ c = hh(c, d, a, b, x[i + 11], 16, 1839030562)
87
+ b = hh(b, c, d, a, x[i + 14], 23, -35309556)
88
+ a = hh(a, b, c, d, x[i + 1], 4, -1530992060)
89
+ d = hh(d, a, b, c, x[i + 4], 11, 1272893353)
90
+ c = hh(c, d, a, b, x[i + 7], 16, -155497632)
91
+ b = hh(b, c, d, a, x[i + 10], 23, -1094730640)
92
+ a = hh(a, b, c, d, x[i + 13], 4, 681279174)
93
+ d = hh(d, a, b, c, x[i + 0], 11, -358537222)
94
+ c = hh(c, d, a, b, x[i + 3], 16, -722521979)
95
+ b = hh(b, c, d, a, x[i + 6], 23, 76029189)
96
+ a = hh(a, b, c, d, x[i + 9], 4, -640364487)
97
+ d = hh(d, a, b, c, x[i + 12], 11, -421815835)
98
+ c = hh(c, d, a, b, x[i + 15], 16, 530742520)
99
+ b = hh(b, c, d, a, x[i + 2], 23, -995338651)
100
+
101
+ a = ii(a, b, c, d, x[i + 0], 6, -198630844)
102
+ d = ii(d, a, b, c, x[i + 7], 10, 1126891415)
103
+ c = ii(c, d, a, b, x[i + 14], 15, -1416354905)
104
+ b = ii(b, c, d, a, x[i + 5], 21, -57434055)
105
+ a = ii(a, b, c, d, x[i + 12], 6, 1700485571)
106
+ d = ii(d, a, b, c, x[i + 3], 10, -1894986606)
107
+ c = ii(c, d, a, b, x[i + 10], 15, -1051523)
108
+ b = ii(b, c, d, a, x[i + 1], 21, -2054922799)
109
+ a = ii(a, b, c, d, x[i + 8], 6, 1873313359)
110
+ d = ii(d, a, b, c, x[i + 15], 10, -30611744)
111
+ c = ii(c, d, a, b, x[i + 6], 15, -1560198380)
112
+ b = ii(b, c, d, a, x[i + 13], 21, 1309151649)
113
+ a = ii(a, b, c, d, x[i + 4], 6, -145523070)
114
+ d = ii(d, a, b, c, x[i + 11], 10, -1120210379)
115
+ c = ii(c, d, a, b, x[i + 2], 15, 718787259)
116
+ b = ii(b, c, d, a, x[i + 9], 21, -343485551)
117
+
118
+ a = safeAdd(a, olda)
119
+ b = safeAdd(b, oldb)
120
+ c = safeAdd(c, oldc)
121
+ d = safeAdd(d, oldd)
122
+ }
123
+ return [a, b, c, d]
124
+ }
125
+
126
+ /*
127
+ * Convert an array of little-endian words to a hex string.
128
+ */
129
+ function binl2hex(binarray) {
130
+ var hexTab = '0123456789abcdef'
131
+ var str = ''
132
+ for (var i = 0; i < binarray.length * 4; i++) {
133
+ str +=
134
+ hexTab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xf) +
135
+ hexTab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xf)
136
+ }
137
+ return str
138
+ }
139
+
140
+ /*
141
+ * Convert an array of little-endian words to a base64 encoded string.
142
+ */
143
+ // function binl2b64(binarray) {
144
+ // var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
145
+ // var str = ''
146
+ // for (var i = 0; i < binarray.length * 32; i += 6) {
147
+ // str += tab.charAt(
148
+ // ((binarray[i >> 5] << i % 32) & 0x3f) |
149
+ // ((binarray[i >> (5 + 1)] >> (32 - (i % 32))) & 0x3f)
150
+ // )
151
+ // }
152
+ // return str
153
+ // }
154
+
155
+ /*
156
+ * Convert an 8-bit character string to a sequence of 16-word blocks, stored
157
+ * as an array, and append appropriate padding for MD4/5 calculation.
158
+ * If any of the characters are >255, the high byte is silently ignored.
159
+ */
160
+ function str2binl(str) {
161
+ var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks
162
+ var blks = new Array(nblk * 16)
163
+ for (var ir = 0; ir < nblk * 16; ir++) blks[ir] = 0
164
+ for (var i = 0; i < str.length; i++) {
165
+ blks[i >> 2] |= (str.charCodeAt(i) & 0xff) << ((i % 4) * 8)
166
+ }
167
+ blks[i >> 2] |= 0x80 << ((i % 4) * 8)
168
+ blks[nblk * 16 - 2] = str.length * 8
169
+ return blks
170
+ }
171
+
172
+ function stringToUint(s) {
173
+ s = unescape(encodeURIComponent(s))
174
+ var uintArray = []
175
+ for (var i = 0; i < s.length; i++) uintArray.push(s[i].charCodeAt(0))
176
+ return new Uint8Array(uintArray)
177
+ }
178
+
179
+ function buf2binl(buffer) {
180
+ if (typeof buffer === 'string') buffer = stringToUint(buffer)
181
+ var nblk = ((buffer.length + 8) >> 6) + 1 // number of 16-word blocks
182
+ var blks = new Array(nblk * 16)
183
+ for (var ir = 0; ir < nblk * 16; ir++) blks[ir] = 0
184
+ for (var i = 0; i < buffer.length; i++) {
185
+ blks[i >> 2] |= (buffer[i] & 0xff) << ((i % 4) * 8)
186
+ }
187
+ blks[i >> 2] |= 0x80 << ((i % 4) * 8)
188
+ blks[nblk * 16 - 2] = buffer.length * 8
189
+ return blks
190
+ }
191
+
192
+ /*
193
+ * External interface
194
+ */
195
+ function utf8MD5(str) {
196
+ return binl2hex(coreMD5(buf2binl(str)))
197
+ }
198
+ function hexMD5(str) {
199
+ return binl2hex(coreMD5(str2binl(str)))
200
+ }
201
+
202
+ module.exports = {
203
+ hexMD5: hexMD5,
204
+ utf8MD5: utf8MD5
205
+ }
@@ -0,0 +1,61 @@
1
+ /*
2
+ * @Author: your name
3
+ * @Date: 2019-11-12 15:51:09
4
+ * @LastEditTime: 2020-06-17 18:26:11
5
+ * @LastEditors: Please set LastEditors
6
+ * @Description: In User Settings Edit
7
+ * @FilePath: /bmob-js-sdk-es6/src/lib/utils.js
8
+ */
9
+ let config
10
+
11
+ config = require('./config')
12
+
13
+ /**
14
+ * 获取 SDK 配置信息
15
+ * @return {Object}
16
+ */
17
+ const getConfig = (d = false) => {
18
+ if (d === true) {
19
+ config.host = require('./config.dev').host
20
+ }
21
+ return config
22
+ }
23
+
24
+ // 获取SDK类型
25
+ const getAppType = () => {
26
+ const config = getConfig()
27
+ let type
28
+ // 小程序
29
+ if (typeof wx !== 'undefined') {
30
+ type = 'wx'
31
+ }
32
+
33
+ // html5
34
+ if (typeof window !== 'undefined' && typeof type !== 'string') {
35
+ type = 'h5'
36
+ }
37
+
38
+ // node
39
+ if (typeof process !== 'undefined' && typeof type !== 'string') {
40
+ type = 'nodejs'
41
+ }
42
+
43
+ // 快应用
44
+ if (config.type === 3 && typeof type !== 'string') {
45
+ type = 'hap'
46
+ }
47
+
48
+ return type
49
+ }
50
+
51
+ // 生成16位随机字符串
52
+ const randomString = () => {
53
+ let chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
54
+ let nums = ''
55
+ for (let i = 0; i < 16; i++) {
56
+ let id = parseInt(Math.random() * 61)
57
+ nums += chars[id]
58
+ }
59
+ return nums
60
+ }
61
+ module.exports = { randomString, getConfig, getAppType }
@@ -0,0 +1,32 @@
1
+ const { isString } = require('./dataType')
2
+
3
+ let lt
4
+ if (typeof cc !== 'undefined') {
5
+ lt = cc.sys.localStorage
6
+ } else {
7
+ lt = localStorage
8
+ }
9
+ const storage = {
10
+ save (key, value) {
11
+ if (!isString(key) || !value) {
12
+ throw new Error(415)
13
+ }
14
+ lt.setItem(key, JSON.stringify(value))
15
+ },
16
+ fetch (key) {
17
+ if (!isString(key)) {
18
+ throw new Error(415)
19
+ }
20
+ return JSON.parse(lt.getItem(key)) || null
21
+ },
22
+ remove (key) {
23
+ if (!isString(key)) {
24
+ throw new Error(415)
25
+ }
26
+ lt.removeItem(key)
27
+ },
28
+ clear () {
29
+ lt.clear()
30
+ }
31
+ }
32
+ module.exports = storage
@@ -0,0 +1,88 @@
1
+ /*
2
+ * @Author: magic
3
+ * @Date: 2019-03-27 10:02:03
4
+ * @LastEditTime: 2020-06-17 18:26:23
5
+ * @LastEditors: Please set LastEditors
6
+ * @Description: In User Settings Edit
7
+ * @FilePath: /bmob-js-sdk-es6/src/lib/wxRequest.js
8
+ */
9
+ let Bmob = require('./bmob')
10
+ let md5 = require('./utf8md5')
11
+ let sdkType = 'wechatApp'
12
+ if (typeof (tt) !== 'undefined') {
13
+ sdkType = 'toutiao'
14
+ } else if (typeof (qq) !== 'undefined') {
15
+ sdkType = 'qqApp'
16
+ }
17
+
18
+ const setHeader = (config, route, method, parma) => {
19
+ const t = Math.round(new Date().getTime() / 1000)
20
+ const rand = Bmob.utils.randomString()
21
+ let body = (method === 'get' || method === 'delete') ? '' : JSON.stringify(parma)
22
+
23
+ const sign = md5.utf8MD5(route + t + config.securityCode + rand + body + config.serverVersion)
24
+ // const sign = md5.utf8MD5(route + t + config.securityCode + rand)
25
+ let header = {
26
+ 'content-type': 'application/json',
27
+ 'X-Bmob-SDK-Type': sdkType,
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
+ return header
38
+ }
39
+
40
+ const request = (route, method = 'get', parma = {}) => {
41
+ return new Promise((resolve, reject) => {
42
+ const header = setHeader(Bmob._config, route, method, parma)
43
+
44
+ if (undefined === Bmob.User) {
45
+ Bmob = require('./bmob')
46
+ }
47
+ let current = Bmob.User.current()
48
+ if (current) {
49
+ header['X-Bmob-Session-Token'] = current.sessionToken
50
+ }
51
+ if (Bmob._config.deBug === true) {
52
+ console.log('host:', Bmob._config.host)
53
+ console.log('parma:', parma)
54
+ }
55
+
56
+
57
+
58
+ var wxurl = Bmob._config.host + route
59
+ if (undefined!=parma.where){
60
+ if (method == 'get' && sdkType == 'toutiao') {
61
+ parma.where =
62
+ JSON.stringify(parma.where)
63
+ const queryParams = new URLSearchParams(parma);
64
+ wxurl += "?" + queryParams.toString()
65
+ parma = {}
66
+ }
67
+ }
68
+
69
+ wx.request({
70
+ url: wxurl,
71
+ method: method,
72
+ data: parma,
73
+ header: header,
74
+ success: res => {
75
+ if ((res.data.code && res.data.error) || res.data.error) {
76
+ reject(res.data)
77
+ }
78
+ resolve(res.data)
79
+ },
80
+ fail: err => {
81
+ console.log(err)
82
+ reject(err)
83
+ }
84
+ })
85
+ })
86
+ }
87
+
88
+ module.exports = request
@@ -0,0 +1,27 @@
1
+ const { isString, isObject } = require('./dataType')
2
+
3
+ const storage = {
4
+ save (key, value) {
5
+ if (!isString(key) || !value) {
6
+ throw new Error(415)
7
+ }
8
+ value = !isObject(value) ? value : JSON.stringify(value)
9
+ return wx.setStorageSync(key, value)
10
+ },
11
+ fetch (key) {
12
+ if (!isString(key)) {
13
+ throw new Error(415)
14
+ }
15
+ return wx.getStorageSync(key) || null
16
+ },
17
+ remove (key) {
18
+ if (!isString(key)) {
19
+ throw new Error(415)
20
+ }
21
+ return wx.removeStorageSync(key)
22
+ },
23
+ clear () {
24
+ return wx.clearStorageSync()
25
+ }
26
+ }
27
+ module.exports = storage
package/src/main.js ADDED
@@ -0,0 +1,27 @@
1
+ /*
2
+ * @Author: your name
3
+ * @Date: 2019-07-02 09:41:29
4
+ * @LastEditTime: 2020-06-17 18:27:04
5
+ * @LastEditors: Please set LastEditors
6
+ * @Description: In User Settings Edit
7
+ * @FilePath: /bmob-js-sdk-es6/src/main.js
8
+ */
9
+ /* eslint-disable */
10
+ var Bmob = require('./lib/app')
11
+ // var Bmob = require('../dist/Bmob-1.7.1.min')
12
+
13
+ // Bmob.initialize('bb20359e8e7eb634fff2c76089ce0d80', '0dcb80eb0cf198b9facccbf3f0b29b89')
14
+ // Bmob.initialize('91cccd44cafd370aa5b89669d993b619', 'd56f4b86e5cd56e84f705b6f530e4806');
15
+ Bmob.initialize('4df53b03a0b3a8ef', '123456');
16
+ // Bmob.initialize('ad1ef6c1eac9b6e7', '123456'); //内网
17
+ // Bmob.debug(true);
18
+
19
+ // const BmobSocketIo = Bmob.Socket()
20
+
21
+ // const query = Bmob.Query('_User')
22
+ // query.equalTo('username','!=','ff')
23
+ // query.find().then(res => {
24
+ // console.log(res)
25
+ // })
26
+
27
+ // let BmobSocketIo = Bmob.Socket(33)
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
+ <title>Document</title>
8
+ </head>
9
+ <body>
10
+ <script src="../dist/Bmob-2.2.1.min.js"></script>
11
+ <script>
12
+ console.log(Bmob)
13
+ </script>
14
+ </body>
15
+ </html>
package/test/index.js ADDED
@@ -0,0 +1,12 @@
1
+ const Bmob = require('../src/lib/app')
2
+ // const Bmob = require('../dist/Bmob-2.2.1.min')
3
+ console.log(Bmob.type)
4
+ Bmob.initialize('ad1ef6c1eac9b6e7', '123456')
5
+
6
+ const query = Bmob.Query('_User')
7
+ query.equalTo('username', '!=', 'ff')
8
+ query.find().then(res => {
9
+ console.log(res)
10
+ }).catch(err => {
11
+ console.log(err)
12
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+
26
+ /* Modules */
27
+ "module": "commonjs", /* Specify what module code is generated. */
28
+ // "rootDir": "./", /* Specify the root folder within your source files. */
29
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
+ // "resolveJsonModule": true, /* Enable importing .json files */
37
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
38
+
39
+ /* JavaScript Support */
40
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43
+
44
+ /* Emit */
45
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
51
+ // "removeComments": true, /* Disable emitting comments. */
52
+ // "noEmit": true, /* Disable emitting files from a compilation. */
53
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
62
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67
+
68
+ /* Interop Constraints */
69
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
70
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
71
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
72
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
73
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
74
+
75
+ /* Type Checking */
76
+ "strict": true, /* Enable all strict type-checking options. */
77
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
78
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
79
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
80
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
81
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
82
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
83
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
84
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
85
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
86
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
87
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
88
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
89
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
90
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
91
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
92
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
93
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
94
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
95
+
96
+ /* Completeness */
97
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
98
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
99
+ }
100
+ }