w-web-api 1.0.34 → 1.0.35
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/.github/workflows/ci-test.yml +1 -1
- package/.vscode/launch.json +1 -4
- package/README.md +0 -1
- package/babel.config.js +4 -3
- package/dist/css/app.99a58617.css +1 -0
- package/dist/index.tmp +1 -1
- package/dist/js/app-legacy.c7d8a968.js +2 -0
- package/dist/js/app-legacy.c7d8a968.js.map +1 -0
- package/dist/js/app.c7d8a968.js +2 -0
- package/dist/js/app.c7d8a968.js.map +1 -0
- package/dist/js/chunk-vendors-legacy.6340603a.js +14 -0
- package/dist/js/chunk-vendors-legacy.6340603a.js.map +1 -0
- package/dist/js/chunk-vendors.6340603a.js +14 -0
- package/dist/js/chunk-vendors.6340603a.js.map +1 -0
- package/dist/w-web-api.umd.js +2 -2
- package/dist/w-web-api.umd.js.map +1 -1
- package/docs/WWebApi.html +5 -5
- package/docs/WWebApi.mjs.html +29 -22
- package/docs/index.html +1 -1
- package/g.backupDb.mjs +1 -1
- package/g.initialTestData.mjs +2 -1
- package/g.mOrm.mjs +2 -2
- package/package.json +9 -9
- package/script.txt +5 -5
- package/server/WWebApi.mjs +28 -21
- package/src/components/Layout.vue +14 -6
- package/src/components/LayoutContent.vue +9 -7
- package/src/main.js +1 -1
- package/src/schema/gi.mjs +1 -1
- package/srv.mjs +3 -3
- package/tableTags-web-api.json +1 -1
- package/tableTags.json +1 -0
- package/dist/css/app.28edf29a.css +0 -1
- package/dist/js/app-legacy.44d096fd.js +0 -2
- package/dist/js/app-legacy.44d096fd.js.map +0 -1
- package/dist/js/app.44d096fd.js +0 -2
- package/dist/js/app.44d096fd.js.map +0 -1
- package/dist/js/chunk-vendors-legacy.65d2bd6b.js +0 -14
- package/dist/js/chunk-vendors-legacy.65d2bd6b.js.map +0 -1
- package/dist/js/chunk-vendors.65d2bd6b.js +0 -14
- package/dist/js/chunk-vendors.65d2bd6b.js.map +0 -1
package/docs/WWebApi.html
CHANGED
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
|
|
128
128
|
<h5 class="h5-examples">Example</h5>
|
|
129
129
|
|
|
130
|
-
<pre class="prettyprint"><code>import WOrm from 'w-orm-mongodb/src/WOrmMongodb.mjs' //自行選擇引用ORM, 使用Mongodb測試
|
|
131
130
|
bCheckUser: false,
|
|
132
131
|
getUserById: null,
|
|
133
132
|
bExcludeWhenNotAdmin: false,
|
|
134
133
|
serverPort: 11005,
|
|
135
134
|
subfolder: '', //mapi
|
|
136
135
|
urlRedirect: 'https://www.google.com/', //本機測試時得先編譯, 再瀏覽: http://localhost:11005/
|
|
137
136
|
webName: {
|
|
138
137
|
'eng': 'API Service',
|
|
139
138
|
'cht': 'API管理系統',
|
|
140
139
|
},
|
|
141
140
|
webDescription: {
|
|
142
141
|
'eng': 'A web service package as methods to send requests to and receive responses from an API.',
|
|
143
142
|
'cht': 'A web service package as methods to send requests to and receive responses from an API.',
|
|
144
143
|
},
|
|
145
144
|
webLogo: 'data:image/svg+xml;base64,...',
|
|
146
145
|
// return {} //測試無法登入
|
|
147
146
|
if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
|
|
148
147
|
return {
|
|
149
148
|
id: 'id-for-application',
|
|
150
149
|
name: 'application',
|
|
151
150
|
email: 'application@example.com',
|
|
152
151
|
isAdmin: 'y',
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
|
|
156
155
|
return {
|
|
157
156
|
id: 'id-for-admin',
|
|
158
157
|
name: '測試者',
|
|
159
158
|
email: 'admin@example.com',
|
|
160
159
|
isAdmin: 'y',
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
console.log('invalid token', token)
|
|
164
163
|
console.log('於生產環境時得加入SSO等驗證token機制')
|
|
165
164
|
return {}
|
|
166
165
|
console.log('verifyBrowserUser/user', user)
|
|
167
166
|
// return false //測試無法登入
|
|
168
167
|
console.log('於生產環境時得加入限制瀏覽器使用者身份機制')
|
|
169
168
|
return user.isAdmin === 'y' //測試僅系統管理者使用
|
|
170
169
|
console.log('verifyAppUser/user', user)
|
|
171
170
|
// return false //測試無法登入
|
|
172
171
|
console.log('於生產環境時得加入限制應用程式使用者身份機制')
|
|
173
172
|
return user.isAdmin === 'y' //測試僅系統管理者使用
|
|
174
173
|
console.log(err)
|
|
174
|
+
<pre class="prettyprint"><code>import WOrm from 'w-orm-mongodb/src/WOrmMongodb.mjs' //自行選擇引用ORM, 使用Mongodb測試
|
|
175
175
|
useCheckUser: false,
|
|
176
176
|
getUserById: null,
|
|
177
177
|
useExcludeWhenNotAdmin: false,
|
|
178
178
|
serverPort: 11005,
|
|
179
179
|
subfolder: '', //mapi
|
|
180
180
|
urlRedirect: 'https://www.google.com/', //本機測試時得先編譯, 再瀏覽: http://localhost:11005/
|
|
181
181
|
webName: {
|
|
182
182
|
'eng': 'API Service',
|
|
183
183
|
'cht': 'API管理系統',
|
|
184
184
|
},
|
|
185
185
|
webDescription: {
|
|
186
186
|
'eng': 'A web service package as methods to send requests to and receive responses from an API.',
|
|
187
187
|
'cht': 'A web service package as methods to send requests to and receive responses from an API.',
|
|
188
188
|
},
|
|
189
189
|
webLogo: 'data:image/svg+xml;base64,...',
|
|
190
190
|
// return {} //測試無法登入
|
|
191
191
|
if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
|
|
192
192
|
return {
|
|
193
193
|
id: 'id-for-application',
|
|
194
194
|
name: 'application',
|
|
195
195
|
email: 'application@example.com',
|
|
196
196
|
isAdmin: 'y',
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
|
|
200
200
|
return {
|
|
201
201
|
id: 'id-for-admin',
|
|
202
202
|
name: '測試者',
|
|
203
203
|
email: 'admin@example.com',
|
|
204
204
|
isAdmin: 'y',
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
console.log('invalid token', token)
|
|
208
208
|
console.log('於生產環境時得加入SSO等驗證token機制')
|
|
209
209
|
return {}
|
|
210
210
|
console.log('verifyBrowserUser/user', user)
|
|
211
211
|
// return false //測試無法登入
|
|
212
212
|
console.log('於生產環境時得加入限制瀏覽器使用者身份機制')
|
|
213
213
|
return user.isAdmin === 'y' //測試僅系統管理者使用
|
|
214
214
|
console.log('verifyAppUser/user', user)
|
|
215
215
|
// return false //測試無法登入
|
|
216
216
|
console.log('於生產環境時得加入限制應用程式使用者身份機制')
|
|
217
217
|
return user.isAdmin === 'y' //測試僅系統管理者使用
|
|
218
218
|
console.log(err)
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
|
|
481
481
|
<tr>
|
|
482
482
|
|
|
483
|
-
<td class="name"><code>
|
|
483
|
+
<td class="name"><code>useCheckUser</code></td>
|
|
484
484
|
|
|
485
485
|
|
|
486
486
|
<td class="type">
|
|
@@ -553,14 +553,14 @@
|
|
|
553
553
|
</td>
|
|
554
554
|
|
|
555
555
|
|
|
556
|
-
<td class="description last"><p>輸入當
|
|
556
|
+
<td class="description last"><p>輸入當useCheckUser=true時依照使用者ID取得使用者資訊物件函數,預設null</p></td>
|
|
557
557
|
</tr>
|
|
558
558
|
|
|
559
559
|
|
|
560
560
|
|
|
561
561
|
<tr>
|
|
562
562
|
|
|
563
|
-
<td class="name"><code>
|
|
563
|
+
<td class="name"><code>useExcludeWhenNotAdmin</code></td>
|
|
564
564
|
|
|
565
565
|
|
|
566
566
|
<td class="type">
|
|
@@ -885,7 +885,7 @@
|
|
|
885
885
|
<br class="clear">
|
|
886
886
|
|
|
887
887
|
<footer>
|
|
888
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
888
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sun May 18 2025 21:42:42 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
889
889
|
</footer>
|
|
890
890
|
|
|
891
891
|
<script>prettyPrint();</script>
|
package/docs/WWebApi.mjs.html
CHANGED
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
<article>
|
|
48
48
|
<pre class="prettyprint source linenums"><code>import path from 'path'
|
|
49
49
|
import fs from 'fs'
|
|
50
|
-
import get from 'lodash-es/get.js'
|
|
51
|
-
import each from 'lodash-es/each.js'
|
|
52
|
-
import keys from 'lodash-es/keys.js'
|
|
50
|
+
import get from 'lodash-es/get.js'
|
|
51
|
+
import each from 'lodash-es/each.js'
|
|
52
|
+
import keys from 'lodash-es/keys.js'
|
|
53
53
|
import j2o from 'wsemi/src/j2o.mjs'
|
|
54
54
|
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
55
55
|
import isestr from 'wsemi/src/isestr.mjs'
|
|
@@ -84,9 +84,9 @@ import ds from '../src/schema/index.mjs'
|
|
|
84
84
|
* @param {Function} verifyAppUser 輸入驗證應用程序使用者身份之處理函數,函數會傳入使用者資訊物件,通過此函數識別後回傳布林值,允許使用者回傳true,反之回傳false
|
|
85
85
|
* @param {Object} [opt={}] 輸入設定物件,預設{}
|
|
86
86
|
* @param {Integer} [opt.serverPort=11005] 輸入伺服器通訊port,預設11005
|
|
87
|
-
* @param {Boolean} [opt.
|
|
88
|
-
* @param {Function} [opt.getUserById=null] 輸入當
|
|
89
|
-
* @param {Boolean} [opt.
|
|
87
|
+
* @param {Boolean} [opt.useCheckUser=false] 輸入是否檢查使用者資訊布林值,預設false
|
|
88
|
+
* @param {Function} [opt.getUserById=null] 輸入當useCheckUser=true時依照使用者ID取得使用者資訊物件函數,預設null
|
|
89
|
+
* @param {Boolean} [opt.useExcludeWhenNotAdmin=false] 輸入使用ORM的select方法時是否自動刪除數據內isActive欄位之布林值,預設false
|
|
90
90
|
* @param {Object} [opt.webName={}] 輸入站台名稱物件,至少包含語系eng與cht鍵的名稱,預設{}
|
|
91
91
|
* @param {Object} [opt.webDescription={}] 輸入站台描述物件,至少包含語系eng與cht鍵的名稱,預設{}
|
|
92
92
|
* @param {String} [opt.webLogo=''] 輸入站台logo字串,採base64格式,預設''
|
|
@@ -107,9 +107,9 @@ import ds from '../src/schema/index.mjs'
|
|
|
107
107
|
* let db = st.dbName
|
|
108
108
|
* let opt = {
|
|
109
109
|
*
|
|
110
|
-
*
|
|
110
|
+
* useCheckUser: false,
|
|
111
111
|
* getUserById: null,
|
|
112
|
-
*
|
|
112
|
+
* useExcludeWhenNotAdmin: false,
|
|
113
113
|
*
|
|
114
114
|
* serverPort: 11005,
|
|
115
115
|
* subfolder: '', //mapi
|
|
@@ -226,16 +226,16 @@ function WWebApi(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUser
|
|
|
226
226
|
serverPort = cint(serverPort)
|
|
227
227
|
|
|
228
228
|
|
|
229
|
-
//
|
|
230
|
-
let
|
|
229
|
+
//useCheckUser
|
|
230
|
+
let useCheckUser = get(opt, 'useCheckUser', false)
|
|
231
231
|
|
|
232
232
|
|
|
233
233
|
//getUserById
|
|
234
234
|
let getUserById = get(opt, 'getUserById', null)
|
|
235
235
|
|
|
236
236
|
|
|
237
|
-
//
|
|
238
|
-
let
|
|
237
|
+
//useExcludeWhenNotAdmin
|
|
238
|
+
let useExcludeWhenNotAdmin = get(opt, 'useExcludeWhenNotAdmin', false)
|
|
239
239
|
|
|
240
240
|
|
|
241
241
|
//webName
|
|
@@ -268,9 +268,9 @@ function WWebApi(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUser
|
|
|
268
268
|
|
|
269
269
|
//WServOrm
|
|
270
270
|
let optWServOrm = {
|
|
271
|
-
|
|
271
|
+
useCheckUser,
|
|
272
272
|
getUserById,
|
|
273
|
-
|
|
273
|
+
useExcludeWhenNotAdmin,
|
|
274
274
|
}
|
|
275
275
|
let wp = {}
|
|
276
276
|
try {
|
|
@@ -701,24 +701,31 @@ function WWebApi(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUser
|
|
|
701
701
|
port: opt.serverPort,
|
|
702
702
|
pathStaticFiles,
|
|
703
703
|
apis,
|
|
704
|
-
|
|
704
|
+
getUserIdByToken: async (token) => { //可使用async或sync函數
|
|
705
|
+
// console.log('getUserIdByToken', token)
|
|
705
706
|
return ''
|
|
707
|
+
// let user = await getUserByToken(token) //api儲存時須使用
|
|
708
|
+
// let userId = get(user, 'id', '')
|
|
709
|
+
// if (!isestr(userId)) {
|
|
710
|
+
// console.log('token', token)
|
|
711
|
+
// console.log('userId', userId)
|
|
712
|
+
// return Promise.reject(`can not find user.id`)
|
|
713
|
+
// }
|
|
714
|
+
// return userId
|
|
706
715
|
},
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
716
|
+
useDbOrm: true,
|
|
717
|
+
kpOrm: woItems,
|
|
718
|
+
operOrm: procOrm, //procOrm的輸入為: userId, tableName, methodName, input
|
|
710
719
|
tableNamesExec,
|
|
711
720
|
methodsExec: ['select', 'insert', 'save', 'del'], //mix需於procOrm內註冊以提供
|
|
712
721
|
tableNamesSync,
|
|
713
|
-
|
|
722
|
+
kpFunExt: { //接收參數第1個為userId, 之後才是前端給予參數
|
|
714
723
|
getWebInfor,
|
|
715
724
|
getAPIsList: (userId, query = {}) => {
|
|
716
725
|
return getAPIsList(query)
|
|
717
726
|
},
|
|
718
727
|
//...
|
|
719
728
|
},
|
|
720
|
-
hookBefores: null,
|
|
721
|
-
hookAfters: null,
|
|
722
729
|
fnTableTags: 'tableTags-web-api.json',
|
|
723
730
|
})
|
|
724
731
|
|
|
@@ -742,7 +749,7 @@ export default WWebApi
|
|
|
742
749
|
<br class="clear">
|
|
743
750
|
|
|
744
751
|
<footer>
|
|
745
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
752
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sun May 18 2025 21:42:42 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
746
753
|
</footer>
|
|
747
754
|
|
|
748
755
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<br class="clear">
|
|
72
72
|
|
|
73
73
|
<footer>
|
|
74
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sun May 18 2025 21:42:42 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|
package/g.backupDb.mjs
CHANGED
package/g.initialTestData.mjs
CHANGED
|
@@ -8,6 +8,7 @@ async function initialTestData() {
|
|
|
8
8
|
//genTestData
|
|
9
9
|
await genTestData(ds, woItems)
|
|
10
10
|
|
|
11
|
+
console.log('finish.')
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
initialTestData()
|
|
@@ -17,4 +18,4 @@ initialTestData()
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
//刪除舊檔與重建測試資料庫
|
|
20
|
-
//node
|
|
21
|
+
//node g.initialTestData.mjs
|
package/g.mOrm.mjs
CHANGED
|
@@ -14,8 +14,8 @@ let db = st.dbName
|
|
|
14
14
|
//WServOrm
|
|
15
15
|
let opt = {
|
|
16
16
|
getUserById: null,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
useCheckUser: false,
|
|
18
|
+
useExcludeWhenNotAdmin: false,
|
|
19
19
|
}
|
|
20
20
|
let r = WServOrm(ds, WOrm, url, db, opt)
|
|
21
21
|
let { woItems, procOrm } = r
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w-web-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"main": "dist/w-web-api.umd.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@mdi/js": "^7.4.47",
|
|
7
7
|
"axios": "^1.6.8",
|
|
8
8
|
"lodash-es": "^4.17.21",
|
|
9
9
|
"showdown": "^2.1.0",
|
|
10
|
-
"w-component-vue": "^2.
|
|
10
|
+
"w-component-vue": "^2.4.15",
|
|
11
11
|
"w-data-collector": "^1.0.22",
|
|
12
|
-
"w-serv-hapi": "^1.0.
|
|
13
|
-
"w-serv-orm": "^1.0.
|
|
14
|
-
"w-ui-loginout": "^1.0.
|
|
15
|
-
"wsemi": "^1.7.
|
|
12
|
+
"w-serv-hapi": "^1.0.53",
|
|
13
|
+
"w-serv-orm": "^1.0.25",
|
|
14
|
+
"w-ui-loginout": "^1.0.9",
|
|
15
|
+
"wsemi": "^1.7.90"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@vue/cli-plugin-babel": "^5.0.8",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"eslint-plugin-vue": "^9.10.0",
|
|
29
29
|
"vue": "^2.6.14",
|
|
30
30
|
"vuex": "^3.6.2",
|
|
31
|
-
"w-orm-mongodb": "^1.1.
|
|
32
|
-
"w-package-tools": "^1.
|
|
31
|
+
"w-orm-mongodb": "^1.1.33",
|
|
32
|
+
"w-package-tools": "^1.1.2"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"serve": "vue-cli-service serve",
|
|
36
36
|
"build": "vue-cli-service build",
|
|
37
|
-
"test": "mocha --parallel --timeout 60000
|
|
37
|
+
"test": "mocha --parallel --timeout 60000",
|
|
38
38
|
"lint": "vue-cli-service lint",
|
|
39
39
|
"deploy": "gh-pages -d docs"
|
|
40
40
|
},
|
package/script.txt
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
#node
|
|
2
|
-
node
|
|
1
|
+
#node toolg/addVersion.mjs
|
|
2
|
+
node toolg/modifyReadme.mjs
|
|
3
3
|
|
|
4
|
-
node
|
|
4
|
+
node toolg/cleanFolder.mjs
|
|
5
5
|
./node_modules/.bin/jsdoc -c .jsdoc
|
|
6
6
|
|
|
7
7
|
npm run build
|
|
8
8
|
|
|
9
|
-
node
|
|
9
|
+
node toolg/genEntry.mjs
|
|
10
10
|
|
|
11
|
-
node
|
|
11
|
+
node toolg/gDistRollup.mjs
|
|
12
12
|
|
|
13
13
|
git add . -A
|
|
14
14
|
git commit -m 'modify: '
|
package/server/WWebApi.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import fs from 'fs'
|
|
3
|
-
import get from 'lodash-es/get.js'
|
|
4
|
-
import each from 'lodash-es/each.js'
|
|
5
|
-
import keys from 'lodash-es/keys.js'
|
|
3
|
+
import get from 'lodash-es/get.js'
|
|
4
|
+
import each from 'lodash-es/each.js'
|
|
5
|
+
import keys from 'lodash-es/keys.js'
|
|
6
6
|
import j2o from 'wsemi/src/j2o.mjs'
|
|
7
7
|
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
8
8
|
import isestr from 'wsemi/src/isestr.mjs'
|
|
@@ -37,9 +37,9 @@ import ds from '../src/schema/index.mjs'
|
|
|
37
37
|
* @param {Function} verifyAppUser 輸入驗證應用程序使用者身份之處理函數,函數會傳入使用者資訊物件,通過此函數識別後回傳布林值,允許使用者回傳true,反之回傳false
|
|
38
38
|
* @param {Object} [opt={}] 輸入設定物件,預設{}
|
|
39
39
|
* @param {Integer} [opt.serverPort=11005] 輸入伺服器通訊port,預設11005
|
|
40
|
-
* @param {Boolean} [opt.
|
|
41
|
-
* @param {Function} [opt.getUserById=null] 輸入當
|
|
42
|
-
* @param {Boolean} [opt.
|
|
40
|
+
* @param {Boolean} [opt.useCheckUser=false] 輸入是否檢查使用者資訊布林值,預設false
|
|
41
|
+
* @param {Function} [opt.getUserById=null] 輸入當useCheckUser=true時依照使用者ID取得使用者資訊物件函數,預設null
|
|
42
|
+
* @param {Boolean} [opt.useExcludeWhenNotAdmin=false] 輸入使用ORM的select方法時是否自動刪除數據內isActive欄位之布林值,預設false
|
|
43
43
|
* @param {Object} [opt.webName={}] 輸入站台名稱物件,至少包含語系eng與cht鍵的名稱,預設{}
|
|
44
44
|
* @param {Object} [opt.webDescription={}] 輸入站台描述物件,至少包含語系eng與cht鍵的名稱,預設{}
|
|
45
45
|
* @param {String} [opt.webLogo=''] 輸入站台logo字串,採base64格式,預設''
|
|
@@ -60,9 +60,9 @@ import ds from '../src/schema/index.mjs'
|
|
|
60
60
|
* let db = st.dbName
|
|
61
61
|
* let opt = {
|
|
62
62
|
*
|
|
63
|
-
*
|
|
63
|
+
* useCheckUser: false,
|
|
64
64
|
* getUserById: null,
|
|
65
|
-
*
|
|
65
|
+
* useExcludeWhenNotAdmin: false,
|
|
66
66
|
*
|
|
67
67
|
* serverPort: 11005,
|
|
68
68
|
* subfolder: '', //mapi
|
|
@@ -179,16 +179,16 @@ function WWebApi(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUser
|
|
|
179
179
|
serverPort = cint(serverPort)
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
//
|
|
183
|
-
let
|
|
182
|
+
//useCheckUser
|
|
183
|
+
let useCheckUser = get(opt, 'useCheckUser', false)
|
|
184
184
|
|
|
185
185
|
|
|
186
186
|
//getUserById
|
|
187
187
|
let getUserById = get(opt, 'getUserById', null)
|
|
188
188
|
|
|
189
189
|
|
|
190
|
-
//
|
|
191
|
-
let
|
|
190
|
+
//useExcludeWhenNotAdmin
|
|
191
|
+
let useExcludeWhenNotAdmin = get(opt, 'useExcludeWhenNotAdmin', false)
|
|
192
192
|
|
|
193
193
|
|
|
194
194
|
//webName
|
|
@@ -221,9 +221,9 @@ function WWebApi(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUser
|
|
|
221
221
|
|
|
222
222
|
//WServOrm
|
|
223
223
|
let optWServOrm = {
|
|
224
|
-
|
|
224
|
+
useCheckUser,
|
|
225
225
|
getUserById,
|
|
226
|
-
|
|
226
|
+
useExcludeWhenNotAdmin,
|
|
227
227
|
}
|
|
228
228
|
let wp = {}
|
|
229
229
|
try {
|
|
@@ -654,24 +654,31 @@ function WWebApi(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUser
|
|
|
654
654
|
port: opt.serverPort,
|
|
655
655
|
pathStaticFiles,
|
|
656
656
|
apis,
|
|
657
|
-
|
|
657
|
+
getUserIdByToken: async (token) => { //可使用async或sync函數
|
|
658
|
+
// console.log('getUserIdByToken', token)
|
|
658
659
|
return ''
|
|
660
|
+
// let user = await getUserByToken(token) //api儲存時須使用
|
|
661
|
+
// let userId = get(user, 'id', '')
|
|
662
|
+
// if (!isestr(userId)) {
|
|
663
|
+
// console.log('token', token)
|
|
664
|
+
// console.log('userId', userId)
|
|
665
|
+
// return Promise.reject(`can not find user.id`)
|
|
666
|
+
// }
|
|
667
|
+
// return userId
|
|
659
668
|
},
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
669
|
+
useDbOrm: true,
|
|
670
|
+
kpOrm: woItems,
|
|
671
|
+
operOrm: procOrm, //procOrm的輸入為: userId, tableName, methodName, input
|
|
663
672
|
tableNamesExec,
|
|
664
673
|
methodsExec: ['select', 'insert', 'save', 'del'], //mix需於procOrm內註冊以提供
|
|
665
674
|
tableNamesSync,
|
|
666
|
-
|
|
675
|
+
kpFunExt: { //接收參數第1個為userId, 之後才是前端給予參數
|
|
667
676
|
getWebInfor,
|
|
668
677
|
getAPIsList: (userId, query = {}) => {
|
|
669
678
|
return getAPIsList(query)
|
|
670
679
|
},
|
|
671
680
|
//...
|
|
672
681
|
},
|
|
673
|
-
hookBefores: null,
|
|
674
|
-
hookAfters: null,
|
|
675
682
|
fnTableTags: 'tableTags-web-api.json',
|
|
676
683
|
})
|
|
677
684
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div style="height:
|
|
2
|
+
<div style="height:100svh; background:#f5f5f5;">
|
|
3
3
|
|
|
4
4
|
<!-- menu top, 因窄版導致名稱換行故須使用overflow-y:hidden -->
|
|
5
5
|
<div :style="`height:${heightToolbar}px; overflow-y:hidden; padding:0px 10px; background:#fff; border-bottom:1px solid #ccc; display:flex; align-items:center;`">
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<script>
|
|
52
|
-
import get from 'lodash-es/get.js'
|
|
53
|
-
// import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
52
|
+
import get from 'lodash-es/get.js'
|
|
53
|
+
// import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
54
54
|
import isestr from 'wsemi/src/isestr.mjs'
|
|
55
55
|
import WButtonCircle from 'w-component-vue/src/components/WButtonCircle.vue'
|
|
56
56
|
import WTextSelect from 'w-component-vue/src/components/WTextSelect.vue'
|
|
@@ -99,11 +99,15 @@ export default {
|
|
|
99
99
|
computed: {
|
|
100
100
|
|
|
101
101
|
viewState: function() {
|
|
102
|
-
return get(this, `$store.state.viewState
|
|
102
|
+
return get(this, `$store.state.viewState`, '')
|
|
103
103
|
},
|
|
104
104
|
|
|
105
105
|
heightToolbar: function() {
|
|
106
|
-
|
|
106
|
+
//console.log('computed heightToolbar')
|
|
107
|
+
|
|
108
|
+
let vo = this
|
|
109
|
+
|
|
110
|
+
return get(vo, `$store.state.heightToolbar`, 0)
|
|
107
111
|
},
|
|
108
112
|
|
|
109
113
|
webName: {
|
|
@@ -124,7 +128,11 @@ export default {
|
|
|
124
128
|
},
|
|
125
129
|
|
|
126
130
|
webLogo: function() {
|
|
127
|
-
|
|
131
|
+
//console.log('computed webLogo')
|
|
132
|
+
|
|
133
|
+
let vo = this
|
|
134
|
+
|
|
135
|
+
return get(vo, `$store.state.webInfor.webLogo`, '')
|
|
128
136
|
},
|
|
129
137
|
|
|
130
138
|
},
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
:drawerWidthMax="drawerWidthMax"
|
|
17
17
|
:mode="'from-left'"
|
|
18
18
|
:dragDrawerWidth="true"
|
|
19
|
-
:
|
|
19
|
+
:autoSwitchToHide="true"
|
|
20
|
+
:autoSwitchToShow="true"
|
|
21
|
+
:autoSwitchToFloat="true"
|
|
20
22
|
:switchWidth="drawerWidth*2.3"
|
|
21
23
|
>
|
|
22
24
|
|
|
@@ -400,12 +402,12 @@
|
|
|
400
402
|
</template>
|
|
401
403
|
|
|
402
404
|
<script>
|
|
403
|
-
import get from 'lodash-es/get.js'
|
|
404
|
-
import set from 'lodash-es/set.js'
|
|
405
|
-
import each from 'lodash-es/each.js'
|
|
406
|
-
import trim from 'lodash-es/trim.js'
|
|
407
|
-
import find from 'lodash-es/find.js'
|
|
408
|
-
import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
405
|
+
import get from 'lodash-es/get.js'
|
|
406
|
+
import set from 'lodash-es/set.js'
|
|
407
|
+
import each from 'lodash-es/each.js'
|
|
408
|
+
import trim from 'lodash-es/trim.js'
|
|
409
|
+
import find from 'lodash-es/find.js'
|
|
410
|
+
import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
409
411
|
import isobj from 'wsemi/src/isobj.mjs'
|
|
410
412
|
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
411
413
|
import j2o from 'wsemi/src/j2o.mjs'
|
package/src/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import get from 'lodash-es/get'
|
|
1
|
+
import get from 'lodash-es/get.js'
|
|
2
2
|
// import '@babel/polyfill' //需提供Vuetify的Symbol等API
|
|
3
3
|
// import 'core-js/stable' //需提供Vuetify的Symbol等API, 官網說使用transpileDependencies但不夠, 改用之前提到的@babel/polyfill會被提示已廢棄, 改使用給webpack的polyfill方式才行
|
|
4
4
|
// import 'regenerator-runtime/runtime'
|
package/src/schema/gi.mjs
CHANGED
package/srv.mjs
CHANGED
|
@@ -10,9 +10,9 @@ let url = `mongodb://${st.dbUsername}:${st.dbPassword}@${st.dbIP}:${st.dbPort}`
|
|
|
10
10
|
let db = st.dbName
|
|
11
11
|
let opt = {
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
useCheckUser: false,
|
|
14
14
|
getUserById: null,
|
|
15
|
-
|
|
15
|
+
useExcludeWhenNotAdmin: false,
|
|
16
16
|
|
|
17
17
|
serverPort: 11005,
|
|
18
18
|
subfolder: '', //mapi
|
|
@@ -75,4 +75,4 @@ instWWebApi.on('error', (err) => {
|
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
//node
|
|
78
|
+
//node srv.mjs
|
package/tableTags-web-api.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"apis":"
|
|
1
|
+
{"apis":"NbPqzv"}
|
package/tableTags.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"apis":"2025-05-18T21:42:02+08:00|wTOmyF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.pgc-rotate[data-v-78262a9b]{width:100%;height:100%;margin:auto;position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;-webkit-transition:all .6s ease-in-out;transition:all .6s ease-in-out;-webkit-animation:progress-circular-rotate-78262a9b 1.4s linear infinite;animation:progress-circular-rotate-78262a9b 1.4s linear infinite;-webkit-transform-origin:center center;transform-origin:center center}.pgc-dash[data-v-78262a9b]{-webkit-animation:progress-circular-dash-78262a9b 1.4s ease-in-out infinite;animation:progress-circular-dash-78262a9b 1.4s ease-in-out infinite;stroke-linecap:round;stroke-dasharray:80,200;stroke-dashoffset:0px}@-webkit-keyframes progress-circular-dash-78262a9b{0%{stroke-dasharray:1,200;stroke-dashoffset:0px}50%{stroke-dasharray:100,200;stroke-dashoffset:-15px}to{stroke-dasharray:100,200;stroke-dashoffset:-124px}}@keyframes progress-circular-dash-78262a9b{0%{stroke-dasharray:1,200;stroke-dashoffset:0px}50%{stroke-dasharray:100,200;stroke-dashoffset:-15px}to{stroke-dasharray:100,200;stroke-dashoffset:-124px}}@-webkit-keyframes progress-circular-rotate-78262a9b{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes progress-circular-rotate-78262a9b{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.WPopup-Content[data-popper-reference-hidden][data-v-79e5363a]{visibility:hidden;pointer-events:none}.sb[data-v-6ce5bdb1]{-webkit-transition:opacity .3s;transition:opacity .3s;scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.3) transparent}.sb[data-v-6ce5bdb1]::-webkit-scrollbar{width:8px;height:8px}.sb[data-v-6ce5bdb1]::-webkit-scrollbar-track{background:transparent}.sb[data-v-6ce5bdb1]::-webkit-scrollbar-thumb{background:rgba(0,0,0,.3);border-radius:20px;border:3px solid transparent}.ts[data-v-cdd2be3e]{-webkit-transition:all .3s cubic-bezier(.25,.8,.5,1);transition:all .3s cubic-bezier(.25,.8,.5,1)}.bs[data-v-cdd2be3e]{-webkit-box-shadow:0 8px 2px -8px rgba(0,0,0,.3),0 16px 24px 2px rgba(0,0,0,.3),0 6px 30px 5px rgba(0,0,0,.3);box-shadow:0 8px 2px -8px rgba(0,0,0,.3),0 16px 24px 2px rgba(0,0,0,.3),0 6px 30px 5px rgba(0,0,0,.3)}.fade-enter-active[data-v-a0c94508],.fade-leave-active[data-v-a0c94508]{-webkit-transition:all .3s;transition:all .3s}.fade-enter[data-v-a0c94508],.fade-leave-to[data-v-a0c94508]{-webkit-transform:scaleX(0);transform:scaleX(0)}.fade-enter-to[data-v-a0c94508],.fade-leave[data-v-a0c94508]{-webkit-transform:scaleX(100%);transform:scaleX(100%)}.caretRight[data-v-99549bfa]{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block}.cc[data-v-99549bfa]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.circle[data-v-99549bfa]{width:22px;height:22px;min-width:22px;min-height:22px;max-width:22px;max-height:22px;border-radius:50%}.md[data-v-1a0f86f5] table{border-collapse:collapse;margin:0;padding:0;word-break:normal}.md[data-v-1a0f86f5] tr{margin:0;padding:0}.md[data-v-1a0f86f5] table tr th{font-weight:700;background:#eee;border:1px solid #ddd;border-bottom:0;margin:0;padding:6px 13px}.md[data-v-1a0f86f5] table tr td{border:1px solid #ddd;margin:0;padding:6px 13px}.md[data-v-1a0f86f5] h1{font-size:1.2rem;line-height:1.2rem}.md[data-v-1a0f86f5] h1,.md[data-v-1a0f86f5] h2{font-weight:700;margin-top:.5rem;margin-bottom:.5rem}.md[data-v-1a0f86f5] h2{font-size:1.1rem;line-height:1.1rem}.md[data-v-1a0f86f5] h3,.md[data-v-1a0f86f5] h4,.md[data-v-1a0f86f5] h5,.md[data-v-1a0f86f5] h6{font-weight:700;font-size:1rem;line-height:1rem;margin-top:.5rem;margin-bottom:.5rem}.bk[data-v-550471bd]{display:inline-block;width:200px;padding:0 10px 10px 0;vertical-align:top}.bk-title[data-v-550471bd]{padding:3px;font-size:.8rem;color:#888}.bk-item[data-v-550471bd]{padding:3px 5px;font-size:.9rem;line-height:.9rem;border-radius:5px;border:1px solid #ddd;background:#fff}body,html{font-family:微軟正黑體,Microsoft JhengHei,MicrosoftJhengHeiRegular,Avenir,Helvetica,Arial,sans-serif;overflow-y:hidden}a,button,div,input,p,pre,span,textarea{font-family:inherit}.fade-enter-active{-webkit-animation:go 1s;animation:go 1s}.fade-leave-active{-webkit-animation:back 1s;animation:back 1s}@-webkit-keyframes go{0%{opacity:0}to{opacity:1}}@keyframes go{0%{opacity:0}to{opacity:1}}@-webkit-keyframes back{0%{opacity:1}to{opacity:0}}@keyframes back{0%{opacity:1}to{opacity:0}}
|