DaveMoneyBraker opened a new issue, #88: URL: https://github.com/apache/casbin-typeorm-adapter/issues/88
Hi! We are upgrading a NestJS + PostgreSQL service to TypeORM 1.x and moved to [email protected], the first version that depends on typeorm ^1.0.0. Problem `lib/index.js` always re-exports `./casbinMongoRule`, and `lib/casbinMongoRule.js` does `require("mongodb")` at module load (line 26). However, `mongodb` is not listed in `dependencies`, `peerDependencies` or `optionalDependencies` of 1.10.0 (declared deps: casbin ^5.27.0, reflect-metadata ^0.2.2, typeorm ^1.0.0). As a result, any project that does not use MongoDB cannot load the adapter at all. Error: Cannot find module 'mongodb' In 1.7.0–1.9.0 `CasbinMongoRule` imported `ObjectId` from `typeorm`, so no extra package was needed; the regression appeared in 1.10.0 when the import switched to `mongodb`. Expected that loading the adapter for a SQL database (postgres/mysql/etc.) should not require the MongoDB driver. Possible fixes: make the `mongodb` import type-only / lazy (load CasbinMongoRule only when `type === 'mongodb'`), and declare `mongodb` as an optional peerDependency. Questions 1. Is a fix for this planned, and is there an expected release date for a version after 1.10.0? We noticed a related change (PR #82) may already be merged on master but not published to npm. 2. Until then, is installing `mongodb` alongside the adapter the recommended workaround? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
