g59 / nestjs-plugins Goto Github PK
View Code? Open in Web Editor NEW🦁 Module for NestJS
License: MIT License
🦁 Module for NestJS
License: MIT License
I'm making the switch to Yarn 2 and PNP, it's telling me:
Error: nestjs-firebase tried to access @nestjs/common, but it isn't declared in its dependencies
Please can it be added?
Hi! Tasnks for package!
I saw that your module doesn't have option isGlobal. How can I do module global without many imports to each extra module?
Hello, it seems that there is a peer dependency on @nestjs/common@^8.0.0
which prevents upgrading to v9.
npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR! @nestjs/common@"9.0.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^8.0.0" from [email protected]
npm ERR! node_modules/nestjs-firebase
npm ERR! nestjs-firebase@"8.2.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Hello,
I noticed that [email protected] npm package contains "compiled" code under the lib/ folder that does not match the corresponding typescript code.
As an example this "if" condition is not present in the compiled code:
nestjs-plugins/packages/nestjs-firebase/src/util/getFirebaseAdmin.ts
Lines 14 to 16 in 62a4f7c
Compiled code of the whole method:
const getFirebaseAdmin = (_a) => {
var { googleApplicationCredential: serviceAccountPath } = _a, options = __rest(_a, ["googleApplicationCredential"]);
const app = firebaseAdmin.initializeApp(Object.assign({ credential: serviceAccountPath
? firebaseAdmin.credential.cert(serviceAccountPath)
: undefined }, options));
return {
auth: app.auth(),
messaging: app.messaging(),
db: app.firestore(),
storage: app.storage(),
};
};
Please help make it support Nestjs v10.0.0
Property 'pageInfo' in type 'LanguageConnection' is not assignable to the same property in base type 'Connection'.
Type 'import("/node_modules/nestjs-graphql-relay/lib/pageInfo").PageInfo' is not assignable to type 'import("/node_modules/graphql-relay/connection/connection").PageInfo'.
Property 'startCursor' is optional in type 'PageInfo' but required in type 'PageInfo'.ts(2416)
(property) LanguageConnection.pageInfo: PageInfo
hello.
have u considered making nestjs-firebase module not @Global()
? i think generally it's better for module which is distributed to be local because one can always make it global by wrapping it into another global module but the opposite cannot be done.
consider the situation where you would want to restrict firebase usage to certain modules.
I will use the firebase emulators, and some project depends on this package, so I need something.
If this package haven't feature, I will try to develop it.
Hello,
I noticed that [email protected] npm package contains "compiled" code under the lib/ folder that does not match the corresponding typescript code.
As an example this "if" condition is not present in the compiled code:
nestjs-plugins/packages/nestjs-firebase/src/util/getFirebaseAdmin.ts
Lines 14 to 16 in 62a4f7c
Compiled code of the whole method:
const getFirebaseAdmin = (_a) => {
var { googleApplicationCredential: serviceAccountPath } = _a, options = __rest(_a, ["googleApplicationCredential"]);
const app = firebaseAdmin.initializeApp(Object.assign({ credential: serviceAccountPath
? firebaseAdmin.credential.cert(serviceAccountPath)
: undefined }, options));
return {
auth: app.auth(),
messaging: app.messaging(),
db: app.firestore(),
storage: app.storage(),
};
};
EDIT: About the duplicates I closed, I don't know how it happened, looks like a Github bug.
This is necessary for working in a federation. Currently we just copy pasted your file, but anyhow if you discard directives the schema should still compute just fine.
The @nestjs-firebase module currently does not support the latest version of nest/common (version 10.0.3) as a peer dependency. To ensure compatibility with the library's new version of nest/common, an update is required.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR! @nestjs/common@"^10.0.3" from the root project
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^9.0.0" from [email protected]
npm ERR! node_modules/nestjs-firebase
npm ERR! nestjs-firebase@"^9.0.0" from the root project
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
For detailed information, please refer to the official documentation
Migration Guide.
Hi. Once I trying install nestjs-firebase I got an error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR! @nestjs/common@"^9.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^8.0.0" from [email protected]
npm ERR! node_modules/nestjs-firebase
npm ERR! nestjs-firebase@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/marktanasevich/.npm/eresolve-report.txt for a full report.
Please help me solve this issue.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/actionlint.yml
actions/checkout v4
reviewdog/action-actionlint v1
.github/workflows/bump.yml
actions/checkout v4
actions/github-script v7
peter-evans/create-pull-request v5
.github/workflows/nodejs.yml
actions/checkout v4
actions/setup-node v4
codecov/codecov-action v3
.github/workflows/npm-publish-packages.yml
actions/checkout v4
actions/setup-node v4
actions/checkout v4
actions/setup-node v4
example/package.json
@apollo/server ^4.7.3
@as-integrations/fastify ^2.0.0
@nestjs/apollo ^12.0.0
@nestjs/cli ^10.0.0
@nestjs/config ^3.0.0
@nestjs/platform-fastify ^10.0.0
uuid ^9.0.0
@nestjs/testing ^10.0.0
@types/uuid ^9.0.2
package.json
@9renpoto/tsconfig ^7.6.0
@nestjs/testing ^10.0.0
@types/jest ^29.5.2
husky ^8.0.3
jest-mock-extended ^3.0.5
lint-staged ^15.0.0
ts-jest ^29.1.0
npm ^10.0.0
packages/nestjs-firebase/package.json
@google-cloud/firestore ^7.0.0
@google-cloud/storage ^7.0.0
@nestjs/common ^10.0.0
firebase-admin ^10.0.0 || ^11.0.0
packages/nestjs-graphql-relay/package.json
@types/validator ^13.7.17
@types/ws ^8.5.5
sqlite3 ^5.1.6
@apollo/gateway ^2.0.0
@nestjs/graphql ^12.0.0
@nestjs/typeorm ^10.0.0
graphql-relay ^0.10.0
ts-morph *
class-validator *
packages/nestjs-slack-webhook/package.json
@nestjs/common ^10.0.0
@slack/webhook ^6.0.0 || ^7.0.0
packages/nestjs-zendesk/package.json
@nestjs/testing ^10.0.0
node-zendesk ^5.0.0
Hello, I'm using credentials FirebaseAuthError, FirebaseError, FirebaseMessagingError but they don't export. My dependencies: firebase-admin: ^11.0.1, nestjs-firebase: ^8.2.3, nestjs version: 8.2. Do you can help me, please
node:internal/modules/cjs/loader:488
[0] throw e;
[0] ^
[0]
[0] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/utils/error' is not defined by "exports" in F:\dashboard\dashboard-nest-api\node_modules\fire
base-admin\package.json
[0] at new NodeError (node:internal/errors:371:5)
[0] at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
[0] at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
[0] at resolveExports (node:internal/modules/cjs/loader:482:36)
[0] at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
[0] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
[0] at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[0] at Module.require (node:internal/modules/cjs/loader:1005:19)
[0] at require (node:internal/modules/cjs/helpers:102:18)
[0] at Object. (F:\dashboard\dashboard-nest-api\build\financialAnalyst\financialAnalyst.service.js:23:17)
[0] at Module._compile (node:internal/modules/cjs/loader:1101:14)
[0] at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[0] at Module.load (node:internal/modules/cjs/loader:981:32)
[0] at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[0] at Module.require (node:internal/modules/cjs/loader:1005:19)
[0] at require (node:internal/modules/cjs/helpers:102:18) {
[0] code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
[0] }
import {FirebaseAuthError, FirebaseError, FirebaseMessagingError} from "firebase-admin/lib/utils/error";
return validationDataFinancialAnalyst$.pipe(
switchMap(err => iif(
() => Array.of(err).every(data => data === data),
from(this.rmq.send('', 'Valid data')),
throwError(err => of(new FirebaseMessagingError({code: '400', message: 'Data aren't valid'}))),
))
)
Hello, I have never contributed before to a project and I dont really know exactly how to integrate my code into a PR for this one, so if you can guide me through it and you like what I did, I'd be happy to.
https://github.com/Darkbound/nestjs-firebase
https://github.com/Darkbound/nestjs-firebase/tree/main/src/firebase here I have a FirebaseCollectionService
class that can be used to extend a NestjsController
and give it CRUD methods for collections (nested too) out of the box:
import { Injectable } from "@nestjs/common";
import { FirebaseAdmin } from "nestjs-firebase/lib/firebase.interface";
import { InjectFirebaseAdmin } from "nestjs-firebase/lib/firebase.decorator";
import { User } from "./entities/user.entity";
import { FirebaseCollectionService } from "src/firebase/firebase-collection.service";
import { UpdateUserCreditsDto } from "./dto/update-user-credits.dto";
@Injectable()
export class UserService extends FirebaseCollectionService<User> {
constructor(@InjectFirebaseAdmin() firebase: FirebaseAdmin) {
super(firebase, "users");
}
}
This is for a "level 1" collection, you instantiate it once for the service, give it firebase admin and the pattern of the collection path.
This will expose findOne, findAll, create, delete, update
methods to the controller.
Basically if you run nest generate resource user
and then delete the contents of the user.service.ts
and just extend with my FirebaseCollectionService
it will work directly with firebase
Now with purchase-transactions
which is a nested collection of users
, so users/{userId}/purchase-transactions/{transactionId}
, you instantiate it the same way, but the second argument is the path, with the keys that are going to change for each document:
// This type is only for the keys within the path to the collection, as the last key is the "normal" `id` that comes from the controller itself and it can be named anything.
type FirebaseCollectionPathParams = {
userId: string,
}
@Injectable()
export class PurchaseTransactionService extends FirebaseCollectionService<PurchaseTransaction, FirebaseCollectionPathParams> {
constructor(@InjectFirebaseAdmin() firebase: FirebaseAdmin) {
super(firebase, "users/{userId}/purchase-transactions");
}
}
The path that is being supplied is the path of the collection.
Now in purchase-transactions.controller.ts, if I want to get a certain transaction:
@Get(":transactionId")
findOne(@Param("userId") userId: string, @Param("transactionId") transactionId: string) {
return this.purchaseTransactionService.findOne(transactionId, { userId }); // Typescript for `userId` works
}
Let me know if you like it and would like it integrated, and if you can guide me through the process, I'd be more than happy to do it! :)
I guess it can probably be made into an Injectable module, just like your firebase admin, but I am still relatively new to Nestjs, so thats why I did not head that way :) Maybe that will be the next thing I will try to do...
Any recommendations are more than welcome!
How can we set ignoreUndefinedProperties? It was stated here to put it on initializeFirestore method but how can we do it here? Thanks [https://github.com/googleapis/nodejs-firestore/issues/1031]
Hello,
I noticed that [email protected] npm package contains "compiled" code under the lib/ folder that does not match the corresponding typescript code.
As an example this "if" condition is not present in the compiled code:
nestjs-plugins/packages/nestjs-firebase/src/util/getFirebaseAdmin.ts
Lines 14 to 16 in 62a4f7c
Compiled code of the whole method:
const getFirebaseAdmin = (_a) => {
var { googleApplicationCredential: serviceAccountPath } = _a, options = __rest(_a, ["googleApplicationCredential"]);
const app = firebaseAdmin.initializeApp(Object.assign({ credential: serviceAccountPath
? firebaseAdmin.credential.cert(serviceAccountPath)
: undefined }, options));
return {
auth: app.auth(),
messaging: app.messaging(),
db: app.firestore(),
storage: app.storage(),
};
};
When injecting the kysley module with InjectKysely
in NestJS 9 there is a type error:
TS1239: Unable to resolve signature of parameter decorator when called as an expression. Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.
This seems to be stemming from the fact that when the package is being published, it is being published with NestJS 8 as it's dependency, which results in the wrong typings for the decorator when using it in NestJS 9.
Hello all,
As legacy FCM API is deprecated and will be removed soon -- do I need to upgrade nestjs-firebase version?
Bumping version isn't a problem (just to know have I do it or not).
Current version of nestjs-firebase I use is 8.2.3.
Are there initialization/usage changes I have to do to enable new FCM API support?
Thanks in advance!
Hello,
I use this package, all is fine when I do this.firebase.firestore.(+something)
in my service.
I would like to add a value in an array (from Firestore) via FieldValue.arrayUnion()
but I am unable to retrieve FieldValue.
I tried FirebaseFirestore.FieldValue.arrayUnion()
, but FirebaseFirestore is not defined.
I would greatly appreciate your assistance.
With the current implementation, it accepts a single url string.
@Module({
imports: [
SlackModule.forRoot({
url: "SLACK_WEBHOOK_URL", // ref: https://api.slack.com/messaging/webhooks#posting_with_webhooks
}),
],
})
How do I configure the url
so that I can use different url
and post to different channels?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.