Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amplication/plugin-db-mongo

Package Overview
Dependencies
Maintainers
8
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplication/plugin-db-mongo - npm Package Compare versions

Comparing version 1.4.9-beta.1 to 1.4.9-beta.pr-297.80f0b66

.eslintrc.json

8

package.json
{
"name": "@amplication/plugin-db-mongo",
"version": "1.4.9-beta.1",
"version": "1.4.9-beta.pr-297.80f0b66",
"description": "Use a Mongo database in a service generated by Amplication",
"main": "dist/index.js",
"nx": {},
"scripts": {

@@ -16,3 +17,4 @@ "dev": "webpack --watch",

"devDependencies": {
"@amplication/code-gen-types": "^2.0.4",
"@amplication/code-gen-types": "^2.0.17",
"@amplication/code-gen-utils": "^0.0.7",
"@babel/parser": "^7.18.11",

@@ -31,3 +33,3 @@ "@babel/types": "^7.18.10",

"prettier": "^2.7.1",
"prisma-schema-dsl": "^2.1.6",
"prisma-schema-dsl": "^2.1.5",
"prisma-schema-dsl-types": "^1.1.1",

@@ -34,0 +36,0 @@ "rimraf": "^5.0.1",

# @amplication/plugin-db-mongo
[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-db-mongo)](https://www.npmjs.com/package/@amplication/plugin-db-mongo)
[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-db-mongo)](https://www.npmjs.com/package/@amplication/plugin-db-mongo)

@@ -11,14 +11,16 @@ Use a Mongo DB database in the service generated by Amplication.

It updates the following parts:
- Updates the datasource on the `schema.prisma` file:
- For versions older than `1.3.3` the datesource name is based on the database type
- MongoDB - the datasource name is `mongo`
- From version `1.3.3` the datasource name is `db`, no matter what is the database type
- For versions older than `1.3.3` the datesource name is based on the database type
- MongoDB - the datasource name is `mongo`
- From version `1.3.3` the datasource name is `db`, no matter what is the database type
- From version `1.3.3` as the datasouce name is `db`, all the custom attributes that use the `@{datasource.name}.{nameOfTheAttribute}` are replaced with `@db.{nameOfTheAttribute}`
- Adds the requires services and variables to `docker-compose.yml`
- Add the `db` service to the `docker-compose.dev.yml`
- Add the `db` service to the `docker-compose.dev.yml`
- Add the requires environment variables to `.env`
- Update package json file in order to support only the relevant prisma mongo commands
- Update package json file in order to support only the relevant prisma mongo commands
- Change prisma schema fields according to the prisma mongo conventions
## Configuration
The plugin uses the parameters configured on the database tab on the service settings page

@@ -28,6 +30,6 @@

## Usage
This plugin integrates with the all default tasks and scripts used by the generated service:
```json

@@ -44,2 +46,2 @@ "seed": "ts-node scripts/seed.ts",

"compose:down": "docker-compose down --volumes"
```
```

@@ -60,3 +60,3 @@ import {

private static autoIncrementDataTypeValidation(context: DsgContext): void {
beforeCreateServer(context: DsgContext, eventParams: CreateServerParams) {
const generateErrorMessage =

@@ -81,25 +81,3 @@ () => `The ID type: "Auto increment" is not supported by MongoDB Prisma provider.

}
}
private static decimalDataTypeValidation(context: DsgContext): void {
const generateErrorMessage =
() => `The 'Decimal' field type is currently not supported with MongoDB.
Please use an alternative field type.`;
const allDecimalFields = context.entities?.filter((entity) =>
entity.fields.find(
(field) => field.dataType === EnumDataType.DecimalNumber
)
);
if (allDecimalFields !== undefined && allDecimalFields.length > 0) {
context.logger.error(generateErrorMessage());
throw new Error(generateErrorMessage());
}
}
beforeCreateServer(context: DsgContext, eventParams: CreateServerParams) {
MongoPlugin.autoIncrementDataTypeValidation(context);
MongoPlugin.decimalDataTypeValidation(context);
return eventParams;

@@ -106,0 +84,0 @@ }

{
"extends": "../../tsconfig.base.json",
"include": [
"src/index.ts"
],
"exclude": [
"node_modules"
],
}
"include": ["src/index.ts"],
"exclude": ["node_modules"]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc