@mongoosejs/studio 0.0.77 → 0.0.78
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.
|
@@ -27,7 +27,7 @@ module.exports = ({ db }) => async function executeScript(params) {
|
|
|
27
27
|
|
|
28
28
|
// Create a sandbox with the db object
|
|
29
29
|
const logs = [];
|
|
30
|
-
const sandbox = { db, console: {} };
|
|
30
|
+
const sandbox = { db, console: {}, ObjectId: mongoose.Types.ObjectId };
|
|
31
31
|
|
|
32
32
|
// Capture console logs
|
|
33
33
|
sandbox.console.log = function() {
|
|
@@ -27,6 +27,8 @@ Keep scripts concise. Avoid unnecessary comments, error handling, and temporary
|
|
|
27
27
|
|
|
28
28
|
Do not write any imports or require() statements, that will cause the script to break.
|
|
29
29
|
|
|
30
|
+
If the user approves the script, the script will run in the Node.js server and then send the response via JSON to the client. Be aware that the result of the query will be serialized to JSON before being displayed to the user.
|
|
31
|
+
|
|
30
32
|
Assume the user has pre-defined schemas and models. Do not define any new schemas or models for the user.
|
|
31
33
|
|
|
32
34
|
Use async/await where possible. Assume top-level await is allowed.
|
|
@@ -37,7 +39,7 @@ Format output as Markdown, including code fences for any scripts the user reques
|
|
|
37
39
|
|
|
38
40
|
Add a brief text description of what the script does.
|
|
39
41
|
|
|
40
|
-
If the user's query is best answered with a chart, return a Chart.js 4 configuration as \`return { $chart: chartJSConfig };\`. Disable ChartJS animation by default unless user asks for it.
|
|
42
|
+
If the user's query is best answered with a chart, return a Chart.js 4 configuration as \`return { $chart: chartJSConfig };\`. Disable ChartJS animation by default unless user asks for it. Set responsive: true, maintainAspectRatio: false options unless the user explicitly asks.
|
|
41
43
|
|
|
42
44
|
Example output:
|
|
43
45
|
|
package/frontend/public/app.js
CHANGED
|
@@ -3767,7 +3767,7 @@ module.exports = "<div>\n <div class=\"mb-2\">\n <textarea class=\"border bo
|
|
|
3767
3767
|
/***/ ((module) => {
|
|
3768
3768
|
|
|
3769
3769
|
"use strict";
|
|
3770
|
-
module.exports = "<div class=\"py-2\">\n <div v-if=\"header\" class=\"border-b border-gray-100 px-2 pb-2 text-xl font-bold\">\n {{header}}\n </div>\n <div class=\"text-xl py-2\">\n <canvas ref=\"chart\"></canvas>\n </div>\n</div
|
|
3770
|
+
module.exports = "<div class=\"py-2 h-full\">\n <div v-if=\"header\" class=\"border-b border-gray-100 px-2 pb-2 text-xl font-bold\">\n {{header}}\n </div>\n <div class=\"text-xl py-2 h-full\">\n <canvas ref=\"chart\"></canvas>\n </div>\n</div>\n";
|
|
3771
3771
|
|
|
3772
3772
|
/***/ }),
|
|
3773
3773
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<div class="py-2">
|
|
1
|
+
<div class="py-2 h-full">
|
|
2
2
|
<div v-if="header" class="border-b border-gray-100 px-2 pb-2 text-xl font-bold">
|
|
3
3
|
{{header}}
|
|
4
4
|
</div>
|
|
5
|
-
<div class="text-xl py-2">
|
|
5
|
+
<div class="text-xl py-2 h-full">
|
|
6
6
|
<canvas ref="chart"></canvas>
|
|
7
7
|
</div>
|
|
8
|
-
</div>
|
|
8
|
+
</div>
|