@mongoosejs/studio 0.1.7 → 0.1.9
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/createChatMessage.js +52 -151
- package/backend/integrations/callLLM.js +48 -0
- package/frontend/public/app.js +183 -46
- package/frontend/src/create-document/create-document.js +2 -2
- package/frontend/src/edit-array/edit-array.js +1 -1
- package/frontend/src/edit-subdocument/edit-subdocument.js +1 -1
- package/frontend/src/update-document/update-document.js +2 -2
- package/package.json +4 -3
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const Archetype = require('archetype');
|
|
4
4
|
const authorize = require('../../authorize');
|
|
5
|
+
const callLLM = require('../../integrations/callLLM');
|
|
5
6
|
const getModelDescriptions = require('../../helpers/getModelDescriptions');
|
|
6
7
|
const mongoose = require('mongoose');
|
|
7
8
|
|
|
@@ -13,7 +14,7 @@ const CreateChatMessageParams = new Archetype({
|
|
|
13
14
|
$type: mongoose.Types.ObjectId
|
|
14
15
|
},
|
|
15
16
|
content: {
|
|
16
|
-
$type:
|
|
17
|
+
$type: 'string'
|
|
17
18
|
},
|
|
18
19
|
authorization: {
|
|
19
20
|
$type: 'string'
|
|
@@ -42,29 +43,43 @@ module.exports = ({ db, studioConnection, options }) => async function createCha
|
|
|
42
43
|
const messages = await ChatMessage.find({ chatThreadId }).sort({ createdAt: 1 });
|
|
43
44
|
const llmMessages = messages.map(m => ({
|
|
44
45
|
role: m.role,
|
|
45
|
-
content:
|
|
46
|
+
content: [{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: m.content
|
|
49
|
+
}]
|
|
46
50
|
}));
|
|
47
|
-
llmMessages.push({ role: 'user', content });
|
|
51
|
+
llmMessages.push({ role: 'user', content: [{ type: 'text', text: content }] });
|
|
48
52
|
|
|
49
53
|
let summarizePromise = Promise.resolve();
|
|
50
54
|
if (chatThread.title == null) {
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const threadText = messages
|
|
56
|
+
.filter(m => m.role === 'user' || m.role === 'assistant')
|
|
57
|
+
.map(m => `${m.role.toUpperCase()}: ${m.content}`)
|
|
58
|
+
.join('\n')
|
|
59
|
+
.slice(0, 5000);
|
|
60
|
+
summarizePromise = callLLM(
|
|
61
|
+
[{
|
|
62
|
+
role: 'user',
|
|
63
|
+
content: [{
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: 'Summarize the following chat thread into a concise, helpful title (≤ 6 words).\n\n' +
|
|
66
|
+
`${threadText}\n\n` +
|
|
67
|
+
'Return only the title.'
|
|
68
|
+
}]
|
|
69
|
+
}],
|
|
70
|
+
'You are a helpful assistant that summarizes chat threads into titles.',
|
|
71
|
+
options
|
|
72
|
+
).then(res => {
|
|
73
|
+
const title = res.text;
|
|
53
74
|
chatThread.title = title;
|
|
54
75
|
return chatThread.save();
|
|
55
76
|
});
|
|
56
77
|
}
|
|
57
78
|
|
|
58
|
-
if (options?.context) {
|
|
59
|
-
llmMessages.unshift({
|
|
60
|
-
role: 'system',
|
|
61
|
-
content: options.context
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
79
|
const modelDescriptions = getModelDescriptions(db);
|
|
80
|
+
const system = systemPrompt + '\n\n' + modelDescriptions + (options?.context ? '\n\n' + options.context : '');
|
|
66
81
|
|
|
67
|
-
// Create the chat message and get
|
|
82
|
+
// Create the chat message and get LLM response in parallel
|
|
68
83
|
const chatMessages = await Promise.all([
|
|
69
84
|
ChatMessage.create({
|
|
70
85
|
chatThreadId,
|
|
@@ -73,8 +88,8 @@ module.exports = ({ db, studioConnection, options }) => async function createCha
|
|
|
73
88
|
script,
|
|
74
89
|
executionResult: null
|
|
75
90
|
}),
|
|
76
|
-
|
|
77
|
-
const content = res.
|
|
91
|
+
callLLM(llmMessages, system, options).then(res => {
|
|
92
|
+
const content = res.text;
|
|
78
93
|
return ChatMessage.create({
|
|
79
94
|
chatThreadId,
|
|
80
95
|
role: 'assistant',
|
|
@@ -87,157 +102,43 @@ module.exports = ({ db, studioConnection, options }) => async function createCha
|
|
|
87
102
|
return { chatMessages, chatThread };
|
|
88
103
|
};
|
|
89
104
|
|
|
90
|
-
async function summarizeChatThread(messages, authorization, options) {
|
|
91
|
-
if (options?.openAIAPIKey) {
|
|
92
|
-
const response = await callOpenAI({
|
|
93
|
-
apiKey: options.openAIAPIKey,
|
|
94
|
-
model: options.model,
|
|
95
|
-
messages: [
|
|
96
|
-
{
|
|
97
|
-
role: 'system',
|
|
98
|
-
content: 'Summarize the following conversation into a concise title of at most 7 words. Respond with the title only.'
|
|
99
|
-
},
|
|
100
|
-
...messages
|
|
101
|
-
]
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
return { response };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
108
|
-
if (authorization) {
|
|
109
|
-
headers.Authorization = authorization;
|
|
110
|
-
}
|
|
111
|
-
const response = await fetch('https://mongoose-js.netlify.app/.netlify/functions/summarizeChatThread', {
|
|
112
|
-
method: 'POST',
|
|
113
|
-
headers,
|
|
114
|
-
body: JSON.stringify({
|
|
115
|
-
messages
|
|
116
|
-
})
|
|
117
|
-
}).then(response => {
|
|
118
|
-
if (response.status < 200 || response.status >= 400) {
|
|
119
|
-
return response.json().then(data => {
|
|
120
|
-
throw new Error(`Mongoose Studio chat thread summarization error: ${data.message}`);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return response;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
return await response.json();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async function createChatMessageCore(messages, modelDescriptions, model, authorization, options) {
|
|
130
|
-
if (options?.openAIAPIKey) {
|
|
131
|
-
const openAIMessages = [];
|
|
132
|
-
if (modelDescriptions) {
|
|
133
|
-
openAIMessages.push({
|
|
134
|
-
role: 'system',
|
|
135
|
-
content: `${systemPrompt}:\n\n${modelDescriptions}`
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
openAIMessages.push(...messages);
|
|
139
|
-
|
|
140
|
-
const response = await callOpenAI({
|
|
141
|
-
apiKey: options.openAIAPIKey,
|
|
142
|
-
model,
|
|
143
|
-
messages: openAIMessages
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
return { response };
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
150
|
-
if (authorization) {
|
|
151
|
-
headers.Authorization = authorization;
|
|
152
|
-
}
|
|
153
|
-
const response = await fetch('https://mongoose-js.netlify.app/.netlify/functions/createChatMessage', {
|
|
154
|
-
method: 'POST',
|
|
155
|
-
headers,
|
|
156
|
-
body: JSON.stringify({
|
|
157
|
-
messages,
|
|
158
|
-
modelDescriptions,
|
|
159
|
-
model
|
|
160
|
-
})
|
|
161
|
-
}).then(response => {
|
|
162
|
-
if (response.status < 200 || response.status >= 400) {
|
|
163
|
-
return response.json().then(data => {
|
|
164
|
-
throw new Error(`Mongoose Studio chat completion error: ${data.message}`);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
return response;
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
return await response.json();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
105
|
const systemPrompt = `
|
|
174
|
-
You are a data querying assistant who writes scripts for users accessing MongoDB data using Node.js and Mongoose.
|
|
175
|
-
|
|
176
|
-
Keep scripts concise. Avoid unnecessary comments, error handling, and temporary variables.
|
|
177
|
-
|
|
178
|
-
Do not write any imports or require() statements, that will cause the script to break.
|
|
106
|
+
You are a data querying assistant who writes scripts for users accessing MongoDB data using Node.js and Mongoose.
|
|
179
107
|
|
|
180
|
-
|
|
108
|
+
Keep scripts concise. Avoid unnecessary comments, error handling, and temporary variables.
|
|
181
109
|
|
|
182
|
-
|
|
110
|
+
Do not write any imports or require() statements, that will cause the script to break.
|
|
183
111
|
|
|
184
|
-
|
|
112
|
+
If the user approves the script, the script will run in the Node.js server in a sandboxed vm.createContext() call with only 1 global variable: db, which contains the Mongoose connection. The script return value will 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. MAKE SURE TO RETURN A VALUE FROM THE SCRIPT.
|
|
185
113
|
|
|
186
|
-
|
|
114
|
+
Optimize scripts for readability first, followed by reliability, followed by performance. Avoid using the aggregation framework unless explicitly requested by the user. Use indexed fields in queries where possible.
|
|
187
115
|
|
|
188
|
-
|
|
116
|
+
Assume the user has pre-defined schemas and models. Do not define any new schemas or models for the user.
|
|
189
117
|
|
|
190
|
-
|
|
118
|
+
Use async/await where possible. Assume top-level await is allowed.
|
|
191
119
|
|
|
192
|
-
|
|
120
|
+
Write at most one script, unless the user explicitly asks for multiple scripts.
|
|
193
121
|
|
|
194
|
-
|
|
122
|
+
Think carefully about the user's input and identify the models referred to by the user's query.
|
|
195
123
|
|
|
196
|
-
|
|
124
|
+
Format output as Markdown, including code fences for any scripts the user requested.
|
|
197
125
|
|
|
198
|
-
|
|
126
|
+
Add a brief text description of what the script does.
|
|
199
127
|
|
|
200
|
-
|
|
128
|
+
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.
|
|
201
129
|
|
|
202
|
-
|
|
130
|
+
If the user\'s query is best answered by a map, return an object { $featureCollection } which contains a GeoJSON FeatureCollection
|
|
203
131
|
|
|
204
|
-
|
|
205
|
-
const users = await db.model('User').find({ isDeleted: false });
|
|
206
|
-
return { numUsers: users.length };
|
|
207
|
-
\`\`\`
|
|
132
|
+
Example output:
|
|
208
133
|
|
|
209
|
-
|
|
134
|
+
The following script counts the number of users which are not deleted.
|
|
210
135
|
|
|
211
|
-
|
|
212
|
-
|
|
136
|
+
\`\`\`javascript
|
|
137
|
+
const users = await db.model('User').find({ isDeleted: false });
|
|
138
|
+
return { numUsers: users.length };
|
|
139
|
+
\`\`\`
|
|
213
140
|
|
|
214
|
-
|
|
215
|
-
if (!apiKey) {
|
|
216
|
-
throw new Error('OpenAI API key required');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const response = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
220
|
-
method: 'POST',
|
|
221
|
-
headers: {
|
|
222
|
-
'Content-Type': 'application/json',
|
|
223
|
-
Authorization: `Bearer ${apiKey}`
|
|
224
|
-
},
|
|
225
|
-
body: JSON.stringify({
|
|
226
|
-
model: model || 'gpt-4o-mini',
|
|
227
|
-
messages
|
|
228
|
-
})
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
const data = await response.json();
|
|
232
|
-
|
|
233
|
-
if (response.status < 200 || response.status >= 400) {
|
|
234
|
-
throw new Error(`OpenAI chat completion error ${response.status}: ${data.error?.message || data.message || 'Unknown error'}`);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const content = data?.choices?.[0]?.message?.content;
|
|
238
|
-
if (!content) {
|
|
239
|
-
throw new Error('OpenAI chat completion error: missing response content');
|
|
240
|
-
}
|
|
141
|
+
-----------
|
|
241
142
|
|
|
242
|
-
|
|
243
|
-
|
|
143
|
+
Here is a description of the user's models. Assume these are the only models available in the system unless explicitly instructed otherwise by the user.
|
|
144
|
+
`.trim();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { createAnthropic } = require('@ai-sdk/anthropic');
|
|
4
|
+
const { createOpenAI } = require('@ai-sdk/openai');
|
|
5
|
+
const { generateText } = require('ai');
|
|
6
|
+
|
|
7
|
+
module.exports = async function callLLM(messages, system, options) {
|
|
8
|
+
let provider = null;
|
|
9
|
+
let model = null;
|
|
10
|
+
if (options?.openAIAPIKey && options?.anthropicAPIKey) {
|
|
11
|
+
throw new Error('Cannot set both OpenAI and Anthropic API keys');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (options?.openAIAPIKey) {
|
|
15
|
+
provider = createOpenAI({ apiKey: options.openAIAPIKey });
|
|
16
|
+
model = options?.model ?? 'gpt-4o-mini';
|
|
17
|
+
} else if (options?.anthropicAPIKey) {
|
|
18
|
+
provider = createAnthropic({ apiKey: options.anthropicAPIKey });
|
|
19
|
+
model = options?.model ?? 'claude-haiku-4-5-20251001';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (provider) {
|
|
23
|
+
return generateText({
|
|
24
|
+
model: provider(model),
|
|
25
|
+
system,
|
|
26
|
+
messages
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
31
|
+
const response = await fetch('https://mongoose-js.netlify.app/.netlify/functions/getChatCompletion', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers,
|
|
34
|
+
body: JSON.stringify({
|
|
35
|
+
messages,
|
|
36
|
+
model: options?.model
|
|
37
|
+
})
|
|
38
|
+
}).then(response => {
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
return response.json().then(data => {
|
|
41
|
+
throw new Error(`Mongoose Studio chat completion error: ${data.message}`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return response;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return await response.json().then(res => ({ text: res.response }));
|
|
48
|
+
};
|
package/frontend/public/app.js
CHANGED
|
@@ -1324,7 +1324,7 @@ module.exports = "<div>\n <div class=\"mb-2\">\n <textarea class=\"border bo
|
|
|
1324
1324
|
|
|
1325
1325
|
const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
1326
1326
|
|
|
1327
|
-
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/
|
|
1327
|
+
const { BSON, EJSON } = __webpack_require__(/*! mongodb/lib/bson */ "./node_modules/mongodb/lib/bson.js");
|
|
1328
1328
|
|
|
1329
1329
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
1330
1330
|
apply(target, thisArg, argumentsList) {
|
|
@@ -1383,6 +1383,7 @@ module.exports = app => app.component('create-document', {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
});
|
|
1385
1385
|
|
|
1386
|
+
|
|
1386
1387
|
/***/ }),
|
|
1387
1388
|
|
|
1388
1389
|
/***/ "./frontend/src/dashboard-result/dashboard-chart/dashboard-chart.html":
|
|
@@ -3011,7 +3012,7 @@ module.exports = "<div class=\"edit-array\">\n <textarea\n ref=\"arrayEditor
|
|
|
3011
3012
|
|
|
3012
3013
|
const template = __webpack_require__(/*! ./edit-array.html */ "./frontend/src/edit-array/edit-array.html");
|
|
3013
3014
|
|
|
3014
|
-
const { BSON } = __webpack_require__(/*! bson */ "./node_modules/
|
|
3015
|
+
const { BSON } = __webpack_require__(/*! mongodb/lib/bson */ "./node_modules/mongodb/lib/bson.js");
|
|
3015
3016
|
|
|
3016
3017
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
3017
3018
|
apply(target, thisArg, argumentsList) {
|
|
@@ -3479,7 +3480,7 @@ module.exports = "<div class=\"edit-subdocument\">\n <textarea\n ref=\"edito
|
|
|
3479
3480
|
|
|
3480
3481
|
const template = __webpack_require__(/*! ./edit-subdocument.html */ "./frontend/src/edit-subdocument/edit-subdocument.html");
|
|
3481
3482
|
|
|
3482
|
-
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/
|
|
3483
|
+
const { BSON, EJSON } = __webpack_require__(/*! mongodb/lib/bson */ "./node_modules/mongodb/lib/bson.js");
|
|
3483
3484
|
|
|
3484
3485
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
3485
3486
|
apply(target, thisArg, argumentsList) {
|
|
@@ -5998,7 +5999,7 @@ module.exports = "<div>\n <div class=\"mb-2\">\n <textarea class=\"borde
|
|
|
5998
5999
|
|
|
5999
6000
|
const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
|
|
6000
6001
|
|
|
6001
|
-
const { BSON, EJSON } = __webpack_require__(/*! bson */ "./node_modules/
|
|
6002
|
+
const { BSON, EJSON } = __webpack_require__(/*! mongodb/lib/bson */ "./node_modules/mongodb/lib/bson.js");
|
|
6002
6003
|
|
|
6003
6004
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
6004
6005
|
apply(target, thisArg, argumentsList) {
|
|
@@ -6065,6 +6066,7 @@ module.exports = app => app.component('update-document', {
|
|
|
6065
6066
|
}
|
|
6066
6067
|
});
|
|
6067
6068
|
|
|
6069
|
+
|
|
6068
6070
|
/***/ }),
|
|
6069
6071
|
|
|
6070
6072
|
/***/ "./node_modules/axios/dist/browser/axios.cjs":
|
|
@@ -9264,6 +9266,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9264
9266
|
/* harmony export */ ObjectId: () => (/* binding */ ObjectId),
|
|
9265
9267
|
/* harmony export */ Timestamp: () => (/* binding */ Timestamp),
|
|
9266
9268
|
/* harmony export */ UUID: () => (/* binding */ UUID),
|
|
9269
|
+
/* harmony export */ bsonType: () => (/* binding */ bsonType),
|
|
9267
9270
|
/* harmony export */ calculateObjectSize: () => (/* binding */ calculateObjectSize),
|
|
9268
9271
|
/* harmony export */ deserialize: () => (/* binding */ deserialize),
|
|
9269
9272
|
/* harmony export */ deserializeStream: () => (/* binding */ deserializeStream),
|
|
@@ -9319,7 +9322,7 @@ function getStylizeFunction(options) {
|
|
|
9319
9322
|
}
|
|
9320
9323
|
}
|
|
9321
9324
|
|
|
9322
|
-
const BSON_MAJOR_VERSION =
|
|
9325
|
+
const BSON_MAJOR_VERSION = 7;
|
|
9323
9326
|
const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
|
|
9324
9327
|
const BSON_INT32_MAX = 0x7fffffff;
|
|
9325
9328
|
const BSON_INT32_MIN = -2147483648;
|
|
@@ -9414,6 +9417,7 @@ class BSONOffsetError extends BSONError {
|
|
|
9414
9417
|
get name() {
|
|
9415
9418
|
return 'BSONOffsetError';
|
|
9416
9419
|
}
|
|
9420
|
+
offset;
|
|
9417
9421
|
constructor(message, offset, options) {
|
|
9418
9422
|
super(`${message}. offset: ${offset}`, options);
|
|
9419
9423
|
this.offset = offset;
|
|
@@ -9490,7 +9494,18 @@ function tryWriteBasicLatin(destination, source, offset) {
|
|
|
9490
9494
|
function nodejsMathRandomBytes(byteLength) {
|
|
9491
9495
|
return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
|
|
9492
9496
|
}
|
|
9493
|
-
|
|
9497
|
+
function nodejsSecureRandomBytes(byteLength) {
|
|
9498
|
+
return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
|
|
9499
|
+
}
|
|
9500
|
+
const nodejsRandomBytes = (() => {
|
|
9501
|
+
const { crypto } = globalThis;
|
|
9502
|
+
if (crypto != null && typeof crypto.getRandomValues === 'function') {
|
|
9503
|
+
return nodejsSecureRandomBytes;
|
|
9504
|
+
}
|
|
9505
|
+
else {
|
|
9506
|
+
return nodejsMathRandomBytes;
|
|
9507
|
+
}
|
|
9508
|
+
})();
|
|
9494
9509
|
const nodeJsByteUtils = {
|
|
9495
9510
|
toLocalBufferType(potentialBuffer) {
|
|
9496
9511
|
if (Buffer.isBuffer(potentialBuffer)) {
|
|
@@ -9706,7 +9721,11 @@ const webByteUtils = {
|
|
|
9706
9721
|
const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
|
|
9707
9722
|
const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
|
|
9708
9723
|
|
|
9724
|
+
const bsonType = Symbol.for('@@mdb.bson.type');
|
|
9709
9725
|
class BSONValue {
|
|
9726
|
+
get [bsonType]() {
|
|
9727
|
+
return this._bsontype;
|
|
9728
|
+
}
|
|
9710
9729
|
get [BSON_VERSION_SYMBOL]() {
|
|
9711
9730
|
return BSON_MAJOR_VERSION;
|
|
9712
9731
|
}
|
|
@@ -9757,7 +9776,7 @@ const NumberUtils = {
|
|
|
9757
9776
|
source[offset + 1] * 256 +
|
|
9758
9777
|
source[offset + 2] * 65536 +
|
|
9759
9778
|
source[offset + 3] * 16777216);
|
|
9760
|
-
return (hi <<
|
|
9779
|
+
return (hi << 32n) + lo;
|
|
9761
9780
|
},
|
|
9762
9781
|
getFloat64LE: isBigEndian
|
|
9763
9782
|
? (source, offset) => {
|
|
@@ -9803,7 +9822,7 @@ const NumberUtils = {
|
|
|
9803
9822
|
return 4;
|
|
9804
9823
|
},
|
|
9805
9824
|
setBigInt64LE(destination, offset, value) {
|
|
9806
|
-
const mask32bits =
|
|
9825
|
+
const mask32bits = 0xffffffffn;
|
|
9807
9826
|
let lo = Number(value & mask32bits);
|
|
9808
9827
|
destination[offset] = lo;
|
|
9809
9828
|
lo >>= 8;
|
|
@@ -9812,7 +9831,7 @@ const NumberUtils = {
|
|
|
9812
9831
|
destination[offset + 2] = lo;
|
|
9813
9832
|
lo >>= 8;
|
|
9814
9833
|
destination[offset + 3] = lo;
|
|
9815
|
-
let hi = Number((value >>
|
|
9834
|
+
let hi = Number((value >> 32n) & mask32bits);
|
|
9816
9835
|
destination[offset + 4] = hi;
|
|
9817
9836
|
hi >>= 8;
|
|
9818
9837
|
destination[offset + 5] = hi;
|
|
@@ -9853,6 +9872,27 @@ class Binary extends BSONValue {
|
|
|
9853
9872
|
get _bsontype() {
|
|
9854
9873
|
return 'Binary';
|
|
9855
9874
|
}
|
|
9875
|
+
static BSON_BINARY_SUBTYPE_DEFAULT = 0;
|
|
9876
|
+
static BUFFER_SIZE = 256;
|
|
9877
|
+
static SUBTYPE_DEFAULT = 0;
|
|
9878
|
+
static SUBTYPE_FUNCTION = 1;
|
|
9879
|
+
static SUBTYPE_BYTE_ARRAY = 2;
|
|
9880
|
+
static SUBTYPE_UUID_OLD = 3;
|
|
9881
|
+
static SUBTYPE_UUID = 4;
|
|
9882
|
+
static SUBTYPE_MD5 = 5;
|
|
9883
|
+
static SUBTYPE_ENCRYPTED = 6;
|
|
9884
|
+
static SUBTYPE_COLUMN = 7;
|
|
9885
|
+
static SUBTYPE_SENSITIVE = 8;
|
|
9886
|
+
static SUBTYPE_VECTOR = 9;
|
|
9887
|
+
static SUBTYPE_USER_DEFINED = 128;
|
|
9888
|
+
static VECTOR_TYPE = Object.freeze({
|
|
9889
|
+
Int8: 0x03,
|
|
9890
|
+
Float32: 0x27,
|
|
9891
|
+
PackedBit: 0x10
|
|
9892
|
+
});
|
|
9893
|
+
buffer;
|
|
9894
|
+
sub_type;
|
|
9895
|
+
position;
|
|
9856
9896
|
constructor(buffer, subType) {
|
|
9857
9897
|
super();
|
|
9858
9898
|
if (!(buffer == null) &&
|
|
@@ -10112,24 +10152,6 @@ class Binary extends BSONValue {
|
|
|
10112
10152
|
return new this(bytes, Binary.SUBTYPE_VECTOR);
|
|
10113
10153
|
}
|
|
10114
10154
|
}
|
|
10115
|
-
Binary.BSON_BINARY_SUBTYPE_DEFAULT = 0;
|
|
10116
|
-
Binary.BUFFER_SIZE = 256;
|
|
10117
|
-
Binary.SUBTYPE_DEFAULT = 0;
|
|
10118
|
-
Binary.SUBTYPE_FUNCTION = 1;
|
|
10119
|
-
Binary.SUBTYPE_BYTE_ARRAY = 2;
|
|
10120
|
-
Binary.SUBTYPE_UUID_OLD = 3;
|
|
10121
|
-
Binary.SUBTYPE_UUID = 4;
|
|
10122
|
-
Binary.SUBTYPE_MD5 = 5;
|
|
10123
|
-
Binary.SUBTYPE_ENCRYPTED = 6;
|
|
10124
|
-
Binary.SUBTYPE_COLUMN = 7;
|
|
10125
|
-
Binary.SUBTYPE_SENSITIVE = 8;
|
|
10126
|
-
Binary.SUBTYPE_VECTOR = 9;
|
|
10127
|
-
Binary.SUBTYPE_USER_DEFINED = 128;
|
|
10128
|
-
Binary.VECTOR_TYPE = Object.freeze({
|
|
10129
|
-
Int8: 0x03,
|
|
10130
|
-
Float32: 0x27,
|
|
10131
|
-
PackedBit: 0x10
|
|
10132
|
-
});
|
|
10133
10155
|
function validateBinaryVector(vector) {
|
|
10134
10156
|
if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
|
|
10135
10157
|
return;
|
|
@@ -10266,6 +10288,8 @@ class Code extends BSONValue {
|
|
|
10266
10288
|
get _bsontype() {
|
|
10267
10289
|
return 'Code';
|
|
10268
10290
|
}
|
|
10291
|
+
code;
|
|
10292
|
+
scope;
|
|
10269
10293
|
constructor(code, scope) {
|
|
10270
10294
|
super();
|
|
10271
10295
|
this.code = code.toString();
|
|
@@ -10311,6 +10335,10 @@ class DBRef extends BSONValue {
|
|
|
10311
10335
|
get _bsontype() {
|
|
10312
10336
|
return 'DBRef';
|
|
10313
10337
|
}
|
|
10338
|
+
collection;
|
|
10339
|
+
oid;
|
|
10340
|
+
db;
|
|
10341
|
+
fields;
|
|
10314
10342
|
constructor(collection, oid, db, fields) {
|
|
10315
10343
|
super();
|
|
10316
10344
|
const parts = collection.split('.');
|
|
@@ -10420,6 +10448,9 @@ class Long extends BSONValue {
|
|
|
10420
10448
|
get __isLong__() {
|
|
10421
10449
|
return true;
|
|
10422
10450
|
}
|
|
10451
|
+
high;
|
|
10452
|
+
low;
|
|
10453
|
+
unsigned;
|
|
10423
10454
|
constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
|
|
10424
10455
|
super();
|
|
10425
10456
|
const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
|
|
@@ -10433,6 +10464,15 @@ class Long extends BSONValue {
|
|
|
10433
10464
|
this.high = res.high;
|
|
10434
10465
|
this.unsigned = res.unsigned;
|
|
10435
10466
|
}
|
|
10467
|
+
static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
|
|
10468
|
+
static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
|
|
10469
|
+
static ZERO = Long.fromInt(0);
|
|
10470
|
+
static UZERO = Long.fromInt(0, true);
|
|
10471
|
+
static ONE = Long.fromInt(1);
|
|
10472
|
+
static UONE = Long.fromInt(1, true);
|
|
10473
|
+
static NEG_ONE = Long.fromInt(-1);
|
|
10474
|
+
static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
|
|
10475
|
+
static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
|
|
10436
10476
|
static fromBits(lowBits, highBits, unsigned) {
|
|
10437
10477
|
return new Long(lowBits, highBits, unsigned);
|
|
10438
10478
|
}
|
|
@@ -10473,7 +10513,7 @@ class Long extends BSONValue {
|
|
|
10473
10513
|
return Long.MAX_UNSIGNED_VALUE;
|
|
10474
10514
|
}
|
|
10475
10515
|
else {
|
|
10476
|
-
if (value <= -
|
|
10516
|
+
if (value <= -TWO_PWR_63_DBL)
|
|
10477
10517
|
return Long.MIN_VALUE;
|
|
10478
10518
|
if (value + 1 >= TWO_PWR_63_DBL)
|
|
10479
10519
|
return Long.MAX_VALUE;
|
|
@@ -10483,8 +10523,8 @@ class Long extends BSONValue {
|
|
|
10483
10523
|
return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
|
|
10484
10524
|
}
|
|
10485
10525
|
static fromBigInt(value, unsigned) {
|
|
10486
|
-
const FROM_BIGINT_BIT_MASK =
|
|
10487
|
-
const FROM_BIGINT_BIT_SHIFT =
|
|
10526
|
+
const FROM_BIGINT_BIT_MASK = 0xffffffffn;
|
|
10527
|
+
const FROM_BIGINT_BIT_SHIFT = 32n;
|
|
10488
10528
|
return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
|
|
10489
10529
|
}
|
|
10490
10530
|
static _fromString(str, unsigned, radix) {
|
|
@@ -10517,7 +10557,7 @@ class Long extends BSONValue {
|
|
|
10517
10557
|
static fromStringStrict(str, unsignedOrRadix, radix) {
|
|
10518
10558
|
let unsigned = false;
|
|
10519
10559
|
if (typeof unsignedOrRadix === 'number') {
|
|
10520
|
-
(radix = unsignedOrRadix), (unsignedOrRadix = false);
|
|
10560
|
+
((radix = unsignedOrRadix), (unsignedOrRadix = false));
|
|
10521
10561
|
}
|
|
10522
10562
|
else {
|
|
10523
10563
|
unsigned = !!unsignedOrRadix;
|
|
@@ -10539,7 +10579,7 @@ class Long extends BSONValue {
|
|
|
10539
10579
|
static fromString(str, unsignedOrRadix, radix) {
|
|
10540
10580
|
let unsigned = false;
|
|
10541
10581
|
if (typeof unsignedOrRadix === 'number') {
|
|
10542
|
-
(radix = unsignedOrRadix), (unsignedOrRadix = false);
|
|
10582
|
+
((radix = unsignedOrRadix), (unsignedOrRadix = false));
|
|
10543
10583
|
}
|
|
10544
10584
|
else {
|
|
10545
10585
|
unsigned = !!unsignedOrRadix;
|
|
@@ -11059,15 +11099,6 @@ class Long extends BSONValue {
|
|
|
11059
11099
|
return `new Long(${longVal}${unsignedVal})`;
|
|
11060
11100
|
}
|
|
11061
11101
|
}
|
|
11062
|
-
Long.TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
|
|
11063
|
-
Long.MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
|
|
11064
|
-
Long.ZERO = Long.fromInt(0);
|
|
11065
|
-
Long.UZERO = Long.fromInt(0, true);
|
|
11066
|
-
Long.ONE = Long.fromInt(1);
|
|
11067
|
-
Long.UONE = Long.fromInt(1, true);
|
|
11068
|
-
Long.NEG_ONE = Long.fromInt(-1);
|
|
11069
|
-
Long.MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
|
|
11070
|
-
Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
|
|
11071
11102
|
|
|
11072
11103
|
const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
|
|
11073
11104
|
const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
|
|
@@ -11148,6 +11179,7 @@ class Decimal128 extends BSONValue {
|
|
|
11148
11179
|
get _bsontype() {
|
|
11149
11180
|
return 'Decimal128';
|
|
11150
11181
|
}
|
|
11182
|
+
bytes;
|
|
11151
11183
|
constructor(bytes) {
|
|
11152
11184
|
super();
|
|
11153
11185
|
if (typeof bytes === 'string') {
|
|
@@ -11623,6 +11655,7 @@ class Double extends BSONValue {
|
|
|
11623
11655
|
get _bsontype() {
|
|
11624
11656
|
return 'Double';
|
|
11625
11657
|
}
|
|
11658
|
+
value;
|
|
11626
11659
|
constructor(value) {
|
|
11627
11660
|
super();
|
|
11628
11661
|
if (value instanceof Number) {
|
|
@@ -11686,6 +11719,7 @@ class Int32 extends BSONValue {
|
|
|
11686
11719
|
get _bsontype() {
|
|
11687
11720
|
return 'Int32';
|
|
11688
11721
|
}
|
|
11722
|
+
value;
|
|
11689
11723
|
constructor(value) {
|
|
11690
11724
|
super();
|
|
11691
11725
|
if (value instanceof Number) {
|
|
@@ -11769,6 +11803,9 @@ class ObjectId extends BSONValue {
|
|
|
11769
11803
|
get _bsontype() {
|
|
11770
11804
|
return 'ObjectId';
|
|
11771
11805
|
}
|
|
11806
|
+
static index = Math.floor(Math.random() * 0xffffff);
|
|
11807
|
+
static cacheHexString;
|
|
11808
|
+
buffer;
|
|
11772
11809
|
constructor(inputId) {
|
|
11773
11810
|
super();
|
|
11774
11811
|
let workingId;
|
|
@@ -11786,8 +11823,8 @@ class ObjectId extends BSONValue {
|
|
|
11786
11823
|
else {
|
|
11787
11824
|
workingId = inputId;
|
|
11788
11825
|
}
|
|
11789
|
-
if (workingId == null
|
|
11790
|
-
this.buffer = ObjectId.generate(
|
|
11826
|
+
if (workingId == null) {
|
|
11827
|
+
this.buffer = ObjectId.generate();
|
|
11791
11828
|
}
|
|
11792
11829
|
else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
|
|
11793
11830
|
this.buffer = ByteUtils.toLocalBufferType(workingId);
|
|
@@ -11970,7 +12007,6 @@ class ObjectId extends BSONValue {
|
|
|
11970
12007
|
return `new ObjectId(${inspect(this.toHexString(), options)})`;
|
|
11971
12008
|
}
|
|
11972
12009
|
}
|
|
11973
|
-
ObjectId.index = Math.floor(Math.random() * 0xffffff);
|
|
11974
12010
|
|
|
11975
12011
|
function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
|
|
11976
12012
|
let totalLength = 4 + 1;
|
|
@@ -12139,6 +12175,8 @@ class BSONRegExp extends BSONValue {
|
|
|
12139
12175
|
get _bsontype() {
|
|
12140
12176
|
return 'BSONRegExp';
|
|
12141
12177
|
}
|
|
12178
|
+
pattern;
|
|
12179
|
+
options;
|
|
12142
12180
|
constructor(pattern, options) {
|
|
12143
12181
|
super();
|
|
12144
12182
|
this.pattern = pattern;
|
|
@@ -12199,6 +12237,7 @@ class BSONSymbol extends BSONValue {
|
|
|
12199
12237
|
get _bsontype() {
|
|
12200
12238
|
return 'BSONSymbol';
|
|
12201
12239
|
}
|
|
12240
|
+
value;
|
|
12202
12241
|
constructor(value) {
|
|
12203
12242
|
super();
|
|
12204
12243
|
this.value = value;
|
|
@@ -12229,6 +12268,10 @@ class Timestamp extends LongWithoutOverridesClass {
|
|
|
12229
12268
|
get _bsontype() {
|
|
12230
12269
|
return 'Timestamp';
|
|
12231
12270
|
}
|
|
12271
|
+
get [bsonType]() {
|
|
12272
|
+
return 'Timestamp';
|
|
12273
|
+
}
|
|
12274
|
+
static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
|
|
12232
12275
|
get i() {
|
|
12233
12276
|
return this.low >>> 0;
|
|
12234
12277
|
}
|
|
@@ -12308,7 +12351,6 @@ class Timestamp extends LongWithoutOverridesClass {
|
|
|
12308
12351
|
return `new Timestamp({ t: ${t}, i: ${i} })`;
|
|
12309
12352
|
}
|
|
12310
12353
|
}
|
|
12311
|
-
Timestamp.MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
|
|
12312
12354
|
|
|
12313
12355
|
const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
|
|
12314
12356
|
const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
|
|
@@ -13860,6 +13902,7 @@ var bson = /*#__PURE__*/Object.freeze({
|
|
|
13860
13902
|
ObjectId: ObjectId,
|
|
13861
13903
|
Timestamp: Timestamp,
|
|
13862
13904
|
UUID: UUID,
|
|
13905
|
+
bsonType: bsonType,
|
|
13863
13906
|
calculateObjectSize: calculateObjectSize,
|
|
13864
13907
|
deserialize: deserialize,
|
|
13865
13908
|
deserializeStream: deserializeStream,
|
|
@@ -16095,6 +16138,100 @@ var lexer = _Lexer.lex;
|
|
|
16095
16138
|
//# sourceMappingURL=marked.cjs.map
|
|
16096
16139
|
|
|
16097
16140
|
|
|
16141
|
+
/***/ }),
|
|
16142
|
+
|
|
16143
|
+
/***/ "./node_modules/mongodb/lib/bson.js":
|
|
16144
|
+
/*!******************************************!*\
|
|
16145
|
+
!*** ./node_modules/mongodb/lib/bson.js ***!
|
|
16146
|
+
\******************************************/
|
|
16147
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
16148
|
+
|
|
16149
|
+
"use strict";
|
|
16150
|
+
|
|
16151
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16152
|
+
exports.toUTF8 = exports.getBigInt64LE = exports.getFloat64LE = exports.getInt32LE = exports.UUID = exports.Timestamp = exports.serialize = exports.ObjectId = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.EJSON = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSONError = exports.BSON = exports.Binary = void 0;
|
|
16153
|
+
exports.parseToElementsToArray = parseToElementsToArray;
|
|
16154
|
+
exports.pluckBSONSerializeOptions = pluckBSONSerializeOptions;
|
|
16155
|
+
exports.resolveBSONOptions = resolveBSONOptions;
|
|
16156
|
+
exports.parseUtf8ValidationOption = parseUtf8ValidationOption;
|
|
16157
|
+
/* eslint-disable no-restricted-imports */
|
|
16158
|
+
const bson_1 = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
16159
|
+
var bson_2 = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.mjs");
|
|
16160
|
+
Object.defineProperty(exports, "Binary", ({ enumerable: true, get: function () { return bson_2.Binary; } }));
|
|
16161
|
+
Object.defineProperty(exports, "BSON", ({ enumerable: true, get: function () { return bson_2.BSON; } }));
|
|
16162
|
+
Object.defineProperty(exports, "BSONError", ({ enumerable: true, get: function () { return bson_2.BSONError; } }));
|
|
16163
|
+
Object.defineProperty(exports, "BSONRegExp", ({ enumerable: true, get: function () { return bson_2.BSONRegExp; } }));
|
|
16164
|
+
Object.defineProperty(exports, "BSONSymbol", ({ enumerable: true, get: function () { return bson_2.BSONSymbol; } }));
|
|
16165
|
+
Object.defineProperty(exports, "BSONType", ({ enumerable: true, get: function () { return bson_2.BSONType; } }));
|
|
16166
|
+
Object.defineProperty(exports, "calculateObjectSize", ({ enumerable: true, get: function () { return bson_2.calculateObjectSize; } }));
|
|
16167
|
+
Object.defineProperty(exports, "Code", ({ enumerable: true, get: function () { return bson_2.Code; } }));
|
|
16168
|
+
Object.defineProperty(exports, "DBRef", ({ enumerable: true, get: function () { return bson_2.DBRef; } }));
|
|
16169
|
+
Object.defineProperty(exports, "Decimal128", ({ enumerable: true, get: function () { return bson_2.Decimal128; } }));
|
|
16170
|
+
Object.defineProperty(exports, "deserialize", ({ enumerable: true, get: function () { return bson_2.deserialize; } }));
|
|
16171
|
+
Object.defineProperty(exports, "Double", ({ enumerable: true, get: function () { return bson_2.Double; } }));
|
|
16172
|
+
Object.defineProperty(exports, "EJSON", ({ enumerable: true, get: function () { return bson_2.EJSON; } }));
|
|
16173
|
+
Object.defineProperty(exports, "Int32", ({ enumerable: true, get: function () { return bson_2.Int32; } }));
|
|
16174
|
+
Object.defineProperty(exports, "Long", ({ enumerable: true, get: function () { return bson_2.Long; } }));
|
|
16175
|
+
Object.defineProperty(exports, "MaxKey", ({ enumerable: true, get: function () { return bson_2.MaxKey; } }));
|
|
16176
|
+
Object.defineProperty(exports, "MinKey", ({ enumerable: true, get: function () { return bson_2.MinKey; } }));
|
|
16177
|
+
Object.defineProperty(exports, "ObjectId", ({ enumerable: true, get: function () { return bson_2.ObjectId; } }));
|
|
16178
|
+
Object.defineProperty(exports, "serialize", ({ enumerable: true, get: function () { return bson_2.serialize; } }));
|
|
16179
|
+
Object.defineProperty(exports, "Timestamp", ({ enumerable: true, get: function () { return bson_2.Timestamp; } }));
|
|
16180
|
+
Object.defineProperty(exports, "UUID", ({ enumerable: true, get: function () { return bson_2.UUID; } }));
|
|
16181
|
+
function parseToElementsToArray(bytes, offset) {
|
|
16182
|
+
const res = bson_1.BSON.onDemand.parseToElements(bytes, offset);
|
|
16183
|
+
return Array.isArray(res) ? res : [...res];
|
|
16184
|
+
}
|
|
16185
|
+
exports.getInt32LE = bson_1.BSON.onDemand.NumberUtils.getInt32LE;
|
|
16186
|
+
exports.getFloat64LE = bson_1.BSON.onDemand.NumberUtils.getFloat64LE;
|
|
16187
|
+
exports.getBigInt64LE = bson_1.BSON.onDemand.NumberUtils.getBigInt64LE;
|
|
16188
|
+
exports.toUTF8 = bson_1.BSON.onDemand.ByteUtils.toUTF8;
|
|
16189
|
+
function pluckBSONSerializeOptions(options) {
|
|
16190
|
+
const { fieldsAsRaw, useBigInt64, promoteValues, promoteBuffers, promoteLongs, serializeFunctions, ignoreUndefined, bsonRegExp, raw, enableUtf8Validation } = options;
|
|
16191
|
+
return {
|
|
16192
|
+
fieldsAsRaw,
|
|
16193
|
+
useBigInt64,
|
|
16194
|
+
promoteValues,
|
|
16195
|
+
promoteBuffers,
|
|
16196
|
+
promoteLongs,
|
|
16197
|
+
serializeFunctions,
|
|
16198
|
+
ignoreUndefined,
|
|
16199
|
+
bsonRegExp,
|
|
16200
|
+
raw,
|
|
16201
|
+
enableUtf8Validation
|
|
16202
|
+
};
|
|
16203
|
+
}
|
|
16204
|
+
/**
|
|
16205
|
+
* Merge the given BSONSerializeOptions, preferring options over the parent's options, and
|
|
16206
|
+
* substituting defaults for values not set.
|
|
16207
|
+
*
|
|
16208
|
+
* @internal
|
|
16209
|
+
*/
|
|
16210
|
+
function resolveBSONOptions(options, parent) {
|
|
16211
|
+
const parentOptions = parent?.bsonOptions;
|
|
16212
|
+
return {
|
|
16213
|
+
raw: options?.raw ?? parentOptions?.raw ?? false,
|
|
16214
|
+
useBigInt64: options?.useBigInt64 ?? parentOptions?.useBigInt64 ?? false,
|
|
16215
|
+
promoteLongs: options?.promoteLongs ?? parentOptions?.promoteLongs ?? true,
|
|
16216
|
+
promoteValues: options?.promoteValues ?? parentOptions?.promoteValues ?? true,
|
|
16217
|
+
promoteBuffers: options?.promoteBuffers ?? parentOptions?.promoteBuffers ?? false,
|
|
16218
|
+
ignoreUndefined: options?.ignoreUndefined ?? parentOptions?.ignoreUndefined ?? false,
|
|
16219
|
+
bsonRegExp: options?.bsonRegExp ?? parentOptions?.bsonRegExp ?? false,
|
|
16220
|
+
serializeFunctions: options?.serializeFunctions ?? parentOptions?.serializeFunctions ?? false,
|
|
16221
|
+
fieldsAsRaw: options?.fieldsAsRaw ?? parentOptions?.fieldsAsRaw ?? {},
|
|
16222
|
+
enableUtf8Validation: options?.enableUtf8Validation ?? parentOptions?.enableUtf8Validation ?? true
|
|
16223
|
+
};
|
|
16224
|
+
}
|
|
16225
|
+
/** @internal */
|
|
16226
|
+
function parseUtf8ValidationOption(options) {
|
|
16227
|
+
const enableUtf8Validation = options?.enableUtf8Validation;
|
|
16228
|
+
if (enableUtf8Validation === false) {
|
|
16229
|
+
return { utf8: false };
|
|
16230
|
+
}
|
|
16231
|
+
return { utf8: { writeErrors: false } };
|
|
16232
|
+
}
|
|
16233
|
+
//# sourceMappingURL=bson.js.map
|
|
16234
|
+
|
|
16098
16235
|
/***/ }),
|
|
16099
16236
|
|
|
16100
16237
|
/***/ "./node_modules/mpath/index.js":
|
|
@@ -16709,7 +16846,7 @@ module.exports = function stringToParts(str) {
|
|
|
16709
16846
|
/***/ ((module) => {
|
|
16710
16847
|
|
|
16711
16848
|
"use strict";
|
|
16712
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.1.
|
|
16849
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.1.9","description":"A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.","homepage":"https://studio.mongoosejs.io/","repository":{"type":"git","url":"https://github.com/mongoosejs/studio"},"license":"Apache-2.0","dependencies":{"@ai-sdk/openai":"2.x","@ai-sdk/anthropic":"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","vanillatoasts":"^1.6.0","vue":"3.x","webpack":"5.x"},"peerDependencies":{"mongoose":"7.x || 8.x || ^9.0.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"}}');
|
|
16713
16850
|
|
|
16714
16851
|
/***/ })
|
|
16715
16852
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
|
|
5
|
-
const { BSON, EJSON } = require('bson');
|
|
5
|
+
const { BSON, EJSON } = require('mongodb/lib/bson');
|
|
6
6
|
|
|
7
7
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
8
8
|
apply(target, thisArg, argumentsList) {
|
|
@@ -59,4 +59,4 @@ module.exports = app => app.component('create-document', {
|
|
|
59
59
|
smartIndent: false
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
});
|
|
62
|
+
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const api = require('../api');
|
|
4
4
|
|
|
5
|
-
const { BSON, EJSON } = require('bson');
|
|
5
|
+
const { BSON, EJSON } = require('mongodb/lib/bson');
|
|
6
6
|
|
|
7
7
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
8
8
|
apply(target, thisArg, argumentsList) {
|
|
@@ -67,4 +67,4 @@ module.exports = app => app.component('update-document', {
|
|
|
67
67
|
smartIndent: false
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
});
|
|
70
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
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": {
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@ai-sdk/openai": "2.x",
|
|
13
|
+
"@ai-sdk/anthropic": "2.x",
|
|
14
|
+
"ai": "5.x",
|
|
12
15
|
"archetype": "0.13.1",
|
|
13
16
|
"csv-stringify": "6.3.0",
|
|
14
17
|
"ejson": "^2.2.3",
|
|
@@ -21,8 +24,6 @@
|
|
|
21
24
|
"webpack": "5.x"
|
|
22
25
|
},
|
|
23
26
|
"peerDependencies": {
|
|
24
|
-
"bson": "^5.5.1 || 6.x",
|
|
25
|
-
"express": "4.x",
|
|
26
27
|
"mongoose": "7.x || 8.x || ^9.0.0-0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|