@mongoosejs/studio 0.2.0 → 0.2.2

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.
package/eslint.config.js CHANGED
@@ -33,6 +33,7 @@ module.exports = defineConfig([
33
33
  CodeMirror: true,
34
34
  Chart: true,
35
35
  URLSearchParams: true,
36
+ URL: true,
36
37
  fetch: true,
37
38
  __dirname: true,
38
39
  process: true,
@@ -301,9 +301,9 @@ function getAutocompleteContext(searchText, cursorPos) {
301
301
 
302
302
  // Check if we're in a value context (after a colon)
303
303
  // Match the last colon followed by optional whitespace and capture everything after
304
- const valueMatch = before.match(/:\s*([^\s,\}\]:]*)$/);
304
+ const valueMatch = before.match(/:\s*(\{?\s*)([^\s,\}\]:]*)$/);
305
305
  if (valueMatch) {
306
- const token = valueMatch[1];
306
+ const token = valueMatch[2];
307
307
  return {
308
308
  token,
309
309
  role: 'value',
@@ -378,9 +378,9 @@ function applySuggestion(searchText, cursorPos, suggestion) {
378
378
  const after = searchText.slice(cursorPos);
379
379
 
380
380
  // Check if we're in a value context
381
- const valueMatch = before.match(/:\s*([^\s,\}\]:]*)$/);
381
+ const valueMatch = before.match(/:\s*(\{?\s*)([^\s,\}\]:]*)$/);
382
382
  if (valueMatch) {
383
- const token = valueMatch[1];
383
+ const token = valueMatch[2];
384
384
  const start = cursorPos - token.length;
385
385
  let replacement = suggestion;
386
386
  let cursorOffset = replacement.length;
@@ -4456,18 +4456,21 @@ app.component('app-component', {
4456
4456
  return;
4457
4457
  }
4458
4458
 
4459
+ window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
4460
+
4459
4461
  try {
4460
4462
  const { nodeEnv } = await api.status();
4461
4463
  this.nodeEnv = nodeEnv;
4462
4464
  } catch (err) {
4463
4465
  this.authError = 'Error connecting to Mongoose Studio API: ' + err.response?.data?.message ?? err.message;
4464
4466
  this.status = 'loaded';
4467
+ window.localStorage.setItem('_mongooseStudioAccessToken', '');
4465
4468
  return;
4466
4469
  }
4467
4470
 
4468
4471
  this.user = user;
4469
4472
  this.roles = roles;
4470
- window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
4473
+
4471
4474
  setTimeout(() => {
4472
4475
  this.$router.replace(this.$router.currentRoute.value.path);
4473
4476
  }, 0);
@@ -6293,12 +6296,21 @@ client.interceptors.request.use(req => {
6293
6296
  return req;
6294
6297
  });
6295
6298
 
6299
+ function sanitizedReturnUrl() {
6300
+ const url = new URL(window.location.href);
6301
+ if (url.hash && url.hash.includes('?')) {
6302
+ const [hashPath, hashSearch] = url.hash.split('?', 2);
6303
+ url.hash = hashPath;
6304
+ }
6305
+ return url.toString();
6306
+ }
6307
+
6296
6308
  exports.githubLogin = function githubLogin() {
6297
- return client.post('/githubLogin', { state: window.location.href }).then(res => res.data);
6309
+ return client.post('/githubLogin', { state: sanitizedReturnUrl() }).then(res => res.data);
6298
6310
  };
6299
6311
 
6300
6312
  exports.googleLogin = function googleLogin() {
6301
- return client.post('/googleLogin', { state: window.location.href }).then(res => res.data);
6313
+ return client.post('/googleLogin', { state: sanitizedReturnUrl() }).then(res => res.data);
6302
6314
  };
6303
6315
 
6304
6316
  exports.getWorkspaceTeam = function getWorkspaceTeam() {
@@ -32234,7 +32246,7 @@ const compile = () => {
32234
32246
  (module) {
32235
32247
 
32236
32248
  "use strict";
32237
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.2.0","description":"A Mongoose-native MongoDB UI with schema-aware autocomplete, AI-assisted queries, and dashboards that understand your models - not just your data.","homepage":"https://mongoosestudio.app/","repository":{"type":"git","url":"https://github.com/mongoosejs/studio"},"license":"Apache-2.0","dependencies":{"@ai-sdk/anthropic":"2.x","@ai-sdk/google":"2.x","@ai-sdk/openai":"2.x","ai":"5.x","archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"^0.2.0","marked":"15.0.12","node-inspect-extracted":"3.x","tailwindcss":"3.4.0","vue":"3.x","vue-toastification":"^2.0.0-rc.5","webpack":"5.x"},"peerDependencies":{"mongoose":"7.x || 8.x || ^9.0.0"},"devDependencies":{"@masteringjs/eslint-config":"0.1.1","axios":"1.2.2","dedent":"^1.6.0","eslint":"9.30.0","express":"4.x","mocha":"10.2.0","mongoose":"9.x"},"scripts":{"lint":"eslint .","tailwind":"tailwindcss -o ./frontend/public/tw.css","tailwind:watch":"tailwindcss -o ./frontend/public/tw.css --watch","test":"mocha test/*.test.js"}}');
32249
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.2.2","description":"A Mongoose-native MongoDB UI with schema-aware autocomplete, AI-assisted queries, and dashboards that understand your models - not just your data.","homepage":"https://mongoosestudio.app/","repository":{"type":"git","url":"https://github.com/mongoosejs/studio"},"license":"Apache-2.0","dependencies":{"@ai-sdk/anthropic":"2.x","@ai-sdk/google":"2.x","@ai-sdk/openai":"2.x","ai":"5.x","archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"^0.2.0","marked":"15.0.12","node-inspect-extracted":"3.x","tailwindcss":"3.4.0","vue":"3.x","vue-toastification":"^2.0.0-rc.5","webpack":"5.x"},"peerDependencies":{"mongoose":"7.x || 8.x || ^9.0.0"},"devDependencies":{"@masteringjs/eslint-config":"0.1.1","axios":"1.2.2","dedent":"^1.6.0","eslint":"9.30.0","express":"4.x","mocha":"10.2.0","mongoose":"9.x"},"scripts":{"lint":"eslint .","tailwind":"tailwindcss -o ./frontend/public/tw.css","tailwind:watch":"tailwindcss -o ./frontend/public/tw.css --watch","test":"mocha test/*.test.js"}}');
32238
32250
 
32239
32251
  /***/ }
32240
32252
 
@@ -13,7 +13,7 @@
13
13
  <link rel="stylesheet" href="https://unpkg.com/codemirror@5.65.16/lib/codemirror.css">
14
14
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
15
15
  <link rel="icon" href="images/logo.svg" type="image/svg+xml">
16
- <script src="config.js"></script>
16
+ <script src="./config.js"></script>
17
17
  <script src="https://unpkg.com/vue@3.x"></script>
18
18
  <script src="https://unpkg.com/vue-router@4.0.10"></script>
19
19
  <script src="https://unpkg.com/chart.js@4.2.0/dist/chart.umd.js"></script>
@@ -27,6 +27,6 @@
27
27
 
28
28
  <script src="https://unpkg.com/prismjs@1.29.0/prism.js" data-manual="true"></script>
29
29
  <script src="https://unpkg.com/chart.js@4.2.0/dist/chart.umd.js"></script>
30
- <script src="app.js"></script>
30
+ <script src="./app.js"></script>
31
31
  </body>
32
32
  </html>
@@ -82,9 +82,9 @@ function getAutocompleteContext(searchText, cursorPos) {
82
82
 
83
83
  // Check if we're in a value context (after a colon)
84
84
  // Match the last colon followed by optional whitespace and capture everything after
85
- const valueMatch = before.match(/:\s*([^\s,\}\]:]*)$/);
85
+ const valueMatch = before.match(/:\s*(\{?\s*)([^\s,\}\]:]*)$/);
86
86
  if (valueMatch) {
87
- const token = valueMatch[1];
87
+ const token = valueMatch[2];
88
88
  return {
89
89
  token,
90
90
  role: 'value',
@@ -159,9 +159,9 @@ function applySuggestion(searchText, cursorPos, suggestion) {
159
159
  const after = searchText.slice(cursorPos);
160
160
 
161
161
  // Check if we're in a value context
162
- const valueMatch = before.match(/:\s*([^\s,\}\]:]*)$/);
162
+ const valueMatch = before.match(/:\s*(\{?\s*)([^\s,\}\]:]*)$/);
163
163
  if (valueMatch) {
164
- const token = valueMatch[1];
164
+ const token = valueMatch[2];
165
165
  const start = cursorPos - token.length;
166
166
  let replacement = suggestion;
167
167
  let cursorOffset = replacement.length;
@@ -102,18 +102,21 @@ app.component('app-component', {
102
102
  return;
103
103
  }
104
104
 
105
+ window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
106
+
105
107
  try {
106
108
  const { nodeEnv } = await api.status();
107
109
  this.nodeEnv = nodeEnv;
108
110
  } catch (err) {
109
111
  this.authError = 'Error connecting to Mongoose Studio API: ' + err.response?.data?.message ?? err.message;
110
112
  this.status = 'loaded';
113
+ window.localStorage.setItem('_mongooseStudioAccessToken', '');
111
114
  return;
112
115
  }
113
116
 
114
117
  this.user = user;
115
118
  this.roles = roles;
116
- window.localStorage.setItem('_mongooseStudioAccessToken', accessToken._id);
119
+
117
120
  setTimeout(() => {
118
121
  this.$router.replace(this.$router.currentRoute.value.path);
119
122
  }, 0);
@@ -18,12 +18,21 @@ client.interceptors.request.use(req => {
18
18
  return req;
19
19
  });
20
20
 
21
+ function sanitizedReturnUrl() {
22
+ const url = new URL(window.location.href);
23
+ if (url.hash && url.hash.includes('?')) {
24
+ const [hashPath, hashSearch] = url.hash.split('?', 2);
25
+ url.hash = hashPath;
26
+ }
27
+ return url.toString();
28
+ }
29
+
21
30
  exports.githubLogin = function githubLogin() {
22
- return client.post('/githubLogin', { state: window.location.href }).then(res => res.data);
31
+ return client.post('/githubLogin', { state: sanitizedReturnUrl() }).then(res => res.data);
23
32
  };
24
33
 
25
34
  exports.googleLogin = function googleLogin() {
26
- return client.post('/googleLogin', { state: window.location.href }).then(res => res.data);
35
+ return client.post('/googleLogin', { state: sanitizedReturnUrl() }).then(res => res.data);
27
36
  };
28
37
 
29
38
  exports.getWorkspaceTeam = function getWorkspaceTeam() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A Mongoose-native MongoDB UI with schema-aware autocomplete, AI-assisted queries, and dashboards that understand your models - not just your data.",
5
5
  "homepage": "https://mongoosestudio.app/",
6
6
  "repository": {