@mongoosejs/studio 0.0.92 → 0.0.94

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.
@@ -21,7 +21,7 @@ const ExecuteScriptParams = new Archetype({
21
21
  }).compile('ExecuteScriptParams');
22
22
 
23
23
  module.exports = ({ db, studioConnection }) => async function executeScript(params) {
24
- const { userId, chatMessageId, script } = new ExecuteScriptParams(params);
24
+ const { userId, chatMessageId, script, roles } = new ExecuteScriptParams(params);
25
25
  const ChatMessage = studioConnection.model('__Studio_ChatMessage');
26
26
 
27
27
  await authorize('ChatMessage.executeScript', roles);
package/express.js CHANGED
@@ -63,9 +63,10 @@ module.exports = async function(apiUrl, conn, options) {
63
63
  if (!user || !roles) {
64
64
  throw new Error('Not authorized');
65
65
  }
66
- req.params.authorization = authorization;
67
- req.params.initiatedById = user._id;
68
- req.params.roles = roles;
66
+ req._internals = req._internals || {};
67
+ req._internals.authorization = authorization;
68
+ req._internals.initiatedById = user._id;
69
+ req._internals.roles = roles;
69
70
 
70
71
  next();
71
72
  })
@@ -1013,16 +1013,21 @@ module.exports = app => app.component('edit-dashboard', {
1013
1013
  },
1014
1014
  async updateCode() {
1015
1015
  this.status = 'loading';
1016
- const { doc, result, error } = await api.Dashboard.updateDashboard({
1017
- dashboardId: this.dashboardId,
1018
- code: this.editor.getValue(),
1019
- title: this.title,
1020
- description: this.description
1021
- });
1022
- this.$emit('update', { doc, result, error });
1023
- this.editor.setValue(doc.code);
1024
- this.status = 'loaded';
1025
- this.closeEditor();
1016
+ try {
1017
+ const { doc, result, error } = await api.Dashboard.updateDashboard({
1018
+ dashboardId: this.dashboardId,
1019
+ code: this.editor.getValue(),
1020
+ title: this.title,
1021
+ description: this.description
1022
+ });
1023
+ this.$emit('update', { doc, result, error });
1024
+ this.editor.setValue(doc.code);
1025
+ this.closeEditor();
1026
+ } catch (err) {
1027
+ this.$emit('update', { error: { message: err.message } });
1028
+ } finally {
1029
+ this.status = 'loaded';
1030
+ }
1026
1031
  }
1027
1032
  },
1028
1033
  mounted: async function() {
@@ -1809,7 +1814,9 @@ app.component('app-component', {
1809
1814
  window.state = this;
1810
1815
 
1811
1816
  if (mothership.hasAPIKey) {
1812
- const hashParams = new URLSearchParams(window.location.hash.replace(/^#?\/?\??/, '') || '');
1817
+ const hash = window.location.hash.replace(/^#?\/?\??/, '') || '';
1818
+ const hashQuery = hash.split('?')[1] || '';
1819
+ const hashParams = new URLSearchParams(hashQuery);
1813
1820
  if (hashParams.has('code')) {
1814
1821
  const code = hashParams.get('code');
1815
1822
  const provider = hashParams.get('provider');
@@ -20,16 +20,21 @@ module.exports = app => app.component('edit-dashboard', {
20
20
  },
21
21
  async updateCode() {
22
22
  this.status = 'loading';
23
- const { doc, result, error } = await api.Dashboard.updateDashboard({
24
- dashboardId: this.dashboardId,
25
- code: this.editor.getValue(),
26
- title: this.title,
27
- description: this.description
28
- });
29
- this.$emit('update', { doc, result, error });
30
- this.editor.setValue(doc.code);
31
- this.status = 'loaded';
32
- this.closeEditor();
23
+ try {
24
+ const { doc, result, error } = await api.Dashboard.updateDashboard({
25
+ dashboardId: this.dashboardId,
26
+ code: this.editor.getValue(),
27
+ title: this.title,
28
+ description: this.description
29
+ });
30
+ this.$emit('update', { doc, result, error });
31
+ this.editor.setValue(doc.code);
32
+ this.closeEditor();
33
+ } catch (err) {
34
+ this.$emit('update', { error: { message: err.message } });
35
+ } finally {
36
+ this.status = 'loaded';
37
+ }
33
38
  }
34
39
  },
35
40
  mounted: async function() {
@@ -67,7 +67,9 @@ app.component('app-component', {
67
67
  window.state = this;
68
68
 
69
69
  if (mothership.hasAPIKey) {
70
- const hashParams = new URLSearchParams(window.location.hash.replace(/^#?\/?\??/, '') || '');
70
+ const hash = window.location.hash.replace(/^#?\/?\??/, '') || '';
71
+ const hashQuery = hash.split('?')[1] || '';
72
+ const hashParams = new URLSearchParams(hashQuery);
71
73
  if (hashParams.has('code')) {
72
74
  const code = hashParams.get('code');
73
75
  const provider = hashParams.get('provider');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.",
5
5
  "homepage": "https://studio.mongoosejs.io/",
6
6
  "repository": {