import { Injectable } from "@nestjs/common"; @Injectable() export class CursorService { /** * Encode an ID to a cursor */ encode(id: string): string { return Buffer.from(id).toString("base64"); } /** * Decode a cursor to get the ID */ decode(cursor: string): string { return Buffer.from(cursor, "base64").toString("utf-8"); } }