How do I achieve GenericIdGenerator pattern with a Typescipt Express app?

For context my code is in Typescript, Express framework, database in postgres, using drizzleORM for database mapping, and I need to achieve something like the below code (Java/Hibernate) to create purchaseId’s when adding new records to the purchase table,

I don’t want solutions like getting the last record and incrementing +1, I want it to sync with the native database sequence so that even if I delete the last record (lets say P0000000010), the next record should be P0000000011 unless I reset the sequence manually

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generic-generator")
@GenericGenerator(name = "generic-generator",
        parameters = {
                @org.hibernate.annotations.Parameter(name = "prefix", value = "P"),
                @org.hibernate.annotations.Parameter(name = "digits", value = "9"),
                @org.hibernate.annotations.Parameter(name = "initial_id", value = "100000000"),
        },
        strategy = "com.myapp.example.backend.persistance.jparepository.generators.GenericIdGenerator")
String id;