@mongoosejs/studio 0.0.81 → 0.0.83
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/backend/actions/ChatThread/getChatThread.js +1 -1
- package/backend/netlify.js +3 -0
- package/frontend/public/app.js +12 -1
- package/frontend/public/tw.css +4 -0
- package/frontend/src/chat/chat-message-script/chat-message-script.html +12 -6
- package/frontend/src/chat/chat-message-script/chat-message-script.js +11 -0
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ module.exports = ({ db }) => async function getChatThread(params) {
|
|
|
22
22
|
if (!chatThread) {
|
|
23
23
|
throw new Error('Chat thread not found');
|
|
24
24
|
}
|
|
25
|
-
if (userId && chatThread.userId
|
|
25
|
+
if (userId && chatThread.userId?.toString() !== userId.toString()) {
|
|
26
26
|
throw new Error('Not authorized');
|
|
27
27
|
}
|
|
28
28
|
|
package/backend/netlify.js
CHANGED
package/frontend/public/app.js
CHANGED
|
@@ -305,6 +305,7 @@ module.exports = app => app.component('async-button', {
|
|
|
305
305
|
const api = __webpack_require__(/*! ../../api */ "./frontend/src/api.js");
|
|
306
306
|
const marked = (__webpack_require__(/*! marked */ "./node_modules/marked/lib/marked.cjs").marked);
|
|
307
307
|
const template = __webpack_require__(/*! ./chat-message-script.html */ "./frontend/src/chat/chat-message-script/chat-message-script.html");
|
|
308
|
+
const vanillatoasts = __webpack_require__(/*! vanillatoasts */ "./node_modules/vanillatoasts/vanillatoasts.js");
|
|
308
309
|
|
|
309
310
|
module.exports = app => app.component('chat-message-script', {
|
|
310
311
|
template: template,
|
|
@@ -326,6 +327,16 @@ module.exports = app => app.component('chat-message-script', {
|
|
|
326
327
|
},
|
|
327
328
|
openDetailModal() {
|
|
328
329
|
this.showDetailModal = true;
|
|
330
|
+
},
|
|
331
|
+
async copyOutput() {
|
|
332
|
+
await navigator.clipboard.writeText(this.message.executionResult.output);
|
|
333
|
+
vanillatoasts.create({
|
|
334
|
+
title: 'Text copied!',
|
|
335
|
+
type: 'success',
|
|
336
|
+
timeout: 3000,
|
|
337
|
+
icon: 'images/success.png',
|
|
338
|
+
positionClass: 'bottomRight'
|
|
339
|
+
});
|
|
329
340
|
}
|
|
330
341
|
},
|
|
331
342
|
mounted() {
|
|
@@ -3679,7 +3690,7 @@ module.exports = "<button v-bind=\"attrsToBind\" :disabled=\"isDisabled\" @click
|
|
|
3679
3690
|
/***/ ((module) => {
|
|
3680
3691
|
|
|
3681
3692
|
"use strict";
|
|
3682
|
-
module.exports = "<div class=\"relative border rounded bg-gray-100 text-black text-sm overflow-hidden\">\n <div class=\"flex border-b pt-[1px] text-xs font-medium bg-gray-200\">\n <button\n class=\"px-3 py-1 border-r border-gray-300 hover:bg-green-300\"\n :class=\"{'bg-gray-300': activeTab === 'code', 'bg-green-300': activeTab === 'code'}\"\n @click=\"activeTab = 'code'\">\n Code\n </button>\n <button\n class=\"px-3 py-1 hover:bg-green-300\"\n :class=\"{'bg-green-300': activeTab === 'output'}\"\n @click=\"activeTab = 'output'\">\n Output\n </button>\n <div class=\"ml-auto mr-1 flex\">\n <button\n v-if=\"activeTab === 'output'\"\n class=\"px-2 py-1 mr-1 text-xs bg-blue-500 text-white border-none rounded cursor-pointer hover:bg-blue-600 transition-colors flex items-center\"\n @click=\"openDetailModal\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 1v4m0 0h-4m4 0l-5-5\" />\n </svg>\n </button>\n <async-button\n class=\"px-2 py-1 text-xs bg-green-500 text-white border-none rounded cursor-pointer hover:bg-green-600 transition-colors disabled:bg-gray-400\"\n @click=\"executeScript(message, script)\">\n Execute\n </async-button>\n </div>\n </div>\n\n <pre class=\"p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto\" v-show=\"activeTab === 'code'\"><code v-text=\"script\" ref=\"code\" :class=\"'language-' + language\"></code></pre>\n\n <
|
|
3693
|
+
module.exports = "<div class=\"relative border rounded bg-gray-100 text-black text-sm overflow-hidden\">\n <div class=\"flex border-b pt-[1px] text-xs font-medium bg-gray-200\">\n <button\n class=\"px-3 py-1 border-r border-gray-300 hover:bg-green-300\"\n :class=\"{'bg-gray-300': activeTab === 'code', 'bg-green-300': activeTab === 'code'}\"\n @click=\"activeTab = 'code'\">\n Code\n </button>\n <button\n class=\"px-3 py-1 hover:bg-green-300\"\n :class=\"{'bg-green-300': activeTab === 'output'}\"\n @click=\"activeTab = 'output'\">\n Output\n </button>\n <div class=\"ml-auto mr-1 flex\">\n <button\n v-if=\"activeTab === 'output'\"\n class=\"px-2 py-1 mr-1 text-xs bg-gray-500 text-white border-none rounded cursor-pointer hover:bg-gray-600 transition-colors flex items-center\"\n @click=\"copyOutput\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3\" />\n </svg>\n </button>\n <button\n v-if=\"activeTab === 'output'\"\n class=\"px-2 py-1 mr-1 text-xs bg-blue-500 text-white border-none rounded cursor-pointer hover:bg-blue-600 transition-colors flex items-center\"\n @click=\"openDetailModal\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 1v4m0 0h-4m4 0l-5-5\" />\n </svg>\n </button>\n <async-button\n class=\"px-2 py-1 text-xs bg-green-500 text-white border-none rounded cursor-pointer hover:bg-green-600 transition-colors disabled:bg-gray-400\"\n @click=\"executeScript(message, script)\">\n Execute\n </async-button>\n </div>\n </div>\n\n <pre class=\"p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto\" v-show=\"activeTab === 'code'\"><code v-text=\"script\" ref=\"code\" :class=\"'language-' + language\"></code></pre>\n\n <div class=\"p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto bg-white border-t max-w-[70vw] relative\" v-show=\"activeTab === 'output'\">\n <dashboard-chart v-if=\"message.executionResult?.output?.$chart\" :value=\"message.executionResult?.output\" />\n <pre v-else>{{ message.executionResult?.output || 'No output' }}</pre>\n </div>\n\n <modal ref=\"outputModal\" v-if=\"showDetailModal\" containerClass=\"!h-[90vh] !w-[90vw]\">\n <template #body>\n <div class=\"absolute font-mono right-1 top-1 cursor-pointer text-xl\" @click=\"showDetailModal = false;\">×</div>\n <div class=\"h-full overflow-auto\">\n <dashboard-chart v-if=\"message.executionResult?.output?.$chart\" :value=\"message.executionResult?.output\" />\n <pre v-else class=\"whitespace-pre-wrap\">{{ message.executionResult?.output || 'No output' }}</pre>\n </div>\n </template>\n </modal>\n</div>\n";
|
|
3683
3694
|
|
|
3684
3695
|
/***/ }),
|
|
3685
3696
|
|
package/frontend/public/tw.css
CHANGED
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
Output
|
|
14
14
|
</button>
|
|
15
15
|
<div class="ml-auto mr-1 flex">
|
|
16
|
+
<button
|
|
17
|
+
v-if="activeTab === 'output'"
|
|
18
|
+
class="px-2 py-1 mr-1 text-xs bg-gray-500 text-white border-none rounded cursor-pointer hover:bg-gray-600 transition-colors flex items-center"
|
|
19
|
+
@click="copyOutput">
|
|
20
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
21
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3" />
|
|
22
|
+
</svg>
|
|
23
|
+
</button>
|
|
16
24
|
<button
|
|
17
25
|
v-if="activeTab === 'output'"
|
|
18
26
|
class="px-2 py-1 mr-1 text-xs bg-blue-500 text-white border-none rounded cursor-pointer hover:bg-blue-600 transition-colors flex items-center"
|
|
@@ -31,19 +39,17 @@
|
|
|
31
39
|
|
|
32
40
|
<pre class="p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto" v-show="activeTab === 'code'"><code v-text="script" ref="code" :class="'language-' + language"></code></pre>
|
|
33
41
|
|
|
34
|
-
<
|
|
42
|
+
<div class="p-3 whitespace-pre-wrap max-h-[30vh] overflow-y-auto bg-white border-t max-w-[70vw] relative" v-show="activeTab === 'output'">
|
|
35
43
|
<dashboard-chart v-if="message.executionResult?.output?.$chart" :value="message.executionResult?.output" />
|
|
36
|
-
<
|
|
37
|
-
</
|
|
44
|
+
<pre v-else>{{ message.executionResult?.output || 'No output' }}</pre>
|
|
45
|
+
</div>
|
|
38
46
|
|
|
39
47
|
<modal ref="outputModal" v-if="showDetailModal" containerClass="!h-[90vh] !w-[90vw]">
|
|
40
48
|
<template #body>
|
|
41
49
|
<div class="absolute font-mono right-1 top-1 cursor-pointer text-xl" @click="showDetailModal = false;">×</div>
|
|
42
50
|
<div class="h-full overflow-auto">
|
|
43
51
|
<dashboard-chart v-if="message.executionResult?.output?.$chart" :value="message.executionResult?.output" />
|
|
44
|
-
<pre v-else class="whitespace-pre-wrap">
|
|
45
|
-
{{ message.executionResult?.output ? JSON.stringify(message.executionResult.output, null, 2) : 'No output' }}
|
|
46
|
-
</pre>
|
|
52
|
+
<pre v-else class="whitespace-pre-wrap">{{ message.executionResult?.output || 'No output' }}</pre>
|
|
47
53
|
</div>
|
|
48
54
|
</template>
|
|
49
55
|
</modal>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const api = require('../../api');
|
|
4
4
|
const marked = require('marked').marked;
|
|
5
5
|
const template = require('./chat-message-script.html');
|
|
6
|
+
const vanillatoasts = require('vanillatoasts');
|
|
6
7
|
|
|
7
8
|
module.exports = app => app.component('chat-message-script', {
|
|
8
9
|
template: template,
|
|
@@ -24,6 +25,16 @@ module.exports = app => app.component('chat-message-script', {
|
|
|
24
25
|
},
|
|
25
26
|
openDetailModal() {
|
|
26
27
|
this.showDetailModal = true;
|
|
28
|
+
},
|
|
29
|
+
async copyOutput() {
|
|
30
|
+
await navigator.clipboard.writeText(this.message.executionResult.output);
|
|
31
|
+
vanillatoasts.create({
|
|
32
|
+
title: 'Text copied!',
|
|
33
|
+
type: 'success',
|
|
34
|
+
timeout: 3000,
|
|
35
|
+
icon: 'images/success.png',
|
|
36
|
+
positionClass: 'bottomRight'
|
|
37
|
+
});
|
|
27
38
|
}
|
|
28
39
|
},
|
|
29
40
|
mounted() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
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": {
|