@mongoosejs/studio 0.0.12 → 0.0.13

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.
@@ -36,5 +36,5 @@ module.exports = ({ db }) => async function getDocument(params) {
36
36
  }
37
37
  removeSpecifiedPaths(schemaPaths, '.$*');
38
38
 
39
- return { doc: doc.toJSON({ virtuals: false, getters: false, transform: false }), schemaPaths };
39
+ return { doc: doc.toJSON({ virtuals: true, getters: false, transform: false }), schemaPaths };
40
40
  };
@@ -38,8 +38,8 @@
38
38
  </component>
39
39
  </div>
40
40
  <div v-else>
41
- <component :is="getComponentForPath(path)" :value="document[path.path]"></component>
41
+ <component :is="getComponentForPath(path)" :value="getValueForPath(path.path)"></component>
42
42
  </div>
43
43
  </div>
44
44
  </div>
45
- </div>
45
+ </div>
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const api = require('../api');
4
+ const mpath = require('mpath');
4
5
  const template = require('./document.html');
5
6
  const vanillatoast = require('vanillatoasts');
6
7
 
@@ -52,8 +53,11 @@ module.exports = app => app.component('document', {
52
53
  }
53
54
  return 'edit-default';
54
55
  },
56
+ getValueForPath(path) {
57
+ return mpath.get(path, this.document);
58
+ },
55
59
  getEditValueForPath({ path }) {
56
- return path in this.changes ? this.changes[path] : this.document[path];
60
+ return path in this.changes ? this.changes[path] : mpath.get(path, this.document);
57
61
  },
58
62
  cancelEdit() {
59
63
  this.changes = {};
@@ -87,4 +91,4 @@ module.exports = app => app.component('document', {
87
91
  }
88
92
  }
89
93
  }
90
- });
94
+ });
@@ -16,6 +16,7 @@ require('./edit-date/edit-date')(app);
16
16
  require('./export-query-results/export-query-results')(app);
17
17
  require('./list-array/list-array')(app);
18
18
  require('./list-default/list-default')(app);
19
+ require('./list-mixed/list-mixed')(app);
19
20
  require('./list-string/list-string')(app);
20
21
  require('./list-subdocument/list-subdocument')(app);
21
22
  require('./modal/modal')(app);
@@ -1,8 +1,8 @@
1
1
  .list-array pre {
2
2
  max-height: 6.5em;
3
- max-width: 60em;
3
+ max-width: 30em;
4
4
  }
5
5
 
6
6
  .list-array pre.maximized {
7
7
  max-height: auto;
8
- }
8
+ }
@@ -9,15 +9,10 @@ module.exports = app => app.component('list-array', {
9
9
  props: ['value'],
10
10
  computed: {
11
11
  displayValue() {
12
- return JSON.stringify(this.value, (key, value) => {
13
- if (typeof value === 'string' && value.length > 30) {
14
- return value.slice(0, 27) + '...';
15
- }
16
- return value;
17
- }, ' ').trim();
12
+ return this.value;
18
13
  }
19
14
  },
20
15
  mounted() {
21
16
  Prism.highlightElement(this.$refs.code);
22
17
  }
23
- });
18
+ });
@@ -0,0 +1,4 @@
1
+ .list-default pre {
2
+ max-height: 6.5em;
3
+ max-width: 30em;
4
+ }
@@ -1,7 +1,7 @@
1
- <div ref="itemData" class="tooltip">
1
+ <div class="list-default" ref="itemData" class="tooltip">
2
2
  {{displayValue}}
3
3
  <div class="tooltiptext" style="display:flex; width: 100%; justify-content: space-around; align-items: center; min-width: 180px;">
4
4
  <div class="tooltiptextchild" v-if="allude" @click.stop="goToDoc(value)">View Document</div>
5
5
  <div class="tooltiptextchild" @click.stop="copyText(value)">copy &#x1F4CB;</div>
6
6
  </div>
7
- </div>
7
+ </div>
@@ -39,6 +39,9 @@ module.exports = app => app.component('list-default', {
39
39
  if (this.value === undefined) {
40
40
  return 'undefined';
41
41
  }
42
+ if (this.value.length > 30) {
43
+ return this.value.substring(0,30) + '...';
44
+ }
42
45
  return this.value;
43
46
  },
44
47
  hasReference() {
@@ -0,0 +1,5 @@
1
+ .list-mixed pre {
2
+ max-height: 6.5em;
3
+ max-width: 30em;
4
+ }
5
+
@@ -0,0 +1,4 @@
1
+ <div class="list-mixed">
2
+ <pre><code ref="MixedCode" class="language-javascript">{{shortenValue}}</code></pre>
3
+ </div>
4
+
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const api = require('../api');
4
+ const template = require('./list-mixed.html');
5
+
6
+ require('../appendCSS')(require('./list-mixed.css'));
7
+
8
+ module.exports = app => app.component('list-mixed', {
9
+ template: template,
10
+ props: ['value'],
11
+ computed: {
12
+ shortenValue() {
13
+ return this.value;
14
+ }
15
+ },
16
+ mounted: function() {
17
+ Prism.highlightElement(this.$refs.MixedCode);
18
+ }
19
+ });
@@ -0,0 +1,4 @@
1
+ .list-subdocument pre {
2
+ max-height: 6.5em;
3
+ max-width: 30em;
4
+ }
@@ -1,3 +1,3 @@
1
- <div>
2
- <pre><code ref="SubDocCode" class="language-javascript">{{value}}</code></pre>
3
- </div>
1
+ <div class="list-subdocument">
2
+ <pre><code ref="SubDocCode" class="language-javascript">{{shortenValue}}</code></pre>
3
+ </div>
@@ -3,10 +3,17 @@
3
3
  const api = require('../api');
4
4
  const template = require('./list-subdocument.html');
5
5
 
6
+ require('../appendCSS')(require('./list-subdocument.css'));
7
+
6
8
  module.exports = app => app.component('list-subdocument', {
7
9
  template: template,
8
10
  props: ['value'],
11
+ computed: {
12
+ shortenValue() {
13
+ return this.value;
14
+ }
15
+ },
9
16
  mounted: function() {
10
17
  Prism.highlightElement(this.$refs.SubDocCode);
11
18
  }
12
- });
19
+ });
@@ -154,6 +154,9 @@ module.exports = app => app.component('models', {
154
154
  if (schemaPath.instance == 'Embedded') {
155
155
  return 'list-subdocument';
156
156
  }
157
+ if (schemaPath.instance == 'Mixed') {
158
+ return 'list-mixed';
159
+ }
157
160
  return 'list-default';
158
161
  },
159
162
  getReferenceModel(schemaPath) {
package/osogolf.js ADDED
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ const db = require('../../voltmobile/core-api/backend/db');
4
+ const express = require('express');
5
+ const studio = require('./express');
6
+
7
+ run().catch(err => {
8
+ console.error(err);
9
+ process.exit(-1);
10
+ });
11
+
12
+ async function run() {
13
+ const app = express();
14
+ const conn = await db();
15
+
16
+ app.use('/studio', studio('/studio/api', conn));
17
+
18
+ await app.listen(3002);
19
+ console.log('Listening on port 3002');
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "dependencies": {
5
5
  "archetype": "0.13.0",
6
6
  "csv-stringify": "6.3.0",