@mongoosejs/studio 0.0.123 → 0.0.124

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.
@@ -125,52 +125,11 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
125
125
  return client.post('', { action: 'Model.getDocuments', ...params }).then(res => res.data);
126
126
  },
127
127
  getDocumentsStream: async function* getDocumentsStream(params) {
128
- const accessToken = window.localStorage.getItem('_mongooseStudioAccessToken') || null;
129
- const url = window.MONGOOSE_STUDIO_CONFIG.baseURL + '?' + new URLSearchParams({ ...params, action: 'Model.getDocumentsStream' }).toString();
130
-
131
- const response = await fetch(url, {
132
- method: 'GET',
133
- headers: {
134
- Authorization: `${accessToken}`,
135
- Accept: 'text/event-stream'
136
- }
137
- });
138
-
139
- if (!response.ok) {
140
- throw new Error(`HTTP error! Status: ${response.status}`);
141
- }
142
-
143
- const reader = response.body.getReader();
144
- const decoder = new TextDecoder('utf-8');
145
- let buffer = '';
146
-
147
- while (true) {
148
- const { done, value } = await reader.read();
149
- if (done) break;
150
- buffer += decoder.decode(value, { stream: true });
151
-
152
- let eventEnd;
153
- while ((eventEnd = buffer.indexOf('\n\n')) !== -1) {
154
- const eventStr = buffer.slice(0, eventEnd);
155
- buffer = buffer.slice(eventEnd + 2);
156
-
157
- // Parse SSE event
158
- const lines = eventStr.split('\n');
159
- let data = '';
160
- for (const line of lines) {
161
- if (line.startsWith('data:')) {
162
- data += line.slice(5).trim();
163
- }
164
- }
165
- if (data) {
166
- try {
167
- yield JSON.parse(data);
168
- } catch (err) {
169
- // If not JSON, yield as string
170
- yield data;
171
- }
172
- }
173
- }
128
+ const data = await client.post('', { action: 'Model.getDocuments', ...params }).then(res => res.data);
129
+ yield { schemaPaths: data.schemaPaths };
130
+ yield { numDocs: data.numDocs };
131
+ for (const doc of data.docs) {
132
+ yield { document: doc };
174
133
  }
175
134
  },
176
135
  getIndexes: function getIndexes(params) {
@@ -15052,7 +15011,7 @@ var bson = /*#__PURE__*/Object.freeze({
15052
15011
  /***/ ((module) => {
15053
15012
 
15054
15013
  "use strict";
15055
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.0.123","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"},"dependencies":{"archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"^0.1.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":{"bson":"^5.5.1 || 6.x","express":"4.x","mongoose":"7.x || 8.x"},"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":"8.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"}}');
15014
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.0.124","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"},"dependencies":{"archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"^0.1.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":{"bson":"^5.5.1 || 6.x","express":"4.x","mongoose":"7.x || 8.x"},"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":"8.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"}}');
15056
15015
 
15057
15016
  /***/ })
15058
15017
 
@@ -115,52 +115,11 @@ if (window.MONGOOSE_STUDIO_CONFIG.isLambda) {
115
115
  return client.post('', { action: 'Model.getDocuments', ...params }).then(res => res.data);
116
116
  },
117
117
  getDocumentsStream: async function* getDocumentsStream(params) {
118
- const accessToken = window.localStorage.getItem('_mongooseStudioAccessToken') || null;
119
- const url = window.MONGOOSE_STUDIO_CONFIG.baseURL + '?' + new URLSearchParams({ ...params, action: 'Model.getDocumentsStream' }).toString();
120
-
121
- const response = await fetch(url, {
122
- method: 'GET',
123
- headers: {
124
- Authorization: `${accessToken}`,
125
- Accept: 'text/event-stream'
126
- }
127
- });
128
-
129
- if (!response.ok) {
130
- throw new Error(`HTTP error! Status: ${response.status}`);
131
- }
132
-
133
- const reader = response.body.getReader();
134
- const decoder = new TextDecoder('utf-8');
135
- let buffer = '';
136
-
137
- while (true) {
138
- const { done, value } = await reader.read();
139
- if (done) break;
140
- buffer += decoder.decode(value, { stream: true });
141
-
142
- let eventEnd;
143
- while ((eventEnd = buffer.indexOf('\n\n')) !== -1) {
144
- const eventStr = buffer.slice(0, eventEnd);
145
- buffer = buffer.slice(eventEnd + 2);
146
-
147
- // Parse SSE event
148
- const lines = eventStr.split('\n');
149
- let data = '';
150
- for (const line of lines) {
151
- if (line.startsWith('data:')) {
152
- data += line.slice(5).trim();
153
- }
154
- }
155
- if (data) {
156
- try {
157
- yield JSON.parse(data);
158
- } catch (err) {
159
- // If not JSON, yield as string
160
- yield data;
161
- }
162
- }
163
- }
118
+ const data = await client.post('', { action: 'Model.getDocuments', ...params }).then(res => res.data);
119
+ yield { schemaPaths: data.schemaPaths };
120
+ yield { numDocs: data.numDocs };
121
+ for (const doc of data.docs) {
122
+ yield { document: doc };
164
123
  }
165
124
  },
166
125
  getIndexes: function getIndexes(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.0.123",
3
+ "version": "0.0.124",
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": {