@skyiro/sky-client
v0.1.2
Published
Skyiro internal gRPC clients: Notifier + URL shortener, with typed product and event keys
Downloads
173
Readme
@skyiro/sky-client
Single dependency for Skyiro internal gRPC clients:
- Notifier —
NotifierClient(notifier.v1.NotifierService) - Short —
ShortenerClient(shortener.v1.ShortenerService)
Typed ProductKey, EventKey, and NotificationChannel mirror notifier Prisma enums and seeded events so callers cannot accidentally pass unknown keys (until you extend the enums when the server adds events).
Install
pnpm add @skyiro/sky-clientNotifier
import {
NotifierClient,
ProductKey,
EventKey,
NotificationChannel,
} from "@skyiro/sky-client";
const notifier = new NotifierClient(
process.env.NOTIFIER_GRPC_ADDRESS ?? "127.0.0.1:50510",
ProductKey.SkyOnelogin,
);
await notifier.publishEvent({
tenantId: "tenant-id",
eventKey: EventKey.LOGIN,
destinationAddress: ["[email protected]"],
channel: NotificationChannel.EMAIL,
payload: { otp: "123456" },
});
notifier.close();Override product per call with productKey on publishEvent / publishEmailEvent.
Shortener
import { ShortenerClient } from "@skyiro/sky-client";
const short = new ShortenerClient(
process.env.SHORTENER_GRPC_ADDRESS ?? "127.0.0.1:50052",
);
const { shortUrl } = await short.createShortUrl({
url: "https://example.com/a/long/url",
});
short.close();Proto files
Bundled under proto/ next to dist/ for runtime loading from __dirname.
