w-web-api 1.0.0

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 (78) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +54 -0
  4. package/.jsdoc +25 -0
  5. package/LICENSE +21 -0
  6. package/README.md +62 -0
  7. package/SECURITY.md +5 -0
  8. package/babel.config.js +14 -0
  9. package/dist/w-web-api.umd.js +7 -0
  10. package/dist/w-web-api.umd.js.map +1 -0
  11. package/docs/WWebApi.html +551 -0
  12. package/docs/WWebApi.mjs.html +335 -0
  13. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  14. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  15. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  16. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  17. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  18. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  19. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  20. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  21. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  22. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  23. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  24. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  25. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  26. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  27. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  28. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  29. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  30. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  31. package/docs/index.html +81 -0
  32. package/docs/scripts/collapse.js +20 -0
  33. package/docs/scripts/linenumber.js +25 -0
  34. package/docs/scripts/nav.js +12 -0
  35. package/docs/scripts/polyfill.js +4 -0
  36. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  37. package/docs/scripts/prettify/lang-css.js +2 -0
  38. package/docs/scripts/prettify/prettify.js +28 -0
  39. package/docs/scripts/search.js +83 -0
  40. package/docs/styles/jsdoc.css +765 -0
  41. package/docs/styles/prettify.css +79 -0
  42. package/package.json +81 -0
  43. package/public/connecting.svg +10 -0
  44. package/public/deny.png +0 -0
  45. package/public/disconnect.png +0 -0
  46. package/public/index.html +23 -0
  47. package/public/logout.png +0 -0
  48. package/server/WWebApi.mjs +283 -0
  49. package/server/getSettings.mjs +17 -0
  50. package/server/mDb.mjs +76 -0
  51. package/server/mInitialTestData.mjs +40 -0
  52. package/server/mOrm.mjs +22 -0
  53. package/src/App.vue +91 -0
  54. package/src/components/Layout.vue +131 -0
  55. package/src/components/LayoutContent.vue +67 -0
  56. package/src/components/LayoutContentList.vue +573 -0
  57. package/src/components/MdPanel.vue +152 -0
  58. package/src/main.js +98 -0
  59. package/src/plugins/mDataSelectorSchema.mjs +30 -0
  60. package/src/plugins/mDataSupport.mjs +78 -0
  61. package/src/plugins/mShare.mjs +235 -0
  62. package/src/plugins/mUI.mjs +141 -0
  63. package/src/plugins/mVuetify.mjs +12 -0
  64. package/src/schema/gi.mjs +8 -0
  65. package/src/schema/index.mjs +16 -0
  66. package/src/schema/tables/apis.mjs +918 -0
  67. package/src/store/actions.mjs +1 -0
  68. package/src/store/getters.mjs +1 -0
  69. package/src/store/index.mjs +25 -0
  70. package/src/store/mutations.mjs +185 -0
  71. package/src/store/types.mjs +14 -0
  72. package/srv.mjs +33 -0
  73. package/tableTags.json +1 -0
  74. package/toolg/addVersion.mjs +4 -0
  75. package/toolg/cleanFolder.mjs +4 -0
  76. package/toolg/gDistRollup.mjs +34 -0
  77. package/toolg/modifyReadme.mjs +4 -0
  78. package/vue.config.js +15 -0
@@ -0,0 +1,918 @@
1
+ import map from 'lodash/map'
2
+ import keys from 'lodash/keys'
3
+ import get from 'lodash/get'
4
+ import genID from 'wsemi/src/genID.mjs'
5
+ import dtmapping from 'wsemi/src/dtmapping.mjs'
6
+ import dtpick from 'wsemi/src/dtpick.mjs'
7
+ import nowms2str from 'wsemi/src/nowms2str.mjs'
8
+ import now2strp from 'wsemi/src/now2strp.mjs'
9
+ import isestr from 'wsemi/src/isestr'
10
+
11
+
12
+ let keyTable = 'apis'
13
+ let tableNameCht = 'APIs'
14
+ let tableNameEng = 'APIs'
15
+
16
+ let settings = {
17
+ 'id': {
18
+ pk: true,
19
+ name: '主鍵',
20
+ type: 'STRING',
21
+ },
22
+ 'order': {
23
+ name: '順序',
24
+ type: 'INTEGER',
25
+ },
26
+ 'name': {
27
+ name: '名稱',
28
+ type: 'STRING',
29
+ },
30
+ 'description': {
31
+ name: '說明',
32
+ type: 'TEXT',
33
+ },
34
+ 'url': {
35
+ name: '網址',
36
+ type: 'STRING',
37
+ },
38
+ 'method': {
39
+ name: '方法',
40
+ type: 'STRING',
41
+ },
42
+ 'version': {
43
+ name: '版本',
44
+ type: 'STRING',
45
+ },
46
+ 'levels': { //階層群組用英文句點「.」分隔
47
+ name: '階層群組',
48
+ type: 'STRING',
49
+ },
50
+ 'keywords': {
51
+ name: '關鍵字',
52
+ type: 'STRING',
53
+ },
54
+ 'state': {
55
+ name: '狀態',
56
+ type: 'STRING',
57
+ },
58
+ 'creator': {
59
+ name: '創建者',
60
+ type: 'STRING',
61
+ },
62
+ 'dataSource': {
63
+ name: '資料提供者',
64
+ type: 'STRING',
65
+ },
66
+ 'tokens': { //多金鑰用分號分隔
67
+ name: '金鑰',
68
+ type: 'TEXT',
69
+ },
70
+ 'mdInputParams': {
71
+ name: '輸入參數md說明',
72
+ type: 'STRING',
73
+ },
74
+ 'inputExample': {
75
+ name: '輸入範例',
76
+ type: 'STRING',
77
+ },
78
+ 'mdOutputParams': {
79
+ name: '輸出資料md說明',
80
+ type: 'STRING',
81
+ },
82
+ 'outputExample': {
83
+ name: '輸出範例',
84
+ type: 'STRING',
85
+ },
86
+ 'timeCreate': {
87
+ name: '創建時間',
88
+ type: 'STRING',
89
+ },
90
+ 'timeUpdate': {
91
+ name: '更新時間',
92
+ type: 'STRING',
93
+ },
94
+ 'isActive': {
95
+ name: '是否有效',
96
+ type: 'STRING',
97
+ },
98
+ }
99
+
100
+ let funNew = (ndata = {}) => {
101
+ let o = dtmapping(ndata, keys(settings))
102
+ o.id = `${now2strp()}-${genID()}`
103
+ o.timeCreate = nowms2str()
104
+ o.timeUpdate = o.timeCreate
105
+ o.isActive = 'y'
106
+ return o
107
+ }
108
+
109
+ let funTest = () => {
110
+ let rs = map([
111
+ {
112
+ 'id': 'id-for-apis-sys-1',
113
+ 'name': '取得API清單',
114
+ 'description': 'API管理中心取得API清單資訊',
115
+ 'url': 'http://localhost:11005/getAPIsList',
116
+ 'method': 'get',
117
+ 'version': 'v1',
118
+ 'levels': 'API',
119
+ 'keywords': 'API;center',
120
+ 'state': 'ok',
121
+ 'creator': 'apis-system',
122
+ 'dataSource': 'apis-data',
123
+ 'mdInputParams': `### GET網址參數
124
+ | 參數 | 型別 | 範例 |
125
+ | -- | -- | -- |
126
+ | token | STRING | key-for-token |
127
+ | id | STRING | id-for-test |
128
+ | paramA | INTEGER | 123 |
129
+ | paramB | DOUBLE | 123.456 |
130
+ `,
131
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
132
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
133
+ | 參數 | 型別 | 範例 |
134
+ | -- | -- | -- |
135
+ | id | STRING | id-for-test |
136
+ | weight | DOUBLE | 12.3 |
137
+ | color | STRING | #f26 |
138
+ | paramA | INTEGER | 321 |
139
+ | paramB | DOUBLE | 654.321 |
140
+ `,
141
+ 'outputExample': `
142
+ [
143
+ {
144
+ "id": "id-for-test-1",
145
+ "weight": 12.3,
146
+ "color": "#f26",
147
+ "paramA": 101,
148
+ "paramB": 0.01
149
+ },
150
+ {
151
+ "id": "id-for-test-2",
152
+ "weight": 22.3,
153
+ "color": "#2f6",
154
+ "paramA": 102,
155
+ "paramB": 1.01
156
+ },
157
+ {
158
+ "id": "id-for-test-3",
159
+ "weight": 32.3,
160
+ "color": "#26f",
161
+ "paramA": 103,
162
+ "paramB": 2.01
163
+ }
164
+ ]
165
+ `,
166
+ },
167
+ {
168
+ 'id': 'id-for-apis-pets-1',
169
+ 'name': '取得寵物清單',
170
+ 'description': '寵物管理中心取得寵物清單資訊',
171
+ 'url': 'http://localhost:11005/getPetsList',
172
+ 'method': 'get',
173
+ 'version': 'v1',
174
+ 'levels': '寵物',
175
+ 'keywords': 'pets',
176
+ 'state': 'ok',
177
+ 'creator': 'pets-system',
178
+ 'dataSource': 'pets-data',
179
+ 'mdInputParams': `### GET網址參數
180
+ | 參數 | 型別 | 範例 |
181
+ | -- | -- | -- |
182
+ | token | STRING | key-for-token |
183
+ | id | STRING | id-for-test |
184
+ | paramA | INTEGER | 123 |
185
+ | paramB | DOUBLE | 123.456 |
186
+ `,
187
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
188
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
189
+ | 參數 | 型別 | 範例 |
190
+ | -- | -- | -- |
191
+ | id | STRING | id-for-test |
192
+ | weight | DOUBLE | 12.3 |
193
+ | color | STRING | #f26 |
194
+ | paramA | INTEGER | 321 |
195
+ | paramB | DOUBLE | 654.321 |
196
+ `,
197
+ 'outputExample': `
198
+ [
199
+ {
200
+ "id": "id-for-test-1",
201
+ "weight": 12.3,
202
+ "color": "#f26",
203
+ "paramA": 101,
204
+ "paramB": 0.01
205
+ },
206
+ {
207
+ "id": "id-for-test-2",
208
+ "weight": 22.3,
209
+ "color": "#2f6",
210
+ "paramA": 102,
211
+ "paramB": 1.01
212
+ },
213
+ {
214
+ "id": "id-for-test-3",
215
+ "weight": 32.3,
216
+ "color": "#26f",
217
+ "paramA": 103,
218
+ "paramB": 2.01
219
+ }
220
+ ]
221
+ `,
222
+ },
223
+ {
224
+ 'id': 'id-for-apis-pets-dogs-1',
225
+ 'name': '取得狗狗清單',
226
+ 'description': '取得狗狗清單資訊',
227
+ 'url': 'http://localhost:11005/getDogsList',
228
+ 'method': 'get',
229
+ 'version': 'v1',
230
+ 'levels': '寵物.狗狗',
231
+ 'keywords': 'pets;dogs',
232
+ 'state': 'ok',
233
+ 'creator': 'pets-system',
234
+ 'dataSource': 'pets-data',
235
+ 'mdInputParams': `### GET網址參數
236
+ | 參數 | 型別 | 範例 |
237
+ | -- | -- | -- |
238
+ | token | STRING | key-for-token |
239
+ | id | STRING | id-for-test |
240
+ | paramA | INTEGER | 123 |
241
+ | paramB | DOUBLE | 123.456 |
242
+ `,
243
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
244
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
245
+ | 參數 | 型別 | 範例 |
246
+ | -- | -- | -- |
247
+ | id | STRING | id-for-test |
248
+ | weight | DOUBLE | 12.3 |
249
+ | color | STRING | #f26 |
250
+ | paramA | INTEGER | 321 |
251
+ | paramB | DOUBLE | 654.321 |
252
+ `,
253
+ 'outputExample': `
254
+ [
255
+ {
256
+ "id": "id-for-test-1",
257
+ "weight": 12.3,
258
+ "color": "#f26",
259
+ "paramA": 101,
260
+ "paramB": 0.01
261
+ },
262
+ {
263
+ "id": "id-for-test-2",
264
+ "weight": 22.3,
265
+ "color": "#2f6",
266
+ "paramA": 102,
267
+ "paramB": 1.01
268
+ },
269
+ {
270
+ "id": "id-for-test-3",
271
+ "weight": 32.3,
272
+ "color": "#26f",
273
+ "paramA": 103,
274
+ "paramB": 2.01
275
+ }
276
+ ]
277
+ `,
278
+ },
279
+ {
280
+ 'id': 'id-for-apis-pets-dogs-2',
281
+ 'name': '新增狗狗資訊',
282
+ 'description': '新增狗狗資訊',
283
+ 'url': 'http://localhost:11005/addDog',
284
+ 'method': 'post',
285
+ 'version': 'v1',
286
+ 'levels': '寵物.狗狗',
287
+ 'keywords': 'pets;dogs',
288
+ 'state': 'ok',
289
+ 'creator': 'pets-system',
290
+ 'dataSource': 'pets-data',
291
+ 'mdInputParams': `### POST參數
292
+ | 參數 | 型別 | 範例 |
293
+ | -- | -- | -- |
294
+ | token | STRING | key-for-token |
295
+ | id | STRING | id-for-test |
296
+ | paramA | INTEGER | 123 |
297
+ | paramB | DOUBLE | 123.456 |
298
+ `,
299
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
300
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
301
+ | 參數 | 型別 | 範例 |
302
+ | -- | -- | -- |
303
+ | id | STRING | id-for-test |
304
+ | weight | DOUBLE | 12.3 |
305
+ | color | STRING | #f26 |
306
+ | paramA | INTEGER | 321 |
307
+ | paramB | DOUBLE | 654.321 |
308
+ `,
309
+ 'outputExample': `
310
+ [
311
+ {
312
+ "id": "id-for-test-1",
313
+ "weight": 12.3,
314
+ "color": "#f26",
315
+ "paramA": 101,
316
+ "paramB": 0.01
317
+ },
318
+ {
319
+ "id": "id-for-test-2",
320
+ "weight": 22.3,
321
+ "color": "#2f6",
322
+ "paramA": 102,
323
+ "paramB": 1.01
324
+ },
325
+ {
326
+ "id": "id-for-test-3",
327
+ "weight": 32.3,
328
+ "color": "#26f",
329
+ "paramA": 103,
330
+ "paramB": 2.01
331
+ }
332
+ ]
333
+ `,
334
+ },
335
+ {
336
+ 'id': 'id-for-apis-pets-dogs-3',
337
+ 'name': '變更狗狗資訊',
338
+ 'description': '變更狗狗資訊',
339
+ 'url': 'http://localhost:11005/updateDog',
340
+ 'method': 'put',
341
+ 'version': 'v1',
342
+ 'levels': '寵物.狗狗',
343
+ 'keywords': 'pets;dogs',
344
+ 'state': 'ok',
345
+ 'creator': 'pets-system',
346
+ 'dataSource': 'pets-data',
347
+ 'mdInputParams': `### GET網址參數
348
+ | 參數 | 型別 | 範例 |
349
+ | -- | -- | -- |
350
+ | token | STRING | key-for-token |
351
+ | id | STRING | id-for-test |
352
+ | paramA | INTEGER | 123 |
353
+ | paramB | DOUBLE | 123.456 |
354
+ `,
355
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
356
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
357
+ | 參數 | 型別 | 範例 |
358
+ | -- | -- | -- |
359
+ | id | STRING | id-for-test |
360
+ | weight | DOUBLE | 12.3 |
361
+ | color | STRING | #f26 |
362
+ | paramA | INTEGER | 321 |
363
+ | paramB | DOUBLE | 654.321 |
364
+ `,
365
+ 'outputExample': `
366
+ [
367
+ {
368
+ "id": "id-for-test-1",
369
+ "weight": 12.3,
370
+ "color": "#f26",
371
+ "paramA": 101,
372
+ "paramB": 0.01
373
+ },
374
+ {
375
+ "id": "id-for-test-2",
376
+ "weight": 22.3,
377
+ "color": "#2f6",
378
+ "paramA": 102,
379
+ "paramB": 1.01
380
+ },
381
+ {
382
+ "id": "id-for-test-3",
383
+ "weight": 32.3,
384
+ "color": "#26f",
385
+ "paramA": 103,
386
+ "paramB": 2.01
387
+ }
388
+ ]
389
+ `,
390
+ },
391
+ {
392
+ 'id': 'id-for-apis-pets-dogs-4',
393
+ 'name': '刪除狗狗資訊',
394
+ 'description': '刪除狗狗資訊',
395
+ 'url': 'http://localhost:11005/deleteDog',
396
+ 'method': 'del',
397
+ 'version': 'v1',
398
+ 'levels': '寵物.狗狗',
399
+ 'keywords': 'pets;dogs',
400
+ 'state': 'ok',
401
+ 'creator': 'pets-system',
402
+ 'dataSource': 'pets-data',
403
+ 'mdInputParams': `### GET網址參數
404
+ | 參數 | 型別 | 範例 |
405
+ | -- | -- | -- |
406
+ | token | STRING | key-for-token |
407
+ | id | STRING | id-for-test |
408
+ | paramA | INTEGER | 123 |
409
+ | paramB | DOUBLE | 123.456 |
410
+ `,
411
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
412
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
413
+ | 參數 | 型別 | 範例 |
414
+ | -- | -- | -- |
415
+ | id | STRING | id-for-test |
416
+ | weight | DOUBLE | 12.3 |
417
+ | color | STRING | #f26 |
418
+ | paramA | INTEGER | 321 |
419
+ | paramB | DOUBLE | 654.321 |
420
+ `,
421
+ 'outputExample': `
422
+ [
423
+ {
424
+ "id": "id-for-test-1",
425
+ "weight": 12.3,
426
+ "color": "#f26",
427
+ "paramA": 101,
428
+ "paramB": 0.01
429
+ },
430
+ {
431
+ "id": "id-for-test-2",
432
+ "weight": 22.3,
433
+ "color": "#2f6",
434
+ "paramA": 102,
435
+ "paramB": 1.01
436
+ },
437
+ {
438
+ "id": "id-for-test-3",
439
+ "weight": 32.3,
440
+ "color": "#26f",
441
+ "paramA": 103,
442
+ "paramB": 2.01
443
+ }
444
+ ]
445
+ `,
446
+ },
447
+ {
448
+ 'id': 'id-for-apis-pets-cats-1',
449
+ 'name': '取得貓咪清單',
450
+ 'description': '取得貓咪清單資訊',
451
+ 'url': 'http://localhost:11005/getCatsList',
452
+ 'method': 'get',
453
+ 'version': 'v1',
454
+ 'levels': '寵物.貓咪',
455
+ 'keywords': 'pets;cats',
456
+ 'state': 'ok',
457
+ 'creator': 'pets-system',
458
+ 'dataSource': 'pets-data',
459
+ 'mdInputParams': `### GET網址參數
460
+ | 參數 | 型別 | 範例 |
461
+ | -- | -- | -- |
462
+ | token | STRING | key-for-token |
463
+ | id | STRING | id-for-test |
464
+ | paramA | INTEGER | 123 |
465
+ | paramB | DOUBLE | 123.456 |
466
+ `,
467
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
468
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
469
+ | 參數 | 型別 | 範例 |
470
+ | -- | -- | -- |
471
+ | id | STRING | id-for-test |
472
+ | weight | DOUBLE | 12.3 |
473
+ | color | STRING | #f26 |
474
+ | paramA | INTEGER | 321 |
475
+ | paramB | DOUBLE | 654.321 |
476
+ `,
477
+ 'outputExample': `
478
+ [
479
+ {
480
+ "id": "id-for-test-1",
481
+ "weight": 12.3,
482
+ "color": "#f26",
483
+ "paramA": 101,
484
+ "paramB": 0.01
485
+ },
486
+ {
487
+ "id": "id-for-test-2",
488
+ "weight": 22.3,
489
+ "color": "#2f6",
490
+ "paramA": 102,
491
+ "paramB": 1.01
492
+ },
493
+ {
494
+ "id": "id-for-test-3",
495
+ "weight": 32.3,
496
+ "color": "#26f",
497
+ "paramA": 103,
498
+ "paramB": 2.01
499
+ }
500
+ ]
501
+ `,
502
+ },
503
+ {
504
+ 'id': 'id-for-apis-pets-cats-2',
505
+ 'name': '新增貓咪資訊',
506
+ 'description': '新增貓咪資訊',
507
+ 'url': 'http://localhost:11005/addCat',
508
+ 'method': 'post',
509
+ 'version': 'v1',
510
+ 'levels': '寵物.貓咪',
511
+ 'keywords': 'pets;cats',
512
+ 'state': 'ok',
513
+ 'creator': 'pets-system',
514
+ 'dataSource': 'pets-data',
515
+ 'mdInputParams': `### POST參數
516
+ | 參數 | 型別 | 範例 |
517
+ | -- | -- | -- |
518
+ | token | STRING | key-for-token |
519
+ | id | STRING | id-for-test |
520
+ | paramA | INTEGER | 123 |
521
+ | paramB | DOUBLE | 123.456 |
522
+ `,
523
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
524
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
525
+ | 參數 | 型別 | 範例 |
526
+ | -- | -- | -- |
527
+ | id | STRING | id-for-test |
528
+ | weight | DOUBLE | 12.3 |
529
+ | color | STRING | #f26 |
530
+ | paramA | INTEGER | 321 |
531
+ | paramB | DOUBLE | 654.321 |
532
+ `,
533
+ 'outputExample': `
534
+ [
535
+ {
536
+ "id": "id-for-test-1",
537
+ "weight": 12.3,
538
+ "color": "#f26",
539
+ "paramA": 101,
540
+ "paramB": 0.01
541
+ },
542
+ {
543
+ "id": "id-for-test-2",
544
+ "weight": 22.3,
545
+ "color": "#2f6",
546
+ "paramA": 102,
547
+ "paramB": 1.01
548
+ },
549
+ {
550
+ "id": "id-for-test-3",
551
+ "weight": 32.3,
552
+ "color": "#26f",
553
+ "paramA": 103,
554
+ "paramB": 2.01
555
+ }
556
+ ]
557
+ `,
558
+ },
559
+ {
560
+ 'id': 'id-for-apis-pets-cats-3',
561
+ 'name': '變更貓咪資訊',
562
+ 'description': '變更貓咪資訊',
563
+ 'url': 'http://localhost:11005/updateCat',
564
+ 'method': 'put',
565
+ 'version': 'v1',
566
+ 'levels': '寵物.貓咪',
567
+ 'keywords': 'pets;cats',
568
+ 'state': 'ok',
569
+ 'creator': 'pets-system',
570
+ 'dataSource': 'pets-data',
571
+ 'mdInputParams': `### GET網址參數
572
+ | 參數 | 型別 | 範例 |
573
+ | -- | -- | -- |
574
+ | token | STRING | key-for-token |
575
+ | id | STRING | id-for-test |
576
+ | paramA | INTEGER | 123 |
577
+ | paramB | DOUBLE | 123.456 |
578
+ `,
579
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
580
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
581
+ | 參數 | 型別 | 範例 |
582
+ | -- | -- | -- |
583
+ | id | STRING | id-for-test |
584
+ | weight | DOUBLE | 12.3 |
585
+ | color | STRING | #f26 |
586
+ | paramA | INTEGER | 321 |
587
+ | paramB | DOUBLE | 654.321 |
588
+ `,
589
+ 'outputExample': `
590
+ [
591
+ {
592
+ "id": "id-for-test-1",
593
+ "weight": 12.3,
594
+ "color": "#f26",
595
+ "paramA": 101,
596
+ "paramB": 0.01
597
+ },
598
+ {
599
+ "id": "id-for-test-2",
600
+ "weight": 22.3,
601
+ "color": "#2f6",
602
+ "paramA": 102,
603
+ "paramB": 1.01
604
+ },
605
+ {
606
+ "id": "id-for-test-3",
607
+ "weight": 32.3,
608
+ "color": "#26f",
609
+ "paramA": 103,
610
+ "paramB": 2.01
611
+ }
612
+ ]
613
+ `,
614
+ },
615
+ {
616
+ 'id': 'id-for-apis-pets-cats-4',
617
+ 'name': '刪除貓咪資訊',
618
+ 'description': '刪除貓咪資訊',
619
+ 'url': 'http://localhost:11005/deleteCat',
620
+ 'method': 'del',
621
+ 'version': 'v1',
622
+ 'levels': '寵物.貓咪',
623
+ 'keywords': 'pets;cats',
624
+ 'state': 'ok',
625
+ 'creator': 'pets-system',
626
+ 'dataSource': 'pets-data',
627
+ 'mdInputParams': `### GET網址參數
628
+ | 參數 | 型別 | 範例 |
629
+ | -- | -- | -- |
630
+ | token | STRING | key-for-token |
631
+ | id | STRING | id-for-test |
632
+ | paramA | INTEGER | 123 |
633
+ | paramB | DOUBLE | 123.456 |
634
+ `,
635
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
636
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
637
+ | 參數 | 型別 | 範例 |
638
+ | -- | -- | -- |
639
+ | id | STRING | id-for-test |
640
+ | weight | DOUBLE | 12.3 |
641
+ | color | STRING | #f26 |
642
+ | paramA | INTEGER | 321 |
643
+ | paramB | DOUBLE | 654.321 |
644
+ `,
645
+ 'outputExample': `
646
+ [
647
+ {
648
+ "id": "id-for-test-1",
649
+ "weight": 12.3,
650
+ "color": "#f26",
651
+ "paramA": 101,
652
+ "paramB": 0.01
653
+ },
654
+ {
655
+ "id": "id-for-test-2",
656
+ "weight": 22.3,
657
+ "color": "#2f6",
658
+ "paramA": 102,
659
+ "paramB": 1.01
660
+ },
661
+ {
662
+ "id": "id-for-test-3",
663
+ "weight": 32.3,
664
+ "color": "#26f",
665
+ "paramA": 103,
666
+ "paramB": 2.01
667
+ }
668
+ ]
669
+ `,
670
+ },
671
+ {
672
+ 'id': 'id-for-apis-vehicles-cars-1',
673
+ 'name': '取得汽車清單',
674
+ 'description': '取得汽車清單資訊',
675
+ 'url': 'http://localhost:11005/getcarsList',
676
+ 'method': 'get',
677
+ 'version': 'v1',
678
+ 'levels': '交通工具.汽車',
679
+ 'keywords': 'vehicles;cars',
680
+ 'state': 'ok',
681
+ 'creator': 'vehicles-system',
682
+ 'dataSource': 'vehicles-data',
683
+ 'mdInputParams': `### GET網址參數
684
+ | 參數 | 型別 | 範例 |
685
+ | -- | -- | -- |
686
+ | token | STRING | key-for-token |
687
+ | id | STRING | id-for-test |
688
+ | paramA | INTEGER | 123 |
689
+ | paramB | DOUBLE | 123.456 |
690
+ `,
691
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
692
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
693
+ | 參數 | 型別 | 範例 |
694
+ | -- | -- | -- |
695
+ | id | STRING | id-for-test |
696
+ | weight | DOUBLE | 12.3 |
697
+ | color | STRING | #f26 |
698
+ | paramA | INTEGER | 321 |
699
+ | paramB | DOUBLE | 654.321 |
700
+ `,
701
+ 'outputExample': `
702
+ [
703
+ {
704
+ "id": "id-for-test-1",
705
+ "weight": 12.3,
706
+ "color": "#f26",
707
+ "paramA": 101,
708
+ "paramB": 0.01
709
+ },
710
+ {
711
+ "id": "id-for-test-2",
712
+ "weight": 22.3,
713
+ "color": "#2f6",
714
+ "paramA": 102,
715
+ "paramB": 1.01
716
+ },
717
+ {
718
+ "id": "id-for-test-3",
719
+ "weight": 32.3,
720
+ "color": "#26f",
721
+ "paramA": 103,
722
+ "paramB": 2.01
723
+ }
724
+ ]
725
+ `,
726
+ },
727
+ {
728
+ 'id': 'id-for-apis-vehicles-cars-2',
729
+ 'name': '新增汽車資訊',
730
+ 'description': '新增汽車資訊',
731
+ 'url': 'http://localhost:11005/addDog',
732
+ 'method': 'post',
733
+ 'version': 'v1',
734
+ 'levels': '交通工具.汽車',
735
+ 'keywords': 'vehicles;cars',
736
+ 'state': 'ok',
737
+ 'creator': 'vehicles-system',
738
+ 'dataSource': 'vehicles-data',
739
+ 'mdInputParams': `### POST參數
740
+ | 參數 | 型別 | 範例 |
741
+ | -- | -- | -- |
742
+ | token | STRING | key-for-token |
743
+ | id | STRING | id-for-test |
744
+ | paramA | INTEGER | 123 |
745
+ | paramB | DOUBLE | 123.456 |
746
+ `,
747
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
748
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
749
+ | 參數 | 型別 | 範例 |
750
+ | -- | -- | -- |
751
+ | id | STRING | id-for-test |
752
+ | weight | DOUBLE | 12.3 |
753
+ | color | STRING | #f26 |
754
+ | paramA | INTEGER | 321 |
755
+ | paramB | DOUBLE | 654.321 |
756
+ `,
757
+ 'outputExample': `
758
+ [
759
+ {
760
+ "id": "id-for-test-1",
761
+ "weight": 12.3,
762
+ "color": "#f26",
763
+ "paramA": 101,
764
+ "paramB": 0.01
765
+ },
766
+ {
767
+ "id": "id-for-test-2",
768
+ "weight": 22.3,
769
+ "color": "#2f6",
770
+ "paramA": 102,
771
+ "paramB": 1.01
772
+ },
773
+ {
774
+ "id": "id-for-test-3",
775
+ "weight": 32.3,
776
+ "color": "#26f",
777
+ "paramA": 103,
778
+ "paramB": 2.01
779
+ }
780
+ ]
781
+ `,
782
+ },
783
+ {
784
+ 'id': 'id-for-apis-vehicles-cars-3',
785
+ 'name': '變更汽車資訊',
786
+ 'description': '變更汽車資訊',
787
+ 'url': 'http://localhost:11005/updateDog',
788
+ 'method': 'put',
789
+ 'version': 'v1',
790
+ 'levels': '交通工具.汽車',
791
+ 'keywords': 'vehicles;cars',
792
+ 'state': 'ok',
793
+ 'creator': 'vehicles-system',
794
+ 'dataSource': 'vehicles-data',
795
+ 'mdInputParams': `### GET網址參數
796
+ | 參數 | 型別 | 範例 |
797
+ | -- | -- | -- |
798
+ | token | STRING | key-for-token |
799
+ | id | STRING | id-for-test |
800
+ | paramA | INTEGER | 123 |
801
+ | paramB | DOUBLE | 123.456 |
802
+ `,
803
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
804
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
805
+ | 參數 | 型別 | 範例 |
806
+ | -- | -- | -- |
807
+ | id | STRING | id-for-test |
808
+ | weight | DOUBLE | 12.3 |
809
+ | color | STRING | #f26 |
810
+ | paramA | INTEGER | 321 |
811
+ | paramB | DOUBLE | 654.321 |
812
+ `,
813
+ 'outputExample': `
814
+ [
815
+ {
816
+ "id": "id-for-test-1",
817
+ "weight": 12.3,
818
+ "color": "#f26",
819
+ "paramA": 101,
820
+ "paramB": 0.01
821
+ },
822
+ {
823
+ "id": "id-for-test-2",
824
+ "weight": 22.3,
825
+ "color": "#2f6",
826
+ "paramA": 102,
827
+ "paramB": 1.01
828
+ },
829
+ {
830
+ "id": "id-for-test-3",
831
+ "weight": 32.3,
832
+ "color": "#26f",
833
+ "paramA": 103,
834
+ "paramB": 2.01
835
+ }
836
+ ]
837
+ `,
838
+ },
839
+ {
840
+ 'id': 'id-for-apis-vehicles-cars-4',
841
+ 'name': '刪除汽車資訊',
842
+ 'description': '刪除汽車資訊',
843
+ 'url': 'http://localhost:11005/deleteDog',
844
+ 'method': 'del',
845
+ 'version': 'v1',
846
+ 'levels': '交通工具.汽車',
847
+ 'keywords': 'vehicles;cars',
848
+ 'state': 'ok',
849
+ 'creator': 'vehicles-system',
850
+ 'dataSource': 'vehicles-data',
851
+ 'mdInputParams': `### GET網址參數
852
+ | 參數 | 型別 | 範例 |
853
+ | -- | -- | -- |
854
+ | token | STRING | key-for-token |
855
+ | id | STRING | id-for-test |
856
+ | paramA | INTEGER | 123 |
857
+ | paramB | DOUBLE | 123.456 |
858
+ `,
859
+ 'inputExample': `http://localhost:11005/getAPIsList?token={token}&id={id}&paramA=123&paramB=123.456`,
860
+ 'mdOutputParams': `### 回傳數據結構: Array of objects
861
+ | 參數 | 型別 | 範例 |
862
+ | -- | -- | -- |
863
+ | id | STRING | id-for-test |
864
+ | weight | DOUBLE | 12.3 |
865
+ | color | STRING | #f26 |
866
+ | paramA | INTEGER | 321 |
867
+ | paramB | DOUBLE | 654.321 |
868
+ `,
869
+ 'outputExample': `
870
+ [
871
+ {
872
+ "id": "id-for-test-1",
873
+ "weight": 12.3,
874
+ "color": "#f26",
875
+ "paramA": 101,
876
+ "paramB": 0.01
877
+ },
878
+ {
879
+ "id": "id-for-test-2",
880
+ "weight": 22.3,
881
+ "color": "#2f6",
882
+ "paramA": 102,
883
+ "paramB": 1.01
884
+ },
885
+ {
886
+ "id": "id-for-test-3",
887
+ "weight": 32.3,
888
+ "color": "#26f",
889
+ "paramA": 103,
890
+ "paramB": 2.01
891
+ }
892
+ ]
893
+ `,
894
+ },
895
+ ], (item, k) => {
896
+ let v = funNew({ ...item, order: k })
897
+ v.id = item.id
898
+ if (isestr(item.timeUpdate)) {
899
+ v.timeUpdate = item.timeUpdate
900
+ }
901
+ v = dtpick(v, keys(settings))
902
+ return v
903
+ })
904
+ console.log(`已產生: {keyTable} 測試資料`, rs)
905
+ return rs
906
+ }
907
+
908
+ let tab = {
909
+ keyTable,
910
+ tableNameCht,
911
+ tableNameEng,
912
+ settings,
913
+ funNew,
914
+ funTest,
915
+ }
916
+
917
+
918
+ export default tab