#How can I use pulse which is Prisma's new preview feature what will PrismaService !?

6 messages · Page 1 of 1 (latest)

fresh oak
#

what will be Prisma Service with pulse, right now this is my prisma service
`import { PrismaClient } from '@prisma/client';
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}

async enableShutdownHooks(app: INestApplication) {
this.$on('beforeExit', async () => {
await app.close();
});
}
}`

hidden wadi
fresh oak
# hidden wadi if this is what you talk about: https://www.prisma.io/data-platform/pulse The yo...

this is not working rn i have tried to use it in that way but it's not showing subscribe there and showing error.
`@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$extends(withPulse({apiKey:"API KEY"});
await this.$connect();
}

async enableShutdownHooks(app: INestApplication) {
this.$on('beforeExit', async () => {
await app.close();
});
}
}https://prismaio.notion.site/Pulse-documentation-137ca256325d4a22b80b54a89975f059 here the doc that i have from prisma pulse about the installation and implementing new feature in TS // prisma.ts
import "dotenv/config";
import { PrismaClient } from "@prisma/client";
import { withPulse } from "@prisma/extension-pulse";

const apiKey: string =
process.env.PULSE_API_KEY !== undefined ? process.env.PULSE_API_KEY : "";
const prisma = new PrismaClient().$extends(withPulse({ apiKey: apiKey }));

// new line
export default prisma;`
this is how their implementation looks in TS idk about the nestjs how will i initlize the prisma with this

Prisma on Notion

What is Pulse

#

Its in EA right now maybe there would some sort of issue while using the pulse

hidden wadi
#

Right, you need the type to propagate to the service signature..

#

I don't know how to do that