expressa 1.1.0 → 1.2.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 (49) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/README.md +4 -3
  3. package/controllers/collections.js +53 -32
  4. package/controllers/status.js +2 -1
  5. package/db/cached.js +3 -0
  6. package/db/file.js +3 -0
  7. package/db/memory.js +3 -0
  8. package/db/mongo.js +7 -8
  9. package/db/postgres.js +13 -0
  10. package/index.js +3 -1
  11. package/listeners_validation.js +4 -0
  12. package/modules/admin/dist/index.html +1 -1
  13. package/modules/admin/dist/static/css/chunk-318c.ffb0d81e.css +1 -0
  14. package/modules/admin/dist/static/css/chunk-621e.97323951.css +1 -0
  15. package/modules/admin/dist/static/css/{chunk-e80a.5ee55031.css → chunk-6644.69ccf1a7.css} +1 -1
  16. package/modules/admin/dist/static/css/chunk-e375.1d849865.css +1 -0
  17. package/modules/admin/dist/static/css/{chunk-759b.3a895a1e.css → chunk-f075.3a895a1e.css} +0 -0
  18. package/modules/admin/dist/static/css/chunk-libs.327ad89e.css +14 -0
  19. package/modules/admin/dist/static/js/{app.17447107.js → app.03e8afa3.js} +1 -1
  20. package/modules/admin/dist/static/js/chunk-318c.03fa0032.js +1 -0
  21. package/modules/admin/dist/static/js/chunk-621e.a9ed86e2.js +1 -0
  22. package/modules/admin/dist/static/js/chunk-6644.9c6f5c7b.js +1 -0
  23. package/modules/admin/dist/static/js/chunk-8bab.7052832d.js +2 -0
  24. package/modules/admin/dist/static/js/{chunk-23bd.5fa24c85.js.LICENSE.txt → chunk-8bab.7052832d.js.LICENSE.txt} +1 -1
  25. package/modules/admin/dist/static/js/chunk-e375.089d85cd.js +1 -0
  26. package/modules/admin/dist/static/js/chunk-f075.315ceec1.js +1 -0
  27. package/modules/admin/dist/static/js/chunk-libs.06c38828.js +2 -0
  28. package/modules/admin/dist/static/js/{chunk-libs.b6f27cfe.js.LICENSE.txt → chunk-libs.06c38828.js.LICENSE.txt} +1 -1
  29. package/modules/admin/package.json +3 -3
  30. package/modules/admin/src/components/JSONEditor.vue +22 -9
  31. package/modules/admin/src/main.js +2 -2
  32. package/modules/admin/src/router/index.js +185 -185
  33. package/modules/admin/src/views/ListDocuments2.vue +309 -309
  34. package/package.json +1 -1
  35. package/test/collections.js +2 -3
  36. package/test/collections.querying.js +18 -4
  37. package/test/test.js +4 -0
  38. package/util.js +19 -0
  39. package/modules/admin/dist/static/css/chunk-0884.40d0b632.css +0 -1
  40. package/modules/admin/dist/static/css/chunk-34ab.f9393b1e.css +0 -1
  41. package/modules/admin/dist/static/css/chunk-7869.220d4af5.css +0 -1
  42. package/modules/admin/dist/static/css/chunk-libs.68e8d170.css +0 -14
  43. package/modules/admin/dist/static/js/chunk-0884.5ca2b4c5.js +0 -1
  44. package/modules/admin/dist/static/js/chunk-23bd.5fa24c85.js +0 -2
  45. package/modules/admin/dist/static/js/chunk-34ab.06400cb6.js +0 -1
  46. package/modules/admin/dist/static/js/chunk-759b.89a889b6.js +0 -1
  47. package/modules/admin/dist/static/js/chunk-7869.b7ab2c47.js +0 -1
  48. package/modules/admin/dist/static/js/chunk-e80a.cc0d79f4.js +0 -1
  49. package/modules/admin/dist/static/js/chunk-libs.b6f27cfe.js +0 -2
@@ -8,7 +8,7 @@ object-assign
8
8
  * @license MIT */
9
9
 
10
10
  /*!
11
- * Bootstrap v4.6.0 (https://getbootstrap.com/)
11
+ * Bootstrap v4.6.1 (https://getbootstrap.com/)
12
12
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
13
13
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
14
14
  */
@@ -52,10 +52,10 @@
52
52
  "eslint": "^7.0.0",
53
53
  "eslint-friendly-formatter": "^4.0.1",
54
54
  "eslint-loader": "^4.0.2",
55
- "eslint-plugin-vue": "^6.2.2",
55
+ "eslint-plugin-vue": "^7.0.0",
56
56
  "file-loader": "1.1.11",
57
57
  "friendly-errors-webpack-plugin": "1.7.0",
58
- "html-webpack-plugin": "4.0.0-alpha",
58
+ "html-webpack-plugin": "^4.0.0",
59
59
  "mini-css-extract-plugin": "0.4.1",
60
60
  "node-notifier": "5.2.1",
61
61
  "node-sass": "^6.0.1",
@@ -68,7 +68,7 @@
68
68
  "postcss-url": "7.3.2",
69
69
  "rimraf": "2.6.2",
70
70
  "sass-loader": "7.0.3",
71
- "script-ext-html-webpack-plugin": "2.0.1",
71
+ "script-ext-html-webpack-plugin": "^2.1.5",
72
72
  "semver": "5.5.0",
73
73
  "shelljs": "0.8.2",
74
74
  "svg-sprite-loader": "3.8.0",
@@ -55,6 +55,14 @@ export default {
55
55
  }
56
56
  this.$emit('input', this.editor.getValue())
57
57
  })
58
+
59
+ const makeEditJsonTextAreaExpandable = () => {
60
+ const textarea = document.querySelector('.je-modal .je-edit-json--textarea')
61
+ textarea.classList.remove('je-edit-json--textarea') // INFO: Had to remove this class to remove height and width property
62
+ textarea.classList.add('expandable-textarea')
63
+ }
64
+
65
+ makeEditJsonTextAreaExpandable()
58
66
  },
59
67
  onSave() {
60
68
  this.$emit('json-save', this.json)
@@ -71,15 +79,8 @@ if (JSONEditor) {
71
79
  // If no valid editor is returned, the next resolver function will be used
72
80
  })
73
81
 
74
- JSONEditor.defaults.callbacks.template = {
75
- 'deleteProfilePic': (jseditor, e) => {
76
- alert('hey')
77
- }
78
- }
79
-
80
82
  JSONEditor.defaults.editors.schema = class schema extends JSONEditor.AbstractEditor {
81
83
  setValue(value, initial) {
82
- console.log(this)
83
84
  this.value = value
84
85
  this.schemaeditor.setValue(value)
85
86
  this.onChange()
@@ -150,8 +151,20 @@ if (JSONEditor) {
150
151
  </script>
151
152
 
152
153
  <style>
153
- h3 textarea {
154
- resize: both;
154
+ .expandable-textarea {
155
+ display: block;
156
+ min-height: 250px;
157
+ min-width: 250px;
158
+ resize: both !important;
159
+ }
160
+ .jsoneditor-vue img {
161
+ border: 1px solid #ddd;
162
+ border-radius: 4px;
163
+ padding: 5px;
164
+ width: 150px;
165
+ }
166
+ .jsoneditor-vue img:hover {
167
+ box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
155
168
  }
156
169
  .jsoneditor-vue button.btn {
157
170
  font-size: 14px !important;
@@ -23,9 +23,9 @@ import '@/permission' // permission control
23
23
  import { VuePlugin } from 'vuera'
24
24
 
25
25
  import Unicon from 'vue-unicons/dist/vue-unicons-vue2.umd'
26
- import { uniDatabase, uniHome, uniHomeAlt, uniUsersAlt, uniShieldCheck, uniBookOpen, uniDiary, uniFlask, uniCog, uniPlus } from 'vue-unicons/dist/icons'
26
+ import { uniDatabase, uniHome, uniUsersAlt, uniShieldCheck, uniBookOpen, uniDiary, uniFlask, uniCog, uniPlus, uniLink } from 'vue-unicons/dist/icons'
27
27
 
28
- Unicon.add([uniDatabase, uniHome, uniHomeAlt, uniUsersAlt, uniShieldCheck, uniBookOpen, uniDiary, uniFlask, uniCog, uniPlus])
28
+ Unicon.add([uniDatabase, uniHome, uniUsersAlt, uniShieldCheck, uniBookOpen, uniDiary, uniFlask, uniCog, uniPlus, uniLink])
29
29
  Vue.use(Unicon)
30
30
 
31
31
  Vue.use(ElementUI, { locale })
@@ -1,185 +1,185 @@
1
- import Vue from 'vue'
2
- import Router from 'vue-router'
3
-
4
- // in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
5
- // detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
6
-
7
- Vue.use(Router)
8
-
9
- /* Layout */
10
- import Layout from '../views/layout/Layout'
11
-
12
- const capitalize = (s) => {
13
- if (typeof s !== 'string') return ''
14
- return s.charAt(0).toUpperCase() + s.slice(1)
15
- }
16
-
17
- /**
18
- * hidden: true if `hidden:true` will not show in the sidebar(default is false)
19
- * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
20
- * if not set alwaysShow, only more than one route under the children
21
- * it will becomes nested mode, otherwise not show the root menu
22
- * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb
23
- * name:'router-name' the name is used by <keep-alive> (must set!!!)
24
- * meta : {
25
- title: 'title' the name show in submenu and breadcrumb (recommend set)
26
- icon: 'svg-name' the icon show in the sidebar,
27
- }
28
- **/
29
-
30
- export const constantRouterMap = [
31
- { path: '/login', component: () => import('@/views/login/index'), hidden: true },
32
- { path: '/install', component: () => import('@/views/Install'), hidden: true },
33
- { path: '/404', component: () => import('@/views/404'), hidden: true },
34
-
35
- {
36
- path: '/',
37
- component: Layout,
38
- redirect: '/home',
39
- name: 'Home',
40
- meta: { title: 'Home', icon: 'home-alt' },
41
- children: [{
42
- path: 'home',
43
- meta: { title: 'Home', icon: 'home-alt' },
44
- component: () => import('@/views/Home')
45
- }, {
46
- path: '/edit/:collectionName/:id',
47
- component: () => import('@/views/EditDocument'),
48
- hidden: true
49
- }]
50
- },
51
-
52
- {
53
- path: '/users',
54
- redirect: '/users/list',
55
- component: Layout,
56
- name: 'Users',
57
- meta: { title: 'People', icon: 'users-alt' },
58
- children: [{
59
- path: 'list',
60
- meta: { title: 'Users', icon: 'users-alt' },
61
- name: 'users2',
62
- component: () => import('@/views/ListDocuments2'),
63
- props: { collectionName: 'users' },
64
- }, {
65
- path: 'add',
66
- meta: { title: 'Add User', icon: 'plus' },
67
- name: 'newuser',
68
- component: () => import('@/views/EditDocument'),
69
- props: { collectionName: 'users', id: 'create' },
70
- }, {
71
- path: 'role',
72
- meta: { title: 'Roles', icon: 'shield-check' },
73
- name: 'role',
74
- component: () => import('@/views/ListDocuments2'),
75
- props: { collectionName: 'role' },
76
- }, {
77
- path: 'addrole',
78
- meta: { title: 'Add Role', icon: 'plus' },
79
- name: 'newrole',
80
- component: () => import('@/views/EditDocument'),
81
- props: { collectionName: 'role', id: 'create' },
82
- }],
83
- },
84
-
85
- {
86
- path: '/list/:collectionName',
87
- component: Layout,
88
- hidden: true,
89
- name: 'Data',
90
- meta: { title: 'Data', icon: 'database' },
91
- children: [{
92
- path: '',
93
- name: ':collectionName',
94
- component: () => import('@/views/ListDocuments2'),
95
- props: route => ({ collectionName: route.params.collectionName }),
96
- meta: { title: capitalize(name) }
97
- }]
98
- },
99
-
100
- {
101
- path: '/manage/permissions',
102
- component: Layout,
103
- name: 'permissions',
104
- meta: { title: 'Manage' },
105
- children: [
106
- {
107
- path: '',
108
- name: 'permissions',
109
- component: () => import('@/views/ManagePermissions'),
110
- meta: { title: 'Permissions' }
111
- }
112
- ]
113
- },
114
-
115
- {
116
- path: '/dev',
117
- component: Layout,
118
- meta: { title: 'Dev', icon: 'flask' },
119
- name: 'Dev',
120
- children: [
121
- {
122
- path: '',
123
- name: '',
124
- component: () => import('@/views/Dev'),
125
- meta: { title: '' },
126
- hidden: true,
127
- },
128
- {
129
- path: 'listeners',
130
- name: 'listeners',
131
- component: () => import('@/views/ManageListeners'),
132
- meta: { title: 'Listeners' }
133
- },
134
- {
135
- path: 'middleware',
136
- name: 'middleware',
137
- component: () => import('@/views/ManageMiddleware'),
138
- meta: { title: 'Middleware' }
139
- }, {
140
- path: 'requestlogs',
141
- meta: { title: 'Request Logs', icon: 'diary' },
142
- name: 'requestlogs',
143
- component: () => import('@/views/ListDocuments2'),
144
- props: { collectionName: 'requestlog', columns: ['method', 'url', 'req.ip', 'user', 'res.message', 'res.statusCode', 'res.headers.content-length'] },
145
- }, {
146
- path: 'viewrequest/:requestId',
147
- hidden: true,
148
- meta: { title: 'View Request', icon: 'diary' },
149
- name: 'viewrequest',
150
- component: () => import('@/views/ViewRequest'),
151
- }, {
152
- path: '/edit/collection',
153
- component: Layout,
154
- name: 'Schema',
155
- hidden: true,
156
- meta: { title: 'Schemas', icon: 'cog' },
157
- children: [{
158
- hidden: true,
159
- path: '/:collectionName',
160
- name: name,
161
- meta: { title: capitalize(name) }
162
- }]
163
- },
164
- ]
165
- },
166
-
167
- {
168
- path: 'external-link',
169
- component: Layout,
170
- children: [
171
- {
172
- path: 'https://github.com/thomas4019/expressa',
173
- meta: { title: 'Expressa Docs', icon: 'link' }
174
- }
175
- ]
176
- },
177
-
178
- { path: '*', redirect: '/404', hidden: true }
179
- ]
180
-
181
- export default new Router({
182
- // mode: 'history',
183
- scrollBehavior: () => ({ y: 0 }),
184
- routes: constantRouterMap
185
- })
1
+ import Vue from 'vue'
2
+ import Router from 'vue-router'
3
+
4
+ // in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
5
+ // detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
6
+
7
+ Vue.use(Router)
8
+
9
+ /* Layout */
10
+ import Layout from '../views/layout/Layout'
11
+
12
+ const capitalize = (s) => {
13
+ if (typeof s !== 'string') return ''
14
+ return s.charAt(0).toUpperCase() + s.slice(1)
15
+ }
16
+
17
+ /**
18
+ * hidden: true if `hidden:true` will not show in the sidebar(default is false)
19
+ * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
20
+ * if not set alwaysShow, only more than one route under the children
21
+ * it will becomes nested mode, otherwise not show the root menu
22
+ * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb
23
+ * name:'router-name' the name is used by <keep-alive> (must set!!!)
24
+ * meta : {
25
+ title: 'title' the name show in submenu and breadcrumb (recommend set)
26
+ icon: 'svg-name' the icon show in the sidebar,
27
+ }
28
+ **/
29
+
30
+ export const constantRouterMap = [
31
+ { path: '/login', component: () => import('@/views/login/index'), hidden: true },
32
+ { path: '/install', component: () => import('@/views/Install'), hidden: true },
33
+ { path: '/404', component: () => import('@/views/404'), hidden: true },
34
+
35
+ {
36
+ path: '/',
37
+ component: Layout,
38
+ redirect: '/home',
39
+ name: 'Home',
40
+ meta: { title: 'Home', icon: 'home' },
41
+ children: [{
42
+ path: 'home',
43
+ meta: { title: 'Home', icon: 'home' },
44
+ component: () => import('@/views/Home')
45
+ }, {
46
+ path: '/edit/:collectionName/:id',
47
+ component: () => import('@/views/EditDocument'),
48
+ hidden: true
49
+ }]
50
+ },
51
+
52
+ {
53
+ path: '/users',
54
+ redirect: '/users/list',
55
+ component: Layout,
56
+ name: 'Users',
57
+ meta: { title: 'People', icon: 'users-alt' },
58
+ children: [{
59
+ path: 'list',
60
+ meta: { title: 'Users', icon: 'users-alt' },
61
+ name: 'users2',
62
+ component: () => import('@/views/ListDocuments2'),
63
+ props: { collectionName: 'users' },
64
+ }, {
65
+ path: 'add',
66
+ meta: { title: 'Add User', icon: 'plus' },
67
+ name: 'newuser',
68
+ component: () => import('@/views/EditDocument'),
69
+ props: { collectionName: 'users', id: 'create' },
70
+ }, {
71
+ path: 'role',
72
+ meta: { title: 'Roles', icon: 'shield-check' },
73
+ name: 'role',
74
+ component: () => import('@/views/ListDocuments2'),
75
+ props: { collectionName: 'role' },
76
+ }, {
77
+ path: 'addrole',
78
+ meta: { title: 'Add Role', icon: 'plus' },
79
+ name: 'newrole',
80
+ component: () => import('@/views/EditDocument'),
81
+ props: { collectionName: 'role', id: 'create' },
82
+ }],
83
+ },
84
+
85
+ {
86
+ path: '/list/:collectionName',
87
+ component: Layout,
88
+ hidden: true,
89
+ name: 'Data',
90
+ meta: { title: 'Data', icon: 'database' },
91
+ children: [{
92
+ path: '',
93
+ name: ':collectionName',
94
+ component: () => import('@/views/ListDocuments2'),
95
+ props: route => ({ collectionName: route.params.collectionName }),
96
+ meta: { title: capitalize(name) }
97
+ }]
98
+ },
99
+
100
+ {
101
+ path: '/manage/permissions',
102
+ component: Layout,
103
+ name: 'permissions',
104
+ meta: { title: 'Manage', icon: 'shield-check' },
105
+ children: [
106
+ {
107
+ path: '',
108
+ name: 'permissions',
109
+ component: () => import('@/views/ManagePermissions'),
110
+ meta: { title: 'Permissions' }
111
+ }
112
+ ]
113
+ },
114
+
115
+ {
116
+ path: '/dev',
117
+ component: Layout,
118
+ meta: { title: 'Dev', icon: 'flask' },
119
+ name: 'Dev',
120
+ children: [
121
+ {
122
+ path: '',
123
+ name: '',
124
+ component: () => import('@/views/Dev'),
125
+ meta: { title: '' },
126
+ hidden: true,
127
+ },
128
+ {
129
+ path: 'listeners',
130
+ name: 'listeners',
131
+ component: () => import('@/views/ManageListeners'),
132
+ meta: { title: 'Listeners' }
133
+ },
134
+ {
135
+ path: 'middleware',
136
+ name: 'middleware',
137
+ component: () => import('@/views/ManageMiddleware'),
138
+ meta: { title: 'Middleware' }
139
+ }, {
140
+ path: 'requestlogs',
141
+ meta: { title: 'Request Logs', icon: 'diary' },
142
+ name: 'requestlogs',
143
+ component: () => import('@/views/ListDocuments2'),
144
+ props: { collectionName: 'requestlog', columns: ['method', 'url', 'req.ip', 'user', 'res.message', 'res.statusCode', 'res.headers.content-length'] },
145
+ }, {
146
+ path: 'viewrequest/:requestId',
147
+ hidden: true,
148
+ meta: { title: 'View Request', icon: 'diary' },
149
+ name: 'viewrequest',
150
+ component: () => import('@/views/ViewRequest'),
151
+ }, {
152
+ path: '/edit/collection',
153
+ component: Layout,
154
+ name: 'Schema',
155
+ hidden: true,
156
+ meta: { title: 'Schemas', icon: 'cog' },
157
+ children: [{
158
+ hidden: true,
159
+ path: '/:collectionName',
160
+ name: name,
161
+ meta: { title: capitalize(name) }
162
+ }]
163
+ },
164
+ ]
165
+ },
166
+
167
+ {
168
+ path: 'external-link',
169
+ component: Layout,
170
+ children: [
171
+ {
172
+ path: 'https://github.com/thomas4019/expressa',
173
+ meta: { title: 'Expressa Docs', icon: 'link' }
174
+ }
175
+ ]
176
+ },
177
+
178
+ { path: '*', redirect: '/404', hidden: true }
179
+ ]
180
+
181
+ export default new Router({
182
+ // mode: 'history',
183
+ scrollBehavior: () => ({ y: 0 }),
184
+ routes: constantRouterMap
185
+ })