w-web-api 1.0.10 → 1.0.13
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.
- package/README.md +7 -2
- package/dist/css/{app.c0e1f74a.css → app.5eff8f8a.css} +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.a2249856.js +2 -0
- package/dist/js/app.a2249856.js.map +1 -0
- package/dist/js/{chunk-vendors.8193f50a.js → chunk-vendors.36762e7b.js} +1 -1
- package/dist/js/{chunk-vendors.8193f50a.js.map → chunk-vendors.36762e7b.js.map} +1 -1
- package/dist/w-web-api.umd.js +2 -2
- package/dist/w-web-api.umd.js.map +1 -1
- package/docs/WWebApi.html +2 -2
- package/docs/WWebApi.mjs.html +39 -13
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/server/WWebApi.mjs +38 -12
- package/server/filePathToCode.mjs +9 -0
- package/server/provideApis.mjs +0 -7
- package/src/components/LayoutContentList.vue +23 -3
- package/src/schema/tables/apis.mjs +114 -57
- package/tableTags-web-api.json +1 -1
- package/dist/js/app.6ec60f77.js +0 -2
- package/dist/js/app.6ec60f77.js.map +0 -1
package/docs/WWebApi.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
<dt class="tag-source">Source:</dt>
|
|
73
73
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
74
|
-
<a href="WWebApi.mjs.html">WWebApi.mjs</a>, <a href="WWebApi.mjs.html#
|
|
74
|
+
<a href="WWebApi.mjs.html">WWebApi.mjs</a>, <a href="WWebApi.mjs.html#line68">line 68</a>
|
|
75
75
|
</li></ul></dd>
|
|
76
76
|
|
|
77
77
|
|
|
@@ -604,7 +604,7 @@
|
|
|
604
604
|
<br class="clear">
|
|
605
605
|
|
|
606
606
|
<footer>
|
|
607
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on
|
|
607
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Apr 17 2022 12:12:10 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
608
608
|
</footer>
|
|
609
609
|
|
|
610
610
|
<script>prettyPrint();</script>
|
package/docs/WWebApi.mjs.html
CHANGED
|
@@ -43,16 +43,20 @@
|
|
|
43
43
|
<section>
|
|
44
44
|
<article>
|
|
45
45
|
<pre class="prettyprint source linenums"><code>import get from 'lodash/get'
|
|
46
|
-
import map from 'lodash/map'
|
|
46
|
+
// import map from 'lodash/map'
|
|
47
|
+
import each from 'lodash/each'
|
|
47
48
|
import keys from 'lodash/keys'
|
|
48
|
-
import cloneDeep from 'lodash/cloneDeep'
|
|
49
|
+
// import cloneDeep from 'lodash/cloneDeep'
|
|
49
50
|
import j2o from 'wsemi/src/j2o.mjs'
|
|
50
51
|
import iseobj from 'wsemi/src/iseobj'
|
|
51
52
|
import isestr from 'wsemi/src/isestr'
|
|
52
53
|
import ispint from 'wsemi/src/ispint'
|
|
53
54
|
import isfun from 'wsemi/src/isfun'
|
|
54
|
-
import fsIsFolder from 'wsemi/src/fsIsFolder'
|
|
55
55
|
import cint from 'wsemi/src/cint'
|
|
56
|
+
import strleft from 'wsemi/src/strleft'
|
|
57
|
+
import strdelleft from 'wsemi/src/strdelleft'
|
|
58
|
+
import b642str from 'wsemi/src/b642str'
|
|
59
|
+
import fsIsFolder from 'wsemi/src/fsIsFolder'
|
|
56
60
|
import WServHapiServer from 'w-serv-hapi/src/WServHapiServer.mjs'
|
|
57
61
|
import ds from '../src/schema/index.mjs'
|
|
58
62
|
import WServOrm from 'w-serv-orm/src/WServOrm.mjs'
|
|
@@ -197,12 +201,41 @@ async function WWebApi(WOrm, url, db, opt = {}) {
|
|
|
197
201
|
//parsePayload
|
|
198
202
|
let parsePayload = (req) => {
|
|
199
203
|
let inp = get(req, 'payload')
|
|
204
|
+
|
|
205
|
+
//to obj
|
|
200
206
|
if (isestr(inp)) {
|
|
201
207
|
inp = j2o(inp)
|
|
202
208
|
}
|
|
203
|
-
|
|
209
|
+
|
|
210
|
+
//cv apis for base64
|
|
211
|
+
if (iseobj(inp)) {
|
|
212
|
+
|
|
213
|
+
//spread
|
|
214
|
+
let { levels, apis } = inp
|
|
215
|
+
|
|
216
|
+
//apis
|
|
217
|
+
each(apis, (api, kapi) => {
|
|
218
|
+
// console.log(kapi, api.name)
|
|
219
|
+
each(api, (v, k) => {
|
|
220
|
+
// console.log(k, v)
|
|
221
|
+
if (isestr(v)) {
|
|
222
|
+
if (strleft(v, 7) === 'base64:') {
|
|
223
|
+
v = strdelleft(v, 7)
|
|
224
|
+
v = b642str(v)
|
|
225
|
+
apis[kapi][k] = v
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
//resave
|
|
232
|
+
inp = { levels, apis }
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
204
236
|
inp = null
|
|
205
237
|
}
|
|
238
|
+
|
|
206
239
|
return inp
|
|
207
240
|
}
|
|
208
241
|
|
|
@@ -233,15 +266,8 @@ async function WWebApi(WOrm, url, db, opt = {}) {
|
|
|
233
266
|
//delAll levels
|
|
234
267
|
await woItems.apis.delAll({ levels })
|
|
235
268
|
|
|
236
|
-
//rsApisTemp
|
|
237
|
-
let rsApisTemp = cloneDeep(rsApis)
|
|
238
|
-
rsApisTemp = map(rsApisTemp, (v) => {
|
|
239
|
-
v.levels = levels
|
|
240
|
-
return v
|
|
241
|
-
})
|
|
242
|
-
|
|
243
269
|
//insert
|
|
244
|
-
let r = await woItems.apis.insert(
|
|
270
|
+
let r = await woItems.apis.insert(rsApis)
|
|
245
271
|
|
|
246
272
|
return r
|
|
247
273
|
}
|
|
@@ -377,7 +403,7 @@ export default WWebApi
|
|
|
377
403
|
<br class="clear">
|
|
378
404
|
|
|
379
405
|
<footer>
|
|
380
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on
|
|
406
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Apr 17 2022 12:12:10 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
381
407
|
</footer>
|
|
382
408
|
|
|
383
409
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
<br class="clear">
|
|
69
69
|
|
|
70
70
|
<footer>
|
|
71
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on
|
|
71
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Apr 17 2022 12:12:10 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
72
72
|
</footer>
|
|
73
73
|
|
|
74
74
|
<script>prettyPrint();</script>
|
package/package.json
CHANGED
package/server/WWebApi.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import get from 'lodash/get'
|
|
2
|
-
import map from 'lodash/map'
|
|
2
|
+
// import map from 'lodash/map'
|
|
3
|
+
import each from 'lodash/each'
|
|
3
4
|
import keys from 'lodash/keys'
|
|
4
|
-
import cloneDeep from 'lodash/cloneDeep'
|
|
5
|
+
// import cloneDeep from 'lodash/cloneDeep'
|
|
5
6
|
import j2o from 'wsemi/src/j2o.mjs'
|
|
6
7
|
import iseobj from 'wsemi/src/iseobj'
|
|
7
8
|
import isestr from 'wsemi/src/isestr'
|
|
8
9
|
import ispint from 'wsemi/src/ispint'
|
|
9
10
|
import isfun from 'wsemi/src/isfun'
|
|
10
|
-
import fsIsFolder from 'wsemi/src/fsIsFolder'
|
|
11
11
|
import cint from 'wsemi/src/cint'
|
|
12
|
+
import strleft from 'wsemi/src/strleft'
|
|
13
|
+
import strdelleft from 'wsemi/src/strdelleft'
|
|
14
|
+
import b642str from 'wsemi/src/b642str'
|
|
15
|
+
import fsIsFolder from 'wsemi/src/fsIsFolder'
|
|
12
16
|
import WServHapiServer from 'w-serv-hapi/src/WServHapiServer.mjs'
|
|
13
17
|
import ds from '../src/schema/index.mjs'
|
|
14
18
|
import WServOrm from 'w-serv-orm/src/WServOrm.mjs'
|
|
@@ -153,12 +157,41 @@ async function WWebApi(WOrm, url, db, opt = {}) {
|
|
|
153
157
|
//parsePayload
|
|
154
158
|
let parsePayload = (req) => {
|
|
155
159
|
let inp = get(req, 'payload')
|
|
160
|
+
|
|
161
|
+
//to obj
|
|
156
162
|
if (isestr(inp)) {
|
|
157
163
|
inp = j2o(inp)
|
|
158
164
|
}
|
|
159
|
-
|
|
165
|
+
|
|
166
|
+
//cv apis for base64
|
|
167
|
+
if (iseobj(inp)) {
|
|
168
|
+
|
|
169
|
+
//spread
|
|
170
|
+
let { levels, apis } = inp
|
|
171
|
+
|
|
172
|
+
//apis
|
|
173
|
+
each(apis, (api, kapi) => {
|
|
174
|
+
// console.log(kapi, api.name)
|
|
175
|
+
each(api, (v, k) => {
|
|
176
|
+
// console.log(k, v)
|
|
177
|
+
if (isestr(v)) {
|
|
178
|
+
if (strleft(v, 7) === 'base64:') {
|
|
179
|
+
v = strdelleft(v, 7)
|
|
180
|
+
v = b642str(v)
|
|
181
|
+
apis[kapi][k] = v
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
//resave
|
|
188
|
+
inp = { levels, apis }
|
|
189
|
+
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
160
192
|
inp = null
|
|
161
193
|
}
|
|
194
|
+
|
|
162
195
|
return inp
|
|
163
196
|
}
|
|
164
197
|
|
|
@@ -189,15 +222,8 @@ async function WWebApi(WOrm, url, db, opt = {}) {
|
|
|
189
222
|
//delAll levels
|
|
190
223
|
await woItems.apis.delAll({ levels })
|
|
191
224
|
|
|
192
|
-
//rsApisTemp
|
|
193
|
-
let rsApisTemp = cloneDeep(rsApis)
|
|
194
|
-
rsApisTemp = map(rsApisTemp, (v) => {
|
|
195
|
-
v.levels = levels
|
|
196
|
-
return v
|
|
197
|
-
})
|
|
198
|
-
|
|
199
225
|
//insert
|
|
200
|
-
let r = await woItems.apis.insert(
|
|
226
|
+
let r = await woItems.apis.insert(rsApis)
|
|
201
227
|
|
|
202
228
|
return r
|
|
203
229
|
}
|
package/server/provideApis.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
|
-
import map from 'lodash/map'
|
|
3
2
|
import ltdtpick from 'wsemi/src/ltdtpick.mjs'
|
|
4
3
|
|
|
5
4
|
|
|
@@ -26,12 +25,6 @@ async function provideApis(url, levels, apis) {
|
|
|
26
25
|
//ltdtpick
|
|
27
26
|
apis = ltdtpick(apis, ks)
|
|
28
27
|
|
|
29
|
-
//update levels
|
|
30
|
-
apis = map(apis, (v) => {
|
|
31
|
-
v.levels = levels
|
|
32
|
-
return v
|
|
33
|
-
})
|
|
34
|
-
|
|
35
28
|
//rin
|
|
36
29
|
let rin = {
|
|
37
30
|
levels,
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
<div style="display:flex; height:100%;" v-if="hasApis">
|
|
8
8
|
|
|
9
|
-
<div
|
|
9
|
+
<div
|
|
10
|
+
style="min-width:400px; height:100%; color:#444; background:#fff;"
|
|
11
|
+
v-domresize
|
|
12
|
+
@domresize="resizeTree"
|
|
13
|
+
>
|
|
10
14
|
|
|
11
15
|
<WTree
|
|
12
|
-
:viewHeightMax="
|
|
16
|
+
:viewHeightMax="heightTree"
|
|
13
17
|
:data="apisTree"
|
|
14
18
|
:iconHeight="lineHeightTree"
|
|
15
19
|
:defItemHeight="lineHeightTree"
|
|
@@ -91,7 +95,7 @@
|
|
|
91
95
|
<div class="bk" style="">
|
|
92
96
|
|
|
93
97
|
<div class="bk-title" style="">
|
|
94
|
-
{{$t('tokens')}}
|
|
98
|
+
{{$t('tokens')}}
|
|
95
99
|
</div>
|
|
96
100
|
|
|
97
101
|
<div class="bk-item" style="">
|
|
@@ -356,6 +360,7 @@ export default {
|
|
|
356
360
|
data: function() {
|
|
357
361
|
return {
|
|
358
362
|
|
|
363
|
+
heightTree: 2,
|
|
359
364
|
lineHeightTree: 38,
|
|
360
365
|
|
|
361
366
|
apisTree: [],
|
|
@@ -417,6 +422,20 @@ export default {
|
|
|
417
422
|
},
|
|
418
423
|
methods: {
|
|
419
424
|
|
|
425
|
+
resizeTree: function(msg) {
|
|
426
|
+
// console.log('methods resizeTree', msg)
|
|
427
|
+
|
|
428
|
+
let vo = this
|
|
429
|
+
|
|
430
|
+
//h
|
|
431
|
+
let h = get(msg, 'snew.clientHeight')
|
|
432
|
+
// console.log(h)
|
|
433
|
+
|
|
434
|
+
//update
|
|
435
|
+
vo.heightTree = h
|
|
436
|
+
|
|
437
|
+
},
|
|
438
|
+
|
|
420
439
|
genTree: function () {
|
|
421
440
|
let vo = this
|
|
422
441
|
|
|
@@ -514,6 +533,7 @@ export default {
|
|
|
514
533
|
getOutputJsonObj: function(item) {
|
|
515
534
|
// let vo = this
|
|
516
535
|
let j = this.getOutputJson(item)
|
|
536
|
+
// console.log(j)
|
|
517
537
|
let o = j2o(j)
|
|
518
538
|
return o
|
|
519
539
|
},
|