@ipetsadmin/api-client 1.1.0 → 1.1.1
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/CHANGELOG.md +14 -0
- package/README.md +48 -31
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
19
|
|
|
20
20
|
### Security
|
|
21
21
|
|
|
22
|
+
## [1.1.1] - 2026-04-25
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **`HttpPatch`** and **`HttpClient.patch`** for JSON bodies (Axios-compatible), used by email verification.
|
|
27
|
+
- **`patchVerifyEmail`** — `PATCH /api/v1/auth/verify-email` (`VerifyEmailRequest` from `@ipetsadmin/contracts`). Exposed as **`api.auth.verifyEmail`** and as a named export.
|
|
28
|
+
- **`fetchHealthCheck`** (`src/endpoints/health-check.ts`) — `GET /api/v1/health-check` returning **`IApiResponse<HealthCheck>`**.
|
|
29
|
+
- **`createApiClient`** exposes **`healthCheck()`** delegating to **`fetchHealthCheck`**.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- **`HttpClient`** now requires **`patch`** in addition to **`get`** and **`post`** (breaking for custom HTTP adapters that only implemented **`get`** / **`post`**).
|
|
34
|
+
- **Dev dependency** on **`@ipetsadmin/contracts`** raised to **1.1.7** for typings (`VerifyEmailRequest`, etc.). **Peer dependency** remains **`>= 1.1.1`**; use a contracts version that includes **`VerifyEmailRequest`** if you call **`patchVerifyEmail`**.
|
|
35
|
+
|
|
22
36
|
## [1.1.0] - 2026-04-04
|
|
23
37
|
|
|
24
38
|
### Added
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Typed HTTP client for the Truffa API. Consumed by web and mobile apps. **No bake
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
7
|
- **Node.js** ≥ 18.18
|
|
8
|
-
- **Peer dependency:** `@ipetsadmin/contracts` **≥ 1.1.
|
|
8
|
+
- **Peer dependency:** `@ipetsadmin/contracts` **≥ 1.1.1** (auth types, `VerifyEmailRequest`, and `IApiResponse` envelopes). Use a contracts version that includes any DTO you call (e.g. `VerifyEmailRequest` for **`verifyEmail`**).
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -17,28 +17,40 @@ npm install @ipetsadmin/api-client @ipetsadmin/contracts
|
|
|
17
17
|
|
|
18
18
|
## What ships today
|
|
19
19
|
|
|
20
|
-
| Export | Description
|
|
21
|
-
| -------------------------------------- |
|
|
22
|
-
| `createApiClient(options)` | Factory returning
|
|
23
|
-
| `ApiClient` / `CreateApiClientOptions` | Typed client and `{ http: HttpClient }` options
|
|
24
|
-
| `HttpClient` | **`get
|
|
25
|
-
| `HttpGet` / `HttpPost`
|
|
26
|
-
| Named
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
| Export | Description |
|
|
21
|
+
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `createApiClient(options)` | Factory returning **`healthCheck`** and **`auth`** namespace |
|
|
23
|
+
| `ApiClient` / `CreateApiClientOptions` | Typed client and `{ http: HttpClient }` options |
|
|
24
|
+
| `HttpClient` | **`get`**, **`post`**, and **`patch`** (minimal surface compatible with Axios) |
|
|
25
|
+
| `HttpGet` / `HttpPost` / `HttpPatch` | Method signatures |
|
|
26
|
+
| Named helpers | Same calls as `client.*` — see [`src/endpoints/auth.ts`](./src/endpoints/auth.ts) and [`src/endpoints/health-check.ts`](./src/endpoints/health-check.ts) |
|
|
27
|
+
|
|
28
|
+
### Parity with `@ipetsadmin/api-main`
|
|
29
|
+
|
|
30
|
+
The API currently mounts **one public JSON surface** used by this client (see `api-main` `server.ts` / `routes/auth.routes.ts`):
|
|
31
|
+
|
|
32
|
+
| Area | Server routes this client implements |
|
|
33
|
+
| ---------- | ------------------------------------ |
|
|
34
|
+
| **Health** | `GET /api/v1/health-check` |
|
|
35
|
+
| **Auth** | All routes under `/api/v1/auth/…` |
|
|
36
|
+
|
|
37
|
+
`api-main` also serves **OpenAPI** (`/api-docs`, `/api-docs.json`) when enabled; that is not wrapped here.
|
|
38
|
+
|
|
39
|
+
### Endpoints
|
|
40
|
+
|
|
41
|
+
| HTTP | Path | `createApiClient` | Named helper |
|
|
42
|
+
| ------- | ------------------------------------------------- | ---------------------------------------------- | ---------------------------------------- |
|
|
43
|
+
| `GET` | `/api/v1/health-check` | `client.healthCheck()` | `fetchHealthCheck(http)` |
|
|
44
|
+
| `POST` | `/api/v1/auth/register` | `client.auth.register(body)` | `postRegister(http, body)` |
|
|
45
|
+
| `POST` | `/api/v1/auth/login` | `client.auth.login(body)` | `postLogin(http, body)` |
|
|
46
|
+
| `GET` | `/api/v1/auth/oauth/google/start?redirectUri=...` | `client.auth.getGoogleOAuthStart(redirectUri)` | `getGoogleOAuthStart(http, redirectUri)` |
|
|
47
|
+
| `POST` | `/api/v1/auth/oauth/google/callback` | `client.auth.postGoogleOAuthCallback(body)` | `postGoogleOAuthCallback(http, body)` |
|
|
48
|
+
| `POST` | `/api/v1/auth/refresh` | `client.auth.refresh(body)` | `postRefresh(http, body)` |
|
|
49
|
+
| `POST` | `/api/v1/auth/logout` | `client.auth.logout(body)` | `postLogout(http, body)` |
|
|
50
|
+
| `PATCH` | `/api/v1/auth/verify-email` | `client.auth.verifyEmail(body)` | `patchVerifyEmail(http, body)` |
|
|
51
|
+
| `GET` | `/api/v1/auth/me` | `client.auth.me(accessToken)` | `getMe(http, accessToken)` |
|
|
52
|
+
|
|
53
|
+
Responses use **`IApiResponse<T>`** from contracts (`success`, `data`, etc.). Auth session payloads are **`AuthSessionResponse`** (`TokenPair` + `user`). **`logout`** returns **204** with no JSON body. **`verifyEmail`** success envelope matches the server (typically `data` may be empty).
|
|
42
54
|
|
|
43
55
|
### Usage example (Axios)
|
|
44
56
|
|
|
@@ -58,16 +70,20 @@ const api = createApiClient({ http });
|
|
|
58
70
|
|
|
59
71
|
const health = await api.healthCheck();
|
|
60
72
|
const session = await api.auth.login({ email: 'user@example.com', password: '********' });
|
|
61
|
-
// session
|
|
73
|
+
// session — IApiResponse<AuthSessionResponse>; with Axios, the HTTP body is axiosResponse.data
|
|
62
74
|
```
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
For **`IApiResponse<AuthSessionResponse>`**, the **envelope** is the JSON body; the **`AuthSessionResponse`** is usually **`response.data.data`** (outer `data` = Axios, inner `data` = API payload), depending on typings.
|
|
65
77
|
|
|
66
78
|
### OAuth (mobile / web)
|
|
67
79
|
|
|
68
80
|
1. Call **`getGoogleOAuthStart`** with the same **`redirectUri`** you registered in Auth0 and in the API’s `OAUTH_ALLOWED_REDIRECT_URIS`.
|
|
69
81
|
2. Open **`authorizationUrl`** in a browser / `ASWebAuthenticationSession`.
|
|
70
|
-
3. After redirect,
|
|
82
|
+
3. After redirect, send **`code`**, **`state`**, and **`redirectUri`** with **`postGoogleOAuthCallback`**.
|
|
83
|
+
|
|
84
|
+
### Email verification
|
|
85
|
+
|
|
86
|
+
Call **`api.auth.verifyEmail({ token })`** (or **`patchVerifyEmail`**) with the one-time token from the verification link your backend emails. Shapes: **`VerifyEmailRequest`** from `@ipetsadmin/contracts`.
|
|
71
87
|
|
|
72
88
|
### Why a factory?
|
|
73
89
|
|
|
@@ -77,20 +93,20 @@ Axios returns `{ data: body }` where `body` is the full JSON from the server. Fo
|
|
|
77
93
|
|
|
78
94
|
## Architecture
|
|
79
95
|
|
|
80
|
-
1. **`HttpClient`** — abstraction over
|
|
96
|
+
1. **`HttpClient`** — abstraction over **`get` / `post` / `patch`** (`{ data: T }` response shape, Axios-compatible).
|
|
81
97
|
2. **`src/endpoints/*.ts`** — thin functions: `(http, …args) => Promise<…>`.
|
|
82
|
-
3. **`createApiClient`** — wires `http` into endpoints.
|
|
83
|
-
4. **`@ipetsadmin/contracts`** — DTOs (`RegisterRequest`, `AuthSessionResponse`, …).
|
|
98
|
+
3. **`createApiClient`** — wires `http` into those endpoints.
|
|
99
|
+
4. **`@ipetsadmin/contracts`** — DTOs (`RegisterRequest`, `AuthSessionResponse`, `VerifyEmailRequest`, …).
|
|
84
100
|
|
|
85
101
|
### Extending further
|
|
86
102
|
|
|
87
|
-
|
|
103
|
+
Add methods on **`HttpClient`** in `src/http-client.ts`, then new endpoint modules. For query params, headers, and `Authorization`, align with your adapter (Axios passes a `config` object to **`get`**, **`post`**, and **`patch`**; **`getMe`** already sets `Authorization: Bearer` for the access token argument).
|
|
88
104
|
|
|
89
105
|
---
|
|
90
106
|
|
|
91
107
|
## Testing
|
|
92
108
|
|
|
93
|
-
Inject a fake **`HttpClient`** with **`get
|
|
109
|
+
Inject a fake **`HttpClient`** with **`get`**, **`post`**, and **`patch`** mocks and assert URLs and payloads.
|
|
94
110
|
|
|
95
111
|
```typescript
|
|
96
112
|
import type { HttpClient } from '@ipetsadmin/api-client';
|
|
@@ -99,6 +115,7 @@ import { createApiClient } from '@ipetsadmin/api-client';
|
|
|
99
115
|
const http: HttpClient = {
|
|
100
116
|
get: jest.fn().mockResolvedValue({ data: { success: true, data: {} } }),
|
|
101
117
|
post: jest.fn().mockResolvedValue({ data: { success: true, data: {} } }),
|
|
118
|
+
patch: jest.fn().mockResolvedValue({ data: { success: true } }),
|
|
102
119
|
};
|
|
103
120
|
|
|
104
121
|
const api = createApiClient({ http });
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RegisterRequest, IApiResponse, AuthSessionResponse, LoginRequest, OAuthGoogleStartResponse, OAuthGoogleCallbackRequest, RefreshRequest, LogoutRequest, AuthUserResponse, HealthCheck } from '@ipetsadmin/contracts';
|
|
1
|
+
import { RegisterRequest, IApiResponse, AuthSessionResponse, LoginRequest, OAuthGoogleStartResponse, OAuthGoogleCallbackRequest, RefreshRequest, LogoutRequest, VerifyEmailRequest, AuthUserResponse, HealthCheck } from '@ipetsadmin/contracts';
|
|
2
2
|
|
|
3
3
|
type HttpGet = <TResponse>(url: string, config?: unknown) => Promise<{
|
|
4
4
|
data: TResponse;
|
|
@@ -6,9 +6,13 @@ type HttpGet = <TResponse>(url: string, config?: unknown) => Promise<{
|
|
|
6
6
|
type HttpPost = <TResponse, TBody = unknown>(url: string, body?: TBody, config?: unknown) => Promise<{
|
|
7
7
|
data: TResponse;
|
|
8
8
|
}>;
|
|
9
|
+
type HttpPatch = <TResponse, TBody = unknown>(url: string, body?: TBody, config?: unknown) => Promise<{
|
|
10
|
+
data: TResponse;
|
|
11
|
+
}>;
|
|
9
12
|
interface HttpClient {
|
|
10
13
|
readonly get: HttpGet;
|
|
11
14
|
readonly post: HttpPost;
|
|
15
|
+
readonly patch: HttpPatch;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
declare function postRegister(http: HttpClient, body: RegisterRequest): Promise<IApiResponse<AuthSessionResponse>>;
|
|
@@ -18,6 +22,7 @@ declare function postGoogleOAuthCallback(http: HttpClient, body: OAuthGoogleCall
|
|
|
18
22
|
declare function postRefresh(http: HttpClient, body: RefreshRequest): Promise<IApiResponse<AuthSessionResponse>>;
|
|
19
23
|
declare function postLogout(http: HttpClient, body: LogoutRequest): Promise<void>;
|
|
20
24
|
declare function getMe(http: HttpClient, accessToken: string): Promise<IApiResponse<AuthUserResponse>>;
|
|
25
|
+
declare function patchVerifyEmail(http: HttpClient, body: VerifyEmailRequest): Promise<IApiResponse<void>>;
|
|
21
26
|
|
|
22
27
|
declare function fetchHealthCheck(http: HttpClient): Promise<IApiResponse<HealthCheck>>;
|
|
23
28
|
|
|
@@ -33,9 +38,10 @@ interface ApiClient {
|
|
|
33
38
|
readonly postGoogleOAuthCallback: (body: Parameters<typeof postGoogleOAuthCallback>[1]) => ReturnType<typeof postGoogleOAuthCallback>;
|
|
34
39
|
readonly refresh: (body: Parameters<typeof postRefresh>[1]) => ReturnType<typeof postRefresh>;
|
|
35
40
|
readonly logout: (body: Parameters<typeof postLogout>[1]) => ReturnType<typeof postLogout>;
|
|
41
|
+
readonly verifyEmail: (body: Parameters<typeof patchVerifyEmail>[1]) => ReturnType<typeof patchVerifyEmail>;
|
|
36
42
|
readonly me: (accessToken: string) => ReturnType<typeof getMe>;
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
declare function createApiClient(options: CreateApiClientOptions): ApiClient;
|
|
40
46
|
|
|
41
|
-
export { type ApiClient, type CreateApiClientOptions, type HttpClient, type HttpGet, type HttpPost, createApiClient, getGoogleOAuthStart, getMe, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|
|
47
|
+
export { type ApiClient, type CreateApiClientOptions, type HttpClient, type HttpGet, type HttpPatch, type HttpPost, createApiClient, getGoogleOAuthStart, getMe, patchVerifyEmail, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RegisterRequest, IApiResponse, AuthSessionResponse, LoginRequest, OAuthGoogleStartResponse, OAuthGoogleCallbackRequest, RefreshRequest, LogoutRequest, AuthUserResponse, HealthCheck } from '@ipetsadmin/contracts';
|
|
1
|
+
import { RegisterRequest, IApiResponse, AuthSessionResponse, LoginRequest, OAuthGoogleStartResponse, OAuthGoogleCallbackRequest, RefreshRequest, LogoutRequest, VerifyEmailRequest, AuthUserResponse, HealthCheck } from '@ipetsadmin/contracts';
|
|
2
2
|
|
|
3
3
|
type HttpGet = <TResponse>(url: string, config?: unknown) => Promise<{
|
|
4
4
|
data: TResponse;
|
|
@@ -6,9 +6,13 @@ type HttpGet = <TResponse>(url: string, config?: unknown) => Promise<{
|
|
|
6
6
|
type HttpPost = <TResponse, TBody = unknown>(url: string, body?: TBody, config?: unknown) => Promise<{
|
|
7
7
|
data: TResponse;
|
|
8
8
|
}>;
|
|
9
|
+
type HttpPatch = <TResponse, TBody = unknown>(url: string, body?: TBody, config?: unknown) => Promise<{
|
|
10
|
+
data: TResponse;
|
|
11
|
+
}>;
|
|
9
12
|
interface HttpClient {
|
|
10
13
|
readonly get: HttpGet;
|
|
11
14
|
readonly post: HttpPost;
|
|
15
|
+
readonly patch: HttpPatch;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
declare function postRegister(http: HttpClient, body: RegisterRequest): Promise<IApiResponse<AuthSessionResponse>>;
|
|
@@ -18,6 +22,7 @@ declare function postGoogleOAuthCallback(http: HttpClient, body: OAuthGoogleCall
|
|
|
18
22
|
declare function postRefresh(http: HttpClient, body: RefreshRequest): Promise<IApiResponse<AuthSessionResponse>>;
|
|
19
23
|
declare function postLogout(http: HttpClient, body: LogoutRequest): Promise<void>;
|
|
20
24
|
declare function getMe(http: HttpClient, accessToken: string): Promise<IApiResponse<AuthUserResponse>>;
|
|
25
|
+
declare function patchVerifyEmail(http: HttpClient, body: VerifyEmailRequest): Promise<IApiResponse<void>>;
|
|
21
26
|
|
|
22
27
|
declare function fetchHealthCheck(http: HttpClient): Promise<IApiResponse<HealthCheck>>;
|
|
23
28
|
|
|
@@ -33,9 +38,10 @@ interface ApiClient {
|
|
|
33
38
|
readonly postGoogleOAuthCallback: (body: Parameters<typeof postGoogleOAuthCallback>[1]) => ReturnType<typeof postGoogleOAuthCallback>;
|
|
34
39
|
readonly refresh: (body: Parameters<typeof postRefresh>[1]) => ReturnType<typeof postRefresh>;
|
|
35
40
|
readonly logout: (body: Parameters<typeof postLogout>[1]) => ReturnType<typeof postLogout>;
|
|
41
|
+
readonly verifyEmail: (body: Parameters<typeof patchVerifyEmail>[1]) => ReturnType<typeof patchVerifyEmail>;
|
|
36
42
|
readonly me: (accessToken: string) => ReturnType<typeof getMe>;
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
declare function createApiClient(options: CreateApiClientOptions): ApiClient;
|
|
40
46
|
|
|
41
|
-
export { type ApiClient, type CreateApiClientOptions, type HttpClient, type HttpGet, type HttpPost, createApiClient, getGoogleOAuthStart, getMe, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|
|
47
|
+
export { type ApiClient, type CreateApiClientOptions, type HttpClient, type HttpGet, type HttpPatch, type HttpPost, createApiClient, getGoogleOAuthStart, getMe, patchVerifyEmail, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,13 @@ async function getMe(http, accessToken) {
|
|
|
46
46
|
});
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
|
+
async function patchVerifyEmail(http, body) {
|
|
50
|
+
const { data } = await http.patch(
|
|
51
|
+
`${AUTH_BASE}/verify-email`,
|
|
52
|
+
body
|
|
53
|
+
);
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
49
56
|
|
|
50
57
|
// src/endpoints/health-check.ts
|
|
51
58
|
var HEALTH_CHECK_PATH = "/api/v1/health-check";
|
|
@@ -66,6 +73,7 @@ function createApiClient(options) {
|
|
|
66
73
|
postGoogleOAuthCallback: (body) => postGoogleOAuthCallback(http, body),
|
|
67
74
|
refresh: (body) => postRefresh(http, body),
|
|
68
75
|
logout: (body) => postLogout(http, body),
|
|
76
|
+
verifyEmail: (body) => patchVerifyEmail(http, body),
|
|
69
77
|
me: (accessToken) => getMe(http, accessToken)
|
|
70
78
|
}
|
|
71
79
|
};
|
|
@@ -74,6 +82,7 @@ function createApiClient(options) {
|
|
|
74
82
|
exports.createApiClient = createApiClient;
|
|
75
83
|
exports.getGoogleOAuthStart = getGoogleOAuthStart;
|
|
76
84
|
exports.getMe = getMe;
|
|
85
|
+
exports.patchVerifyEmail = patchVerifyEmail;
|
|
77
86
|
exports.postGoogleOAuthCallback = postGoogleOAuthCallback;
|
|
78
87
|
exports.postLogin = postLogin;
|
|
79
88
|
exports.postLogout = postLogout;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/endpoints/auth.ts","../src/endpoints/health-check.ts","../src/create-api-client.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/endpoints/auth.ts","../src/endpoints/health-check.ts","../src/create-api-client.ts"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import type {\n AuthSessionResponse,\n AuthUserResponse,\n IApiResponse,\n LoginRequest,\n LogoutRequest,\n OAuthGoogleCallbackRequest,\n OAuthGoogleStartResponse,\n RefreshRequest,\n RegisterRequest,\n VerifyEmailRequest,\n} from '@ipetsadmin/contracts';\n\nimport type { HttpClient } from '../http-client';\n\nconst AUTH_BASE = '/api/v1/auth' as const;\n\n/**\n * POST /api/v1/auth/register\n */\nexport async function postRegister(\n http: HttpClient,\n body: RegisterRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, RegisterRequest>(\n `${AUTH_BASE}/register`,\n body,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/login\n */\nexport async function postLogin(\n http: HttpClient,\n body: LoginRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, LoginRequest>(\n `${AUTH_BASE}/login`,\n body,\n );\n return data;\n}\n\n/**\n * GET /api/v1/auth/oauth/google/start?redirectUri=...\n */\nexport async function getGoogleOAuthStart(\n http: HttpClient,\n redirectUri: string,\n): Promise<IApiResponse<OAuthGoogleStartResponse>> {\n const q = new URLSearchParams({ redirectUri });\n const { data } = await http.get<IApiResponse<OAuthGoogleStartResponse>>(\n `${AUTH_BASE}/oauth/google/start?${q.toString()}`,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/oauth/google/callback\n */\nexport async function postGoogleOAuthCallback(\n http: HttpClient,\n body: OAuthGoogleCallbackRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, OAuthGoogleCallbackRequest>(\n `${AUTH_BASE}/oauth/google/callback`,\n body,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/refresh\n */\nexport async function postRefresh(\n http: HttpClient,\n body: RefreshRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, RefreshRequest>(\n `${AUTH_BASE}/refresh`,\n body,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/logout — 204 No Content (no JSON body).\n */\nexport async function postLogout(http: HttpClient, body: LogoutRequest): Promise<void> {\n await http.post<undefined, LogoutRequest>(`${AUTH_BASE}/logout`, body);\n}\n\n/**\n * GET /api/v1/auth/me — requires `Authorization: Bearer <accessToken>`.\n */\nexport async function getMe(\n http: HttpClient,\n accessToken: string,\n): Promise<IApiResponse<AuthUserResponse>> {\n const { data } = await http.get<IApiResponse<AuthUserResponse>>(`${AUTH_BASE}/me`, {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n return data;\n}\n\n/**\n * PATCH /api/v1/auth/verify-email\n */\nexport async function patchVerifyEmail(\n http: HttpClient,\n body: VerifyEmailRequest,\n): Promise<IApiResponse<void>> {\n const { data } = await http.patch<IApiResponse<void>, VerifyEmailRequest>(\n `${AUTH_BASE}/verify-email`,\n body,\n );\n return data;\n}\n","import type { IApiResponse, HealthCheck } from '@ipetsadmin/contracts';\nimport type { HttpClient } from '../http-client';\n\n/** Same path as `/api/${v1}/health-check` on the server when `v1` is the string `'v1'`. */\nconst HEALTH_CHECK_PATH = '/api/v1/health-check' as const;\n\n/**\n * GET /api/v1/health-check — server liveness.\n *\n * Returns the full JSON the server sends (`IApiResponse<HealthCheck>`).\n *\n * **Why not `data.data` here?** Adapters like Axios wrap the HTTP body in a property also\n * called `data`. That outer `data` is the entire `res.json(...)` object. The inner\n * `IApiResponse.data` is the `HealthCheck` payload — use `.data` on the **returned** value,\n * e.g. `(await fetchHealthCheck(http)).data`.\n */\nexport async function fetchHealthCheck(http: HttpClient): Promise<IApiResponse<HealthCheck>> {\n const { data: body } = await http.get<IApiResponse<HealthCheck>>(HEALTH_CHECK_PATH);\n\n return body;\n}\n","import {\n getGoogleOAuthStart,\n getMe,\n patchVerifyEmail,\n postGoogleOAuthCallback,\n postLogin,\n postLogout,\n postRefresh,\n postRegister,\n} from './endpoints/auth';\nimport { fetchHealthCheck } from './endpoints/health-check';\nimport type { HttpClient } from './http-client';\n\nexport interface CreateApiClientOptions {\n /**\n * Preconfigured HTTP client (e.g. Axios instance with `baseURL` set).\n * Paths in this library are relative to that base (e.g. `/api/v1/...`).\n * Both `get` and `post` are required for auth flows.\n */\n readonly http: HttpClient;\n}\n\nexport interface ApiClient {\n readonly healthCheck: () => ReturnType<typeof fetchHealthCheck>;\n readonly auth: {\n readonly register: (\n body: Parameters<typeof postRegister>[1],\n ) => ReturnType<typeof postRegister>;\n readonly login: (body: Parameters<typeof postLogin>[1]) => ReturnType<typeof postLogin>;\n readonly getGoogleOAuthStart: (redirectUri: string) => ReturnType<typeof getGoogleOAuthStart>;\n readonly postGoogleOAuthCallback: (\n body: Parameters<typeof postGoogleOAuthCallback>[1],\n ) => ReturnType<typeof postGoogleOAuthCallback>;\n readonly refresh: (body: Parameters<typeof postRefresh>[1]) => ReturnType<typeof postRefresh>;\n readonly logout: (body: Parameters<typeof postLogout>[1]) => ReturnType<typeof postLogout>;\n readonly verifyEmail: (\n body: Parameters<typeof patchVerifyEmail>[1],\n ) => ReturnType<typeof patchVerifyEmail>;\n readonly me: (accessToken: string) => ReturnType<typeof getMe>;\n };\n}\n\n/**\n * Creates a typed API client backed by the provided HTTP implementation.\n */\nexport function createApiClient(options: CreateApiClientOptions): ApiClient {\n const { http } = options;\n\n return {\n healthCheck: () => fetchHealthCheck(http),\n auth: {\n register: (body) => postRegister(http, body),\n login: (body) => postLogin(http, body),\n getGoogleOAuthStart: (redirectUri) => getGoogleOAuthStart(http, redirectUri),\n postGoogleOAuthCallback: (body) => postGoogleOAuthCallback(http, body),\n refresh: (body) => postRefresh(http, body),\n logout: (body) => postLogout(http, body),\n verifyEmail: (body) => patchVerifyEmail(http, body),\n me: (accessToken) => getMe(http, accessToken),\n },\n };\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -44,6 +44,13 @@ async function getMe(http, accessToken) {
|
|
|
44
44
|
});
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
|
+
async function patchVerifyEmail(http, body) {
|
|
48
|
+
const { data } = await http.patch(
|
|
49
|
+
`${AUTH_BASE}/verify-email`,
|
|
50
|
+
body
|
|
51
|
+
);
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
47
54
|
|
|
48
55
|
// src/endpoints/health-check.ts
|
|
49
56
|
var HEALTH_CHECK_PATH = "/api/v1/health-check";
|
|
@@ -64,11 +71,12 @@ function createApiClient(options) {
|
|
|
64
71
|
postGoogleOAuthCallback: (body) => postGoogleOAuthCallback(http, body),
|
|
65
72
|
refresh: (body) => postRefresh(http, body),
|
|
66
73
|
logout: (body) => postLogout(http, body),
|
|
74
|
+
verifyEmail: (body) => patchVerifyEmail(http, body),
|
|
67
75
|
me: (accessToken) => getMe(http, accessToken)
|
|
68
76
|
}
|
|
69
77
|
};
|
|
70
78
|
}
|
|
71
79
|
|
|
72
|
-
export { createApiClient, getGoogleOAuthStart, getMe, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|
|
80
|
+
export { createApiClient, getGoogleOAuthStart, getMe, patchVerifyEmail, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|
|
73
81
|
//# sourceMappingURL=index.mjs.map
|
|
74
82
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/endpoints/auth.ts","../src/endpoints/health-check.ts","../src/create-api-client.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/endpoints/auth.ts","../src/endpoints/health-check.ts","../src/create-api-client.ts"],"names":[],"mappings":"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","file":"index.mjs","sourcesContent":["import type {\n AuthSessionResponse,\n AuthUserResponse,\n IApiResponse,\n LoginRequest,\n LogoutRequest,\n OAuthGoogleCallbackRequest,\n OAuthGoogleStartResponse,\n RefreshRequest,\n RegisterRequest,\n VerifyEmailRequest,\n} from '@ipetsadmin/contracts';\n\nimport type { HttpClient } from '../http-client';\n\nconst AUTH_BASE = '/api/v1/auth' as const;\n\n/**\n * POST /api/v1/auth/register\n */\nexport async function postRegister(\n http: HttpClient,\n body: RegisterRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, RegisterRequest>(\n `${AUTH_BASE}/register`,\n body,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/login\n */\nexport async function postLogin(\n http: HttpClient,\n body: LoginRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, LoginRequest>(\n `${AUTH_BASE}/login`,\n body,\n );\n return data;\n}\n\n/**\n * GET /api/v1/auth/oauth/google/start?redirectUri=...\n */\nexport async function getGoogleOAuthStart(\n http: HttpClient,\n redirectUri: string,\n): Promise<IApiResponse<OAuthGoogleStartResponse>> {\n const q = new URLSearchParams({ redirectUri });\n const { data } = await http.get<IApiResponse<OAuthGoogleStartResponse>>(\n `${AUTH_BASE}/oauth/google/start?${q.toString()}`,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/oauth/google/callback\n */\nexport async function postGoogleOAuthCallback(\n http: HttpClient,\n body: OAuthGoogleCallbackRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, OAuthGoogleCallbackRequest>(\n `${AUTH_BASE}/oauth/google/callback`,\n body,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/refresh\n */\nexport async function postRefresh(\n http: HttpClient,\n body: RefreshRequest,\n): Promise<IApiResponse<AuthSessionResponse>> {\n const { data } = await http.post<IApiResponse<AuthSessionResponse>, RefreshRequest>(\n `${AUTH_BASE}/refresh`,\n body,\n );\n return data;\n}\n\n/**\n * POST /api/v1/auth/logout — 204 No Content (no JSON body).\n */\nexport async function postLogout(http: HttpClient, body: LogoutRequest): Promise<void> {\n await http.post<undefined, LogoutRequest>(`${AUTH_BASE}/logout`, body);\n}\n\n/**\n * GET /api/v1/auth/me — requires `Authorization: Bearer <accessToken>`.\n */\nexport async function getMe(\n http: HttpClient,\n accessToken: string,\n): Promise<IApiResponse<AuthUserResponse>> {\n const { data } = await http.get<IApiResponse<AuthUserResponse>>(`${AUTH_BASE}/me`, {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n return data;\n}\n\n/**\n * PATCH /api/v1/auth/verify-email\n */\nexport async function patchVerifyEmail(\n http: HttpClient,\n body: VerifyEmailRequest,\n): Promise<IApiResponse<void>> {\n const { data } = await http.patch<IApiResponse<void>, VerifyEmailRequest>(\n `${AUTH_BASE}/verify-email`,\n body,\n );\n return data;\n}\n","import type { IApiResponse, HealthCheck } from '@ipetsadmin/contracts';\nimport type { HttpClient } from '../http-client';\n\n/** Same path as `/api/${v1}/health-check` on the server when `v1` is the string `'v1'`. */\nconst HEALTH_CHECK_PATH = '/api/v1/health-check' as const;\n\n/**\n * GET /api/v1/health-check — server liveness.\n *\n * Returns the full JSON the server sends (`IApiResponse<HealthCheck>`).\n *\n * **Why not `data.data` here?** Adapters like Axios wrap the HTTP body in a property also\n * called `data`. That outer `data` is the entire `res.json(...)` object. The inner\n * `IApiResponse.data` is the `HealthCheck` payload — use `.data` on the **returned** value,\n * e.g. `(await fetchHealthCheck(http)).data`.\n */\nexport async function fetchHealthCheck(http: HttpClient): Promise<IApiResponse<HealthCheck>> {\n const { data: body } = await http.get<IApiResponse<HealthCheck>>(HEALTH_CHECK_PATH);\n\n return body;\n}\n","import {\n getGoogleOAuthStart,\n getMe,\n patchVerifyEmail,\n postGoogleOAuthCallback,\n postLogin,\n postLogout,\n postRefresh,\n postRegister,\n} from './endpoints/auth';\nimport { fetchHealthCheck } from './endpoints/health-check';\nimport type { HttpClient } from './http-client';\n\nexport interface CreateApiClientOptions {\n /**\n * Preconfigured HTTP client (e.g. Axios instance with `baseURL` set).\n * Paths in this library are relative to that base (e.g. `/api/v1/...`).\n * Both `get` and `post` are required for auth flows.\n */\n readonly http: HttpClient;\n}\n\nexport interface ApiClient {\n readonly healthCheck: () => ReturnType<typeof fetchHealthCheck>;\n readonly auth: {\n readonly register: (\n body: Parameters<typeof postRegister>[1],\n ) => ReturnType<typeof postRegister>;\n readonly login: (body: Parameters<typeof postLogin>[1]) => ReturnType<typeof postLogin>;\n readonly getGoogleOAuthStart: (redirectUri: string) => ReturnType<typeof getGoogleOAuthStart>;\n readonly postGoogleOAuthCallback: (\n body: Parameters<typeof postGoogleOAuthCallback>[1],\n ) => ReturnType<typeof postGoogleOAuthCallback>;\n readonly refresh: (body: Parameters<typeof postRefresh>[1]) => ReturnType<typeof postRefresh>;\n readonly logout: (body: Parameters<typeof postLogout>[1]) => ReturnType<typeof postLogout>;\n readonly verifyEmail: (\n body: Parameters<typeof patchVerifyEmail>[1],\n ) => ReturnType<typeof patchVerifyEmail>;\n readonly me: (accessToken: string) => ReturnType<typeof getMe>;\n };\n}\n\n/**\n * Creates a typed API client backed by the provided HTTP implementation.\n */\nexport function createApiClient(options: CreateApiClientOptions): ApiClient {\n const { http } = options;\n\n return {\n healthCheck: () => fetchHealthCheck(http),\n auth: {\n register: (body) => postRegister(http, body),\n login: (body) => postLogin(http, body),\n getGoogleOAuthStart: (redirectUri) => getGoogleOAuthStart(http, redirectUri),\n postGoogleOAuthCallback: (body) => postGoogleOAuthCallback(http, body),\n refresh: (body) => postRefresh(http, body),\n logout: (body) => postLogout(http, body),\n verifyEmail: (body) => patchVerifyEmail(http, body),\n me: (accessToken) => getMe(http, accessToken),\n },\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ipetsadmin/api-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Client used to interact with Truffa project API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"author": "",
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@ipetsadmin/contracts": "1.1.
|
|
41
|
+
"@ipetsadmin/contracts": "1.1.7",
|
|
42
42
|
"@eslint/js": "^10.0.1",
|
|
43
43
|
"@types/express": "^5.0.5",
|
|
44
44
|
"@types/node": "^24.10.0",
|