@amplication/plugin-db-mongo
Advanced tools
Comparing version 1.2.8 to 1.2.9
@@ -7,2 +7,3 @@ import { AmplicationPlugin, CreatePrismaSchemaParams, CreateServerDockerComposeDBParams, CreateServerDockerComposeParams, CreateServerDotEnvParams, CreateServerPackageJsonParams, CreateServerParams, DsgContext, Entity, Events, LoadStaticFilesParams, Module } from "@amplication/code-gen-types"; | ||
beforeCreateServerDotEnv(context: DsgContext, eventParams: CreateServerDotEnvParams): CreateServerDotEnvParams; | ||
afterCreateServerDockerCompose(dsgContext: DsgContext, eventParams: CreateServerDockerComposeParams, modules: Module[]): Module[]; | ||
beforeCreateServerDockerCompose(context: DsgContext, eventParams: CreateServerDockerComposeParams): CreateServerDockerComposeParams; | ||
@@ -9,0 +10,0 @@ beforeCreateServerDockerComposeDB(context: DsgContext, eventParams: CreateServerDockerComposeDBParams): CreateServerDockerComposeDBParams; |
{ | ||
"name": "@amplication/plugin-db-mongo", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "Use a Mongo database in a service generated by Amplication", | ||
@@ -35,3 +35,4 @@ "main": "dist/index.js", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^5.0.1" | ||
"webpack-cli": "^5.0.1", | ||
"yaml": "^2.2.1" | ||
}, | ||
@@ -54,2 +55,2 @@ "jest": { | ||
} | ||
} | ||
} |
import { CreateServerDockerComposeParams } from "@amplication/code-gen-types"; | ||
import { DataSource, DataSourceProvider } from "prisma-schema-dsl-types"; | ||
const mongodbVolumeName = "mongodb"; | ||
export const updateDockerComposeProperties: CreateServerDockerComposeParams["updateProperties"] = | ||
@@ -20,21 +22,7 @@ [ | ||
}, | ||
volumes: ["mongodb:/var/lib/mongosql/data"], | ||
healthcheck: { | ||
test: [ | ||
"CMD", | ||
"pg_isready", | ||
"-q", | ||
"-d", | ||
"${DB_DB_NAME}", | ||
"-U", | ||
"${DB_USER}", | ||
], | ||
timeout: "45s", | ||
interval: "10s", | ||
retries: 10, | ||
}, | ||
volumes: [`${mongodbVolumeName}:/var/lib/mongosql/data`], | ||
}, | ||
}, | ||
volumes: { | ||
mongo: null, | ||
[mongodbVolumeName]: null, | ||
}, | ||
@@ -41,0 +29,0 @@ }, |
@@ -30,2 +30,3 @@ import { | ||
import { dataSource, updateDockerComposeProperties } from "./constants"; | ||
import YAML from "yaml"; | ||
@@ -43,2 +44,3 @@ class MongoPlugin implements AmplicationPlugin { | ||
before: this.beforeCreateServerDockerCompose, | ||
after: this.afterCreateServerDockerCompose, | ||
}, | ||
@@ -129,2 +131,19 @@ CreateServerDockerComposeDB: { | ||
afterCreateServerDockerCompose( | ||
dsgContext: DsgContext, | ||
eventParams: CreateServerDockerComposeParams, | ||
modules: Module[] | ||
): Module[] { | ||
const dockerCompose = modules[0]; | ||
const dockerComposeObject: { services: { migrate: { depends_on: any } } } = | ||
YAML.parse(dockerCompose.code); | ||
try { | ||
dockerComposeObject.services.migrate.depends_on = undefined; | ||
} catch (error) {} | ||
const updatedDockerCompose = YAML.stringify(dockerComposeObject, { | ||
nullStr: "~", | ||
}); | ||
modules[0] = { ...dockerCompose, code: updatedDockerCompose }; | ||
return modules; | ||
} | ||
beforeCreateServerDockerCompose( | ||
@@ -131,0 +150,0 @@ context: DsgContext, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2013824
25985
22
4