w-web-api 1.0.22 → 1.0.24

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 (44) hide show
  1. package/.eslintrc.js +18 -17
  2. package/.github/workflows/ci-test.yml +24 -0
  3. package/.vscode/launch.json +21 -0
  4. package/README.md +21 -4
  5. package/babel.config.js +1 -0
  6. package/dist/css/{chunk-vendors.b4caa718.css → chunk-vendors.ca61ed63.css} +1 -1
  7. package/dist/img/connecting.26511805.svg +10 -0
  8. package/dist/img/deny.e7b81b94.png +0 -0
  9. package/dist/index.tmp +1 -1
  10. package/dist/js/app-legacy.8589a7d0.js +2 -0
  11. package/dist/js/app-legacy.8589a7d0.js.map +1 -0
  12. package/dist/js/app.8589a7d0.js +2 -0
  13. package/dist/js/app.8589a7d0.js.map +1 -0
  14. package/dist/js/chunk-vendors-legacy.4a6f42ee.js +14 -0
  15. package/dist/js/chunk-vendors-legacy.4a6f42ee.js.map +1 -0
  16. package/dist/js/chunk-vendors.4a6f42ee.js +14 -0
  17. package/dist/js/chunk-vendors.4a6f42ee.js.map +1 -0
  18. package/dist/w-web-api.umd.js +2 -2
  19. package/dist/w-web-api.umd.js.map +1 -1
  20. package/docs/WWebApi.html +111 -23
  21. package/docs/WWebApi.mjs.html +152 -30
  22. package/docs/index.html +4 -1
  23. package/docs/scripts/collapse.js +19 -0
  24. package/docs/scripts/commonNav.js +28 -0
  25. package/docs/scripts/search.js +16 -0
  26. package/docs/styles/jsdoc.css +13 -2
  27. package/docs/styles/prettify.css +1 -0
  28. package/g.getSettings.mjs +1 -1
  29. package/package.json +24 -24
  30. package/server/WWebApi.mjs +148 -29
  31. package/src/App.vue +63 -5
  32. package/src/components/Layout.vue +1 -0
  33. package/src/components/LayoutState.vue +87 -0
  34. package/src/main.js +5 -2
  35. package/src/plugins/mUI.mjs +12 -0
  36. package/src/store/mutations.mjs +13 -6
  37. package/srv.mjs +21 -2
  38. package/tableTags-web-api.json +1 -1
  39. package/test/all.test.mjs +10 -0
  40. package/dist/js/app.32beae37.js +0 -2
  41. package/dist/js/app.32beae37.js.map +0 -1
  42. package/dist/js/chunk-vendors.69cb98c3.js +0 -24
  43. package/dist/js/chunk-vendors.69cb98c3.js.map +0 -1
  44. /package/dist/css/{app.5b03c2b6.css → app.e645631b.css} +0 -0
package/.eslintrc.js CHANGED
@@ -1,24 +1,24 @@
1
1
  module.exports = {
2
- "env": {
3
- "browser": true,
4
- "es6": true,
5
- "mocha": true
2
+ 'env': {
3
+ 'browser': true,
4
+ 'es6': true,
5
+ 'mocha': true
6
6
  },
7
- "extends": ["plugin:vue/base", "plugin:vue/essential", "standard"],
8
- "plugins": [
9
- "vue"
7
+ 'extends': ['plugin:vue/base', 'plugin:vue/essential', 'standard'],
8
+ 'plugins': [
9
+ 'vue'
10
10
  ],
11
- "globals": {
12
- "Atomics": "readonly",
13
- "SharedArrayBuffer": "readonly"
11
+ 'globals': {
12
+ 'Atomics': 'readonly',
13
+ 'SharedArrayBuffer': 'readonly'
14
14
  },
15
- "parser": "vue-eslint-parser",
16
- "parserOptions": {
17
- "parser": "babel-eslint",
18
- "ecmaVersion": 2019,
19
- "sourceType": "module",
15
+ 'parser': 'vue-eslint-parser',
16
+ 'parserOptions': {
17
+ 'parser': '@babel/eslint-parser',
18
+ 'ecmaVersion': 2019,
19
+ 'sourceType': 'module',
20
20
  },
21
- rules: {
21
+ 'rules': {
22
22
  'generator-star-spacing': 'off',
23
23
  'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
24
24
  'indent': ['error', 4],
@@ -50,5 +50,6 @@ module.exports = {
50
50
  'prefer-regex-literals': 'off',
51
51
  'array-callback-return': 'off',
52
52
  'no-unreachable-loop': 'off',
53
+ 'vue/multi-word-component-names': 'off',
53
54
  }
54
- };
55
+ }
@@ -0,0 +1,24 @@
1
+ name: Node.js CI
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ strategy:
11
+ matrix:
12
+ node-version: [18.x]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Use Node.js ${{ matrix.node-version }}
17
+ uses: actions/setup-node@v1
18
+ with:
19
+ node-version: ${{ matrix.node-version }}
20
+ - run: npm cache clean -f
21
+ - run: npm install
22
+ - run: npm test
23
+ env:
24
+ CI: true
@@ -0,0 +1,21 @@
1
+ {
2
+ // 使用 IntelliSense 以得知可用的屬性。
3
+ // 暫留以檢視現有屬性的描述。
4
+ // 如需詳細資訊,請瀏覽: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "啟動程式",
11
+ "skipFiles": [
12
+ "<node_internals>/**"
13
+ ],
14
+ "program": "${workspaceFolder}/srv.mjs",
15
+ "runtimeArgs": [
16
+ "--experimental-modules",
17
+ "--es-module-specifier-resolution=node"
18
+ ]
19
+ }
20
+ ]
21
+ }
package/README.md CHANGED
@@ -13,8 +13,6 @@ To view documentation or get support, visit [docs](https://yuda-lyu.github.io/w-
13
13
 
14
14
  ## Installation
15
15
  ### Using npm(ES6 module):
16
- > **Note:** `w-web-api` is mainly dependent on `lodash` and `wsemi`.
17
-
18
16
  ```alias
19
17
  npm i w-web-api
20
18
  ```
@@ -34,8 +32,8 @@ let url = `mongodb://${st.dbUsername}:${st.dbPassword}@${st.dbIP}:${st.dbPort}`
34
32
  let db = st.dbName
35
33
  let opt = {
36
34
 
37
- getUserById: null,
38
35
  bCheckUser: false,
36
+ getUserById: null,
39
37
  bExcludeWhenNotAdmin: false,
40
38
 
41
39
  serverPort: 11005,
@@ -53,8 +51,27 @@ let opt = {
53
51
 
54
52
  }
55
53
 
54
+ let getUserByToken = (token) => {
55
+ console.log('getUserByToken token', token)
56
+ // return {} //測試無法登入條件
57
+ if (token !== 'sys') {
58
+ return {}
59
+ }
60
+ return {
61
+ id: 'id-for-admin',
62
+ name: '測試者',
63
+ email: 'admin@example.com',
64
+ isAdmin: 'y',
65
+ }
66
+ }
67
+
68
+ let verifyUser = (user) => {
69
+ return user.isAdmin === 'y'
70
+ }
71
+
72
+
56
73
  //WWebApi
57
- let instWWebApi = WWebApi(WOrm, url, db, opt)
74
+ let instWWebApi = WWebApi(WOrm, url, db, getUserByToken, verifyUser, opt)
58
75
 
59
76
  instWWebApi.on('error', (err) => {
60
77
  console.log(err)
package/babel.config.js CHANGED
@@ -7,6 +7,7 @@ module.exports = {
7
7
  ],
8
8
  'plugins': [
9
9
  '@babel/plugin-transform-runtime',
10
+ '@babel/plugin-syntax-import-assertions',
10
11
  '@babel/plugin-proposal-export-default-from',
11
12
  '@babel/plugin-proposal-nullish-coalescing-operator',
12
13
  '@babel/plugin-proposal-optional-chaining'