@mongoosejs/studio 0.5.6 → 0.5.8
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/README.md +35 -3
- package/express.js +8 -1
- package/frontend/public/app.js +988 -216
- package/frontend/public/tw.css +113 -0
- package/frontend/src/_util/calendar.js +155 -0
- package/frontend/src/_util/document-search-autocomplete.js +105 -23
- package/frontend/src/custom-date-picker/custom-date-picker.html +183 -0
- package/frontend/src/custom-date-picker/custom-date-picker.js +407 -0
- package/frontend/src/document/document.css +62 -0
- package/frontend/src/document/document.html +113 -2
- package/frontend/src/document/document.js +171 -9
- package/frontend/src/document-details/date-view-mode-picker/date-view-mode-picker.html +1 -0
- package/frontend/src/document-details/date-view-mode-picker/date-view-mode-picker.js +1 -1
- package/frontend/src/document-details/document-details.css +1 -63
- package/frontend/src/document-details/document-details.html +0 -122
- package/frontend/src/document-details/document-details.js +2 -138
- package/frontend/src/document-details/document-property/document-property.html +3 -2
- package/frontend/src/edit-date/edit-date.html +8 -6
- package/frontend/src/edit-date/edit-date.js +0 -20
- package/frontend/src/models/document-search/document-search.html +78 -22
- package/frontend/src/models/document-search/document-search.js +64 -2
- package/nest.d.ts +27 -0
- package/nest.js +134 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Mongoose Studio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An AI-Powered Data Workspace for MongoDB: Turn your MongoDB data into dashboards, maps, and interactive workflows - powered by your Mongoose models.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
## Getting Started
|
|
8
8
|
|
|
9
9
|
Mongoose Studio is meant to run as a [sidecar](https://learn.microsoft.com/en-us/azure/architecture/patterns/sidecar) to your Node.js application, using the same Mongoose connection config.
|
|
10
|
-
If your app runs on `acme.app`, Studio will be on `acme.app/studio` or whichever path you prefer.
|
|
11
|
-
For local dev, if your app runs on `localhost:3000`, Studio will be on `localhost:3000/studio`.
|
|
10
|
+
If your app runs on `acme.app`, Mongoose Studio will be on `acme.app/studio` or whichever path you prefer.
|
|
11
|
+
For local dev, if your app runs on `localhost:3000`, Mongoose Studio will be on `localhost:3000/studio`.
|
|
12
12
|
|
|
13
13
|
By default, Mongoose Studio does **not** provide any authentication or authorization.
|
|
14
14
|
You can use Mongoose Studio for free for local development, but we recommend [Mongoose Studio Pro](https://studio.mongoosejs.io/#pricing) for when you want to go into production.
|
|
@@ -85,6 +85,38 @@ const handler = studio(
|
|
|
85
85
|
export default handler;
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
### Nest.js
|
|
89
|
+
|
|
90
|
+
Add `MongooseStudioModule` to your app module as follows.
|
|
91
|
+
Use `getConnectionToken()` so Mongoose Studio uses the same connection that `MongooseModule.forRoot()` creates.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { Module } from '@nestjs/common';
|
|
95
|
+
import { MongooseModule, getConnectionToken } from '@nestjs/mongoose';
|
|
96
|
+
import { MongooseStudioModule } from '@mongoosejs/studio/nest';
|
|
97
|
+
|
|
98
|
+
@Module({
|
|
99
|
+
imports: [
|
|
100
|
+
MongooseModule.forRoot(process.env.MONGODB_URI),
|
|
101
|
+
MongooseStudioModule.forRoot({
|
|
102
|
+
connectionToken: getConnectionToken(),
|
|
103
|
+
apiKey: process.env.MONGOOSE_STUDIO_API_KEY // optional
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
})
|
|
107
|
+
export class AppModule {}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
With this setup, Mongoose Studio is available at `/studio`.
|
|
111
|
+
If you mount Mongoose Studio on a different path, update the `path` option as follows.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
MongooseStudioModule.forRoot({
|
|
115
|
+
path: '/__studio', // Serve on `/__studio` rather than `/studio`
|
|
116
|
+
connectionToken: getConnectionToken()
|
|
117
|
+
})
|
|
118
|
+
```
|
|
119
|
+
|
|
88
120
|
### Netlify
|
|
89
121
|
|
|
90
122
|
[Here is a full example of how to add Mongoose Studio to a Netlify repo](https://github.com/mongoosejs/studio.mongoosejs.io/commit/8b02ea367c8a1b7b4bcab290708f57d58f08210b).
|
package/express.js
CHANGED
|
@@ -9,6 +9,8 @@ const normalizeBindIPOption = require('./backend/helpers/normalizeBindIPOption')
|
|
|
9
9
|
const { toRoute, objectRouter } = require('extrovert');
|
|
10
10
|
const { defaultMothershipURL } = require('./constants');
|
|
11
11
|
|
|
12
|
+
const jsonParser = express.json();
|
|
13
|
+
|
|
12
14
|
module.exports = async function mongooseStudioExpressApp(apiUrl, conn, options) {
|
|
13
15
|
const router = express.Router();
|
|
14
16
|
options = options ? { changeStream: true, ...options } : { changeStream: true };
|
|
@@ -95,7 +97,12 @@ module.exports = async function mongooseStudioExpressApp(apiUrl, conn, options)
|
|
|
95
97
|
return res.status(500).json({ message: err.message });
|
|
96
98
|
});
|
|
97
99
|
},
|
|
98
|
-
|
|
100
|
+
function parseJson(req, res, next) {
|
|
101
|
+
if (req.body !== undefined || req.readable === false) {
|
|
102
|
+
return next();
|
|
103
|
+
}
|
|
104
|
+
return jsonParser(req, res, next);
|
|
105
|
+
},
|
|
99
106
|
objectRouter(backend, toRoute)
|
|
100
107
|
);
|
|
101
108
|
|