w-web-api 1.0.11 → 1.0.12

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/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#line64">line 64</a>
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 Fri Apr 15 2022 15:15:12 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
607
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Apr 17 2022 12:09:30 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
608
608
  </footer>
609
609
 
610
610
  <script>prettyPrint();</script>
@@ -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,44 @@ 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
- if (!iseobj(inp)) {
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
+ console.log('b1')
223
+ if (strleft(v, 7) === 'base64:') {
224
+ console.log('b2')
225
+ v = strdelleft(v, 7)
226
+ v = b642str(v)
227
+ console.log('bbb inv base64', v)
228
+ apis[kapi][k] = v
229
+ }
230
+ }
231
+ })
232
+ })
233
+
234
+ //resave
235
+ inp = { levels, apis }
236
+
237
+ }
238
+ else {
204
239
  inp = null
205
240
  }
241
+
206
242
  return inp
207
243
  }
208
244
 
@@ -233,15 +269,8 @@ async function WWebApi(WOrm, url, db, opt = {}) {
233
269
  //delAll levels
234
270
  await woItems.apis.delAll({ levels })
235
271
 
236
- //rsApisTemp
237
- let rsApisTemp = cloneDeep(rsApis)
238
- rsApisTemp = map(rsApisTemp, (v) => {
239
- v.levels = levels
240
- return v
241
- })
242
-
243
272
  //insert
244
- let r = await woItems.apis.insert(rsApisTemp)
273
+ let r = await woItems.apis.insert(rsApis)
245
274
 
246
275
  return r
247
276
  }
@@ -377,7 +406,7 @@ export default WWebApi
377
406
  <br class="clear">
378
407
 
379
408
  <footer>
380
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Fri Apr 15 2022 15:15:12 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
409
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Apr 17 2022 12:09:30 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
381
410
  </footer>
382
411
 
383
412
  <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 Fri Apr 15 2022 15:15:12 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
71
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Apr 17 2022 12:09:30 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/g.getSettings.mjs CHANGED
@@ -7,7 +7,7 @@ function getSettings() {
7
7
  return {
8
8
  'dbUsername': 'username',
9
9
  'dbPassword': 'password',
10
- 'dbName': 'wapis',
10
+ 'dbName': 'rddmanager_api', //wapis
11
11
  'dbIP': 'localhost',
12
12
  'dbPort': 27017,
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-web-api",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "main": "dist/w-web-api.umd.js",
5
5
  "dependencies": {
6
6
  "@mdi/js": "^6.6.96",
@@ -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,44 @@ 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
- if (!iseobj(inp)) {
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
+ console.log('b1')
179
+ if (strleft(v, 7) === 'base64:') {
180
+ console.log('b2')
181
+ v = strdelleft(v, 7)
182
+ v = b642str(v)
183
+ console.log('bbb inv base64', v)
184
+ apis[kapi][k] = v
185
+ }
186
+ }
187
+ })
188
+ })
189
+
190
+ //resave
191
+ inp = { levels, apis }
192
+
193
+ }
194
+ else {
160
195
  inp = null
161
196
  }
197
+
162
198
  return inp
163
199
  }
164
200
 
@@ -189,15 +225,8 @@ async function WWebApi(WOrm, url, db, opt = {}) {
189
225
  //delAll levels
190
226
  await woItems.apis.delAll({ levels })
191
227
 
192
- //rsApisTemp
193
- let rsApisTemp = cloneDeep(rsApis)
194
- rsApisTemp = map(rsApisTemp, (v) => {
195
- v.levels = levels
196
- return v
197
- })
198
-
199
228
  //insert
200
- let r = await woItems.apis.insert(rsApisTemp)
229
+ let r = await woItems.apis.insert(rsApis)
201
230
 
202
231
  return r
203
232
  }
@@ -0,0 +1,9 @@
1
+ function filePathToCode(c) {
2
+ if (c.indexOf('\\\\') >= 0) {
3
+ return '```' + c + '```'
4
+ }
5
+ return c
6
+ }
7
+
8
+
9
+ export default filePathToCode
@@ -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 style="min-width:400px; height:100%; _font-size:10pt; color:#444; background:#fff; overflow-y:auto;">
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="null"
16
+ :viewHeightMax="heightTree"
13
17
  :data="apisTree"
14
18
  :iconHeight="lineHeightTree"
15
19
  :defItemHeight="lineHeightTree"
@@ -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
  },