w-web-api 1.0.74 → 1.0.76
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 +99 -99
- package/dist/css/{app.3a6c6dd2.css → app.ae472c4d.css} +1 -1
- package/dist/index.tmp +1 -1
- package/dist/js/app-legacy.2aa145e5.js +1 -0
- package/dist/js/app.2aa145e5.js +1 -0
- package/dist/js/{chunk-vendors.516b8a46.js → chunk-vendors-legacy.47cf6375.js} +2 -2
- package/dist/js/{chunk-vendors-legacy.516b8a46.js → chunk-vendors.47cf6375.js} +2 -2
- package/dist/w-web-api.umd.js +1 -1
- package/docs/WWebApi.html +76 -2
- package/docs/index.html +1 -1
- package/docs/server_WWebApi.mjs.html +931 -931
- package/docs/src_components_Common_CheckYesNo.vue.html +1 -1
- package/{g.backupDb.mjs → g_backupDb.mjs} +10 -10
- package/{g.initialTestData.mjs → g_initialTestData.mjs} +21 -21
- package/{g.mOrm.mjs → g_mOrm.mjs} +24 -24
- package/{g.provideApis.mjs → g_provideApis.mjs} +53 -53
- package/logs/2026-08-25T20.log +0 -0
- package/logs/2026-08-25T21.log +1891 -0
- package/package.json +12 -12
- package/server/WWebApi.mjs +930 -930
- package/settings.json +1 -1
- package/src/components/LayoutContent.vue +637 -637
- package/src/components/LayoutContentStats.vue +557 -485
- package/srv.mjs +108 -108
- package/tableTags.json +1 -1
- package/dist/js/app-legacy.0999553a.js +0 -1
- package/dist/js/app.0999553a.js +0 -1
- /package/{g.getSettings.mjs → g_getSettings.mjs} +0 -0
package/dist/w-web-api.umd.js
CHANGED
package/docs/WWebApi.html
CHANGED
|
@@ -127,7 +127,81 @@
|
|
|
127
127
|
|
|
128
128
|
<h5 class="h5-examples">Example</h5>
|
|
129
129
|
|
|
130
|
-
<pre class="prettyprint"><code>import WOrm from 'w-orm-lmdb/src/WOrmLmdb.mjs'
|
|
131
130
|
useCheckUser: false,
|
|
132
131
|
getUserById: null,
|
|
133
132
|
useExcludeWhenNotAdmin: 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('verifyClientUser/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-lmdb/src/WOrmLmdb.mjs'
|
|
175
|
+
import WWebApi from './server/WWebApi.mjs'
|
|
176
|
+
import getSettings from './g_getSettings.mjs'
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
//st
|
|
180
|
+
let st = getSettings()
|
|
181
|
+
|
|
182
|
+
let url = st.dbUrl
|
|
183
|
+
let db = st.dbName
|
|
184
|
+
let opt = {
|
|
185
|
+
|
|
186
|
+
useCheckUser: false,
|
|
187
|
+
getUserById: null,
|
|
188
|
+
useExcludeWhenNotAdmin: false,
|
|
189
|
+
|
|
190
|
+
serverPort: 11005,
|
|
191
|
+
subfolder: '', //mapi
|
|
192
|
+
urlRedirect: 'https://www.google.com/', //本機測試時得先編譯, 再瀏覽: http://localhost:11005/
|
|
193
|
+
|
|
194
|
+
webName: {
|
|
195
|
+
'eng': 'API Service',
|
|
196
|
+
'cht': 'API管理系統',
|
|
197
|
+
},
|
|
198
|
+
webDescription: {
|
|
199
|
+
'eng': 'A web service package as methods to send requests to and receive responses from an API.',
|
|
200
|
+
'cht': 'A web service package as methods to send requests to and receive responses from an API.',
|
|
201
|
+
},
|
|
202
|
+
webLogo: 'data:image/svg+xml;base64,...',
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let getUserByToken = async (token) => {
|
|
207
|
+
// return {} //測試無法登入
|
|
208
|
+
if (token === '{token-for-application}') { //提供外部應用系統作為存取使用者
|
|
209
|
+
return {
|
|
210
|
+
id: 'id-for-application',
|
|
211
|
+
name: 'application',
|
|
212
|
+
email: 'application@example.com',
|
|
213
|
+
isAdmin: 'y',
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (token === 'sys') { //開發階段w-ui-loginout自動給予browser使用者(且位於localhost)的token為sys
|
|
217
|
+
return {
|
|
218
|
+
id: 'id-for-admin',
|
|
219
|
+
name: '測試者',
|
|
220
|
+
email: 'admin@example.com',
|
|
221
|
+
isAdmin: 'y',
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
console.log('invalid token', token)
|
|
225
|
+
console.log('於生產環境時得加入SSO等驗證token機制')
|
|
226
|
+
return {}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let verifyClientUser = (user, from) => {
|
|
230
|
+
console.log('verifyClientUser/user', user)
|
|
231
|
+
// return false //測試無法登入
|
|
232
|
+
console.log('於生產環境時得加入限制瀏覽器使用者身份機制')
|
|
233
|
+
return user.isAdmin === 'y' //測試僅系統管理者使用
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
let verifyAppUser = (user, from) => {
|
|
237
|
+
console.log('verifyAppUser/user', user)
|
|
238
|
+
// return false //測試無法登入
|
|
239
|
+
console.log('於生產環境時得加入限制應用程式使用者身份機制')
|
|
240
|
+
return user.isAdmin === 'y' //測試僅系統管理者使用
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
//WWebApi
|
|
244
|
+
let instWWebApi = WWebApi(WOrm, url, db, getUserByToken, verifyClientUser, verifyAppUser, opt)
|
|
245
|
+
|
|
246
|
+
instWWebApi.on('error', (err) => {
|
|
247
|
+
console.log(err)
|
|
248
|
+
})</code></pre>
|
|
175
249
|
|
|
176
250
|
|
|
177
251
|
|
|
@@ -885,7 +959,7 @@
|
|
|
885
959
|
<br class="clear">
|
|
886
960
|
|
|
887
961
|
<footer>
|
|
888
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
962
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Aug 26 2026 18:01:59 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
889
963
|
</footer>
|
|
890
964
|
|
|
891
965
|
<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.5</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Aug 26 2026 18:01:59 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|