@mongoosejs/studio 0.0.90 → 0.0.92

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.
@@ -1,9 +1,17 @@
1
1
  'use strict';
2
2
 
3
+ const Archetype = require('archetype');
3
4
  const authorize = require('../../authorize');
4
5
 
5
- module.exports = ({ db }) => async function getDashboards(roles) {
6
+ const GetDashboardParams = new Archetype({
7
+ roles: {
8
+ $type: ['string']
9
+ }
10
+ }).compile('GetDashboardParams');
11
+
12
+ module.exports = ({ db }) => async function getDashboards(params) {
6
13
  const Dashboard = db.model('__Studio_Dashboard');
14
+ const { roles } = new GetDashboardParams(params);
7
15
 
8
16
  await authorize('Dashboard.getDashboards', roles);
9
17
 
@@ -27,7 +27,7 @@ module.exports = ({ db }) => async function getIndexes(params) {
27
27
  throw new Error(`Model ${model} not found`);
28
28
  }
29
29
 
30
- await Model.dropIndex(name);
30
+ await Model.collection.dropIndex(name);
31
31
 
32
32
  const mongoDBIndexes = await Model.listIndexes();
33
33
  return {
@@ -3,6 +3,7 @@
3
3
  exports.createDocument = require('./createDocument')
4
4
  exports.deleteDocument = require('./deleteDocument');
5
5
  exports.deleteDocuments = require('./deleteDocuments');
6
+ exports.dropIndex = require('./dropIndex');
6
7
  exports.exportQueryResults = require('./exportQueryResults');
7
8
  exports.getDocument = require('./getDocument');
8
9
  exports.getDocuments = require('./getDocuments');
@@ -121,6 +121,12 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
121
121
  getDocuments: function getDocuments(params) {
122
122
  return client.post('', { action: 'Model.getDocuments', ...params }).then(res => res.data);
123
123
  },
124
+ getIndexes: function getIndexes(params) {
125
+ return client.post('', { action: 'Model.getIndexes', ...params }).then(res => res.data);
126
+ },
127
+ dropIndex: function dropIndex(params) {
128
+ return client.post('', { action: 'Model.dropIndex', ...params }).then(res => res.data);
129
+ },
124
130
  listModels: function listModels() {
125
131
  return client.post('', { action: 'Model.listModels' }).then(res => res.data);
126
132
  },
@@ -220,6 +226,9 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
220
226
  getIndexes: function getIndexes(params) {
221
227
  return client.post('/Model/getIndexes', params).then(res => res.data);
222
228
  },
229
+ dropIndex: function dropIndex(params) {
230
+ return client.post('/Model/dropIndex', params).then(res => res.data);
231
+ },
223
232
  listModels: function listModels() {
224
233
  return client.post('/Model/listModels', {}).then(res => res.data);
225
234
  },
@@ -2294,7 +2303,7 @@ module.exports = app => app.component('models', {
2294
2303
  },
2295
2304
  methods: {
2296
2305
  async dropIndex(name) {
2297
- const { mongoDBIndexes } = await api.Model.dropIndex({ model: this.currentModel, index: name });
2306
+ const { mongoDBIndexes } = await api.Model.dropIndex({ model: this.currentModel, name });
2298
2307
  this.mongoDBIndexes = mongoDBIndexes;
2299
2308
  },
2300
2309
  initFilter(ev) {
@@ -111,6 +111,12 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
111
111
  getDocuments: function getDocuments(params) {
112
112
  return client.post('', { action: 'Model.getDocuments', ...params }).then(res => res.data);
113
113
  },
114
+ getIndexes: function getIndexes(params) {
115
+ return client.post('', { action: 'Model.getIndexes', ...params }).then(res => res.data);
116
+ },
117
+ dropIndex: function dropIndex(params) {
118
+ return client.post('', { action: 'Model.dropIndex', ...params }).then(res => res.data);
119
+ },
114
120
  listModels: function listModels() {
115
121
  return client.post('', { action: 'Model.listModels' }).then(res => res.data);
116
122
  },
@@ -210,6 +216,9 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
210
216
  getIndexes: function getIndexes(params) {
211
217
  return client.post('/Model/getIndexes', params).then(res => res.data);
212
218
  },
219
+ dropIndex: function dropIndex(params) {
220
+ return client.post('/Model/dropIndex', params).then(res => res.data);
221
+ },
213
222
  listModels: function listModels() {
214
223
  return client.post('/Model/listModels', {}).then(res => res.data);
215
224
  },
@@ -94,7 +94,7 @@ module.exports = app => app.component('models', {
94
94
  },
95
95
  methods: {
96
96
  async dropIndex(name) {
97
- const { mongoDBIndexes } = await api.Model.dropIndex({ model: this.currentModel, index: name });
97
+ const { mongoDBIndexes } = await api.Model.dropIndex({ model: this.currentModel, name });
98
98
  this.mongoDBIndexes = mongoDBIndexes;
99
99
  },
100
100
  initFilter(ev) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.90",
3
+ "version": "0.0.92",
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": {