drej 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "drej",
3
+ "version": "0.1.0",
4
+ "main": "./src/index.ts",
5
+ "types": "./src/index.ts",
6
+ "scripts": {
7
+ "build": "bun build src/index.ts --outdir dist --target browser"
8
+ },
9
+ "devDependencies": {
10
+ "typescript": "latest"
11
+ }
12
+ }
package/src/client.ts ADDED
@@ -0,0 +1,17 @@
1
+ export interface DrejClientOptions {
2
+ baseUrl?: string;
3
+ }
4
+
5
+ export class DrejClient {
6
+ private baseUrl: string;
7
+
8
+ constructor(options: DrejClientOptions = {}) {
9
+ this.baseUrl = options.baseUrl ?? "http://localhost:3000";
10
+ }
11
+
12
+ async health(): Promise<{ healthy: boolean }> {
13
+ const res = await fetch(`${this.baseUrl}/health`);
14
+ if (!res.ok) throw new Error(`drej API error: ${res.status}`);
15
+ return res.json();
16
+ }
17
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { DrejClient } from "./client";
2
+ export type { DrejClientOptions } from "./client";