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.
- package/.editorconfig +9 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +54 -0
- package/.jsdoc +25 -0
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/SECURITY.md +5 -0
- package/babel.config.js +14 -0
- package/dist/w-web-api.umd.js +7 -0
- package/dist/w-web-api.umd.js.map +1 -0
- package/docs/WWebApi.html +551 -0
- package/docs/WWebApi.mjs.html +335 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/index.html +81 -0
- package/docs/scripts/collapse.js +20 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +83 -0
- package/docs/styles/jsdoc.css +765 -0
- package/docs/styles/prettify.css +79 -0
- package/package.json +81 -0
- package/public/connecting.svg +10 -0
- package/public/deny.png +0 -0
- package/public/disconnect.png +0 -0
- package/public/index.html +23 -0
- package/public/logout.png +0 -0
- package/server/WWebApi.mjs +283 -0
- package/server/getSettings.mjs +17 -0
- package/server/mDb.mjs +76 -0
- package/server/mInitialTestData.mjs +40 -0
- package/server/mOrm.mjs +22 -0
- package/src/App.vue +91 -0
- package/src/components/Layout.vue +131 -0
- package/src/components/LayoutContent.vue +67 -0
- package/src/components/LayoutContentList.vue +573 -0
- package/src/components/MdPanel.vue +152 -0
- package/src/main.js +98 -0
- package/src/plugins/mDataSelectorSchema.mjs +30 -0
- package/src/plugins/mDataSupport.mjs +78 -0
- package/src/plugins/mShare.mjs +235 -0
- package/src/plugins/mUI.mjs +141 -0
- package/src/plugins/mVuetify.mjs +12 -0
- package/src/schema/gi.mjs +8 -0
- package/src/schema/index.mjs +16 -0
- package/src/schema/tables/apis.mjs +918 -0
- package/src/store/actions.mjs +1 -0
- package/src/store/getters.mjs +1 -0
- package/src/store/index.mjs +25 -0
- package/src/store/mutations.mjs +185 -0
- package/src/store/types.mjs +14 -0
- package/srv.mjs +33 -0
- package/tableTags.json +1 -0
- package/toolg/addVersion.mjs +4 -0
- package/toolg/cleanFolder.mjs +4 -0
- package/toolg/gDistRollup.mjs +34 -0
- package/toolg/modifyReadme.mjs +4 -0
- package/vue.config.js +15 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//非同步執行, 不需要
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//不需要
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import Vuex from 'vuex'
|
|
3
|
+
import { state, mutations } from './mutations.mjs'
|
|
4
|
+
import * as getters from './getters.mjs'
|
|
5
|
+
import * as actions from './actions.mjs'
|
|
6
|
+
import * as types from './types.mjs'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
//use
|
|
10
|
+
Vue.use(Vuex)
|
|
11
|
+
|
|
12
|
+
let st = new Vuex.Store({
|
|
13
|
+
state,
|
|
14
|
+
mutations,
|
|
15
|
+
getters,
|
|
16
|
+
actions,
|
|
17
|
+
strict: true, //嚴格模式禁止修改state
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
//save to $store
|
|
21
|
+
st.types = types
|
|
22
|
+
Vue.prototype.$store = st
|
|
23
|
+
// console.log('$store', st)
|
|
24
|
+
|
|
25
|
+
export default st
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import each from 'lodash/each'
|
|
2
|
+
import set from 'lodash/set'
|
|
3
|
+
import * as types from './types.mjs'
|
|
4
|
+
import ds from '../schema/index.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
//state, 全域狀態
|
|
8
|
+
let state = {
|
|
9
|
+
|
|
10
|
+
hostname: `${window.location.origin}`,
|
|
11
|
+
webInfor: {},
|
|
12
|
+
connState: '連線中...',
|
|
13
|
+
syncState: false,
|
|
14
|
+
viewState: 'lists',
|
|
15
|
+
loading: false,
|
|
16
|
+
settings: {
|
|
17
|
+
leftDrawerWidth: 200,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
heightApp: 0,
|
|
21
|
+
heightAppEff: 0,
|
|
22
|
+
heightToolbar: 50,
|
|
23
|
+
|
|
24
|
+
menu: {}, //初始值需為物件, 否則LayoutContent會取menu.key出錯
|
|
25
|
+
|
|
26
|
+
userToken: '',
|
|
27
|
+
userSelf: {
|
|
28
|
+
id: 'id-for-admin',
|
|
29
|
+
name: '系統管理員',
|
|
30
|
+
email: 'admin@email.com',
|
|
31
|
+
isAdmin: true,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
lang: 'cht',
|
|
35
|
+
keyLangs: {
|
|
36
|
+
|
|
37
|
+
noSelectApi: {
|
|
38
|
+
eng: 'No Select',
|
|
39
|
+
cht: '尚未選擇API',
|
|
40
|
+
},
|
|
41
|
+
waitingData: {
|
|
42
|
+
eng: 'Waiting data...',
|
|
43
|
+
cht: '等待數據中...',
|
|
44
|
+
},
|
|
45
|
+
tokens: {
|
|
46
|
+
eng: 'Tokens',
|
|
47
|
+
cht: '授權金鑰',
|
|
48
|
+
},
|
|
49
|
+
version: {
|
|
50
|
+
eng: 'Version',
|
|
51
|
+
cht: '版本',
|
|
52
|
+
},
|
|
53
|
+
levels: {
|
|
54
|
+
eng: 'Levels',
|
|
55
|
+
cht: '所屬階層',
|
|
56
|
+
},
|
|
57
|
+
keywords: {
|
|
58
|
+
eng: 'Keywords',
|
|
59
|
+
cht: '關鍵字',
|
|
60
|
+
},
|
|
61
|
+
state: {
|
|
62
|
+
eng: 'State',
|
|
63
|
+
cht: '狀態',
|
|
64
|
+
},
|
|
65
|
+
timeCreate: {
|
|
66
|
+
eng: 'Create time',
|
|
67
|
+
cht: '創建時間',
|
|
68
|
+
},
|
|
69
|
+
timeUpdate: {
|
|
70
|
+
eng: 'Update time',
|
|
71
|
+
cht: '更新時間',
|
|
72
|
+
},
|
|
73
|
+
creator: {
|
|
74
|
+
eng: 'Creator',
|
|
75
|
+
cht: 'API創建者',
|
|
76
|
+
},
|
|
77
|
+
dataSource: {
|
|
78
|
+
eng: 'Source',
|
|
79
|
+
cht: '資料提供者',
|
|
80
|
+
},
|
|
81
|
+
isActive: {
|
|
82
|
+
eng: 'Active',
|
|
83
|
+
cht: '有效',
|
|
84
|
+
},
|
|
85
|
+
mdInputParams: {
|
|
86
|
+
eng: 'Input',
|
|
87
|
+
cht: '輸入參數資訊或結構',
|
|
88
|
+
},
|
|
89
|
+
inputExample: {
|
|
90
|
+
eng: 'Input example',
|
|
91
|
+
cht: '輸入範例',
|
|
92
|
+
},
|
|
93
|
+
mdOutputParams: {
|
|
94
|
+
eng: 'Output',
|
|
95
|
+
cht: '回傳數據結構',
|
|
96
|
+
},
|
|
97
|
+
outputExample: {
|
|
98
|
+
eng: 'Output example',
|
|
99
|
+
cht: '回傳數據範例',
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
outputMenuTree: {
|
|
103
|
+
eng: 'Tree',
|
|
104
|
+
cht: '樹狀組件',
|
|
105
|
+
},
|
|
106
|
+
outputMenuRaw: {
|
|
107
|
+
eng: 'Raw',
|
|
108
|
+
cht: '原始數據',
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//添加各資料表
|
|
116
|
+
each(ds, (v, k) => {
|
|
117
|
+
state[k] = null //初始化null
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
//儲存至state
|
|
121
|
+
export { state }
|
|
122
|
+
|
|
123
|
+
//mutations, 同步執行
|
|
124
|
+
export let mutations = {
|
|
125
|
+
|
|
126
|
+
[types.UpdateWebInfor] (state, webInfor) {
|
|
127
|
+
state.webInfor = webInfor
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
[types.UpdateLang] (state, lang) {
|
|
131
|
+
state.lang = lang
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
[types.UpdateConnState] (state, connState) {
|
|
135
|
+
state.connState = connState
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
[types.UpdateSyncState] (state, syncState) {
|
|
139
|
+
state.syncState = syncState
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
[types.UpdateLoading] (state, loading) {
|
|
143
|
+
state.loading = loading
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
[types.UpdateViewState] (state, viewState) {
|
|
147
|
+
state.viewState = viewState
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
[types.UpdateTableData] (state, msg) {
|
|
151
|
+
state[msg.tableName] = msg.data
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
[types.UpdateData] (state, msg) {
|
|
155
|
+
//msg.path內為存取路徑, 需使用lodash的set處理
|
|
156
|
+
// console.log('UpdateData msg', msg)
|
|
157
|
+
set(state, msg.path, msg.data)
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
[types.UpdateHeightApp] (state, heightApp) {
|
|
161
|
+
state.heightApp = heightApp
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
[types.UpdateHeightAppEff] (state, heightAppEff) {
|
|
165
|
+
state.heightAppEff = heightAppEff
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
[types.UpdateHeightToolbar] (state, heightToolbar) {
|
|
169
|
+
state.heightToolbar = heightToolbar
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
[types.UpdateMenu] (state, menu) {
|
|
173
|
+
state.menu = menu
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
[types.UpdateUserToken] (state, userToken) {
|
|
177
|
+
state.userToken = userToken
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
[types.UpdateUserSelf] (state, userSelf) {
|
|
181
|
+
state.userSelf = userSelf
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const UpdateWebInfor = 'UpdateWebInfor'
|
|
2
|
+
export const UpdateLang = 'UpdateLang'
|
|
3
|
+
export const UpdateConnState = 'UpdateConnState'
|
|
4
|
+
export const UpdateSyncState = 'UpdateSyncState'
|
|
5
|
+
export const UpdateLoading = 'UpdateLoading'
|
|
6
|
+
export const UpdateViewState = 'UpdateViewState'
|
|
7
|
+
export const UpdateTableData = 'UpdateTableData'
|
|
8
|
+
export const UpdateData = 'UpdateData'
|
|
9
|
+
export const UpdateHeightApp = 'UpdateHeightApp'
|
|
10
|
+
export const UpdateHeightAppEff = 'UpdateHeightAppEff'
|
|
11
|
+
export const UpdateHeightToolbar = 'UpdateHeightToolbar'
|
|
12
|
+
export const UpdateMenu = 'UpdateMenu'
|
|
13
|
+
export const UpdateUserToken = 'UpdateUserToken'
|
|
14
|
+
export const UpdateUserSelf = 'UpdateUserSelf'
|
package/srv.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import WOrm from 'w-orm-mongodb/src/WOrmMongodb.mjs'
|
|
2
|
+
import getSettings from './server/getSettings.mjs'
|
|
3
|
+
import WWebApi from './server/WWebApi.mjs'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
//st
|
|
7
|
+
let st = getSettings()
|
|
8
|
+
|
|
9
|
+
let url = `mongodb://${st.dbUsername}:${st.dbPassword}@${st.dbIP}:${st.dbPort}`
|
|
10
|
+
let db = st.dbName
|
|
11
|
+
let opt = {
|
|
12
|
+
|
|
13
|
+
getUserById: null,
|
|
14
|
+
bCheckUser: false,
|
|
15
|
+
bExcludeWhenNotAdmin: false,
|
|
16
|
+
|
|
17
|
+
serverPort: 11005,
|
|
18
|
+
|
|
19
|
+
webName: {
|
|
20
|
+
'eng': 'API Service',
|
|
21
|
+
'cht': 'API管理系統'
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//WWebApi
|
|
27
|
+
WWebApi(url, db, WOrm, opt)
|
|
28
|
+
.catch((err) => {
|
|
29
|
+
console.log(err)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
//node --experimental-modules --es-module-specifier-resolution=node srv.mjs
|
package/tableTags.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"apis":"gertCD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import rollupFiles from 'w-package-tools/src/rollupFiles.mjs'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let fdSrc = './server' //'./src'
|
|
5
|
+
let fdTar = './dist'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
rollupFiles({
|
|
9
|
+
fns: ['WWebApi.mjs'],
|
|
10
|
+
fdSrc,
|
|
11
|
+
fdTar,
|
|
12
|
+
nameDistType: 'kebabCase',
|
|
13
|
+
globals: {
|
|
14
|
+
'@hapi/hapi': '@hapi/hapi',
|
|
15
|
+
'@hapi/inert': '@hapi/inert',
|
|
16
|
+
'path': 'path',
|
|
17
|
+
'fs': 'fs',
|
|
18
|
+
'events': 'events',
|
|
19
|
+
'stream': 'stream',
|
|
20
|
+
// 'form-data': 'FormData',
|
|
21
|
+
'crypto': 'crypto', //因crypto-js修改使用內建crypto方式, 會偵測nodejs並使用require內建的crypto, 故需剔除
|
|
22
|
+
},
|
|
23
|
+
external: [
|
|
24
|
+
'@hapi/hapi',
|
|
25
|
+
'@hapi/inert',
|
|
26
|
+
'path',
|
|
27
|
+
'fs',
|
|
28
|
+
'events',
|
|
29
|
+
'stream',
|
|
30
|
+
// 'form-data',
|
|
31
|
+
'crypto',
|
|
32
|
+
],
|
|
33
|
+
})
|
|
34
|
+
|
package/vue.config.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
lintOnSave: false, //禁止eslint-loader於編譯時檢查語法
|
|
3
|
+
devServer: {
|
|
4
|
+
proxy: {
|
|
5
|
+
'/api': {
|
|
6
|
+
target: 'http://localhost:11005',
|
|
7
|
+
pathRewrite: {
|
|
8
|
+
'^/api': '/api'
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
// transpileDependencies: ['vuetify'],
|
|
14
|
+
//publicPath: process.env.NODE_ENV === 'production' ? '/apimgr/' : '/',
|
|
15
|
+
}
|