@vibesdotdev/client 0.1.0 → 0.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/README.md +22 -0
- package/package.json +8 -10
- package/SPEC.md +0 -107
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @vibesdotdev/client
|
|
2
|
+
|
|
3
|
+
Base API client utilities with Vibes runtime integration.
|
|
4
|
+
|
|
5
|
+
This package is part of the public Vibes framework package set. The source repository is private while the public repository split is being prepared, so package documentation is published on the Vibes docs site.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
bun add @vibesdotdev/client
|
|
11
|
+
# or
|
|
12
|
+
npm install @vibesdotdev/client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
- Package guide: https://docs.vibes.dev/packages/client
|
|
18
|
+
- Vibes docs: https://docs.vibes.dev
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/client",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Base API client with runtime
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Base API client utilities with Vibes runtime integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -53,14 +53,9 @@
|
|
|
53
53
|
"registry": "https://registry.npmjs.org",
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"repository": {
|
|
57
|
-
"type": "git",
|
|
58
|
-
"url": "git+https://github.com/vibesdotdev/monorepo.git",
|
|
59
|
-
"directory": "packages/client"
|
|
60
|
-
},
|
|
61
56
|
"dependencies": {
|
|
62
|
-
"@vibesdotdev/runtime": "0.0.
|
|
63
|
-
"@vibesdotdev/logging": "0.0.
|
|
57
|
+
"@vibesdotdev/runtime": "0.0.2",
|
|
58
|
+
"@vibesdotdev/logging": "0.0.2",
|
|
64
59
|
"zod": "^4.3.6"
|
|
65
60
|
},
|
|
66
61
|
"scripts": {
|
|
@@ -74,7 +69,6 @@
|
|
|
74
69
|
"src",
|
|
75
70
|
"bin",
|
|
76
71
|
"README.md",
|
|
77
|
-
"SPEC.md",
|
|
78
72
|
"LICENSE",
|
|
79
73
|
"!src/**/__tests__/**",
|
|
80
74
|
"!src/**/__stubs__/**",
|
|
@@ -95,5 +89,9 @@
|
|
|
95
89
|
],
|
|
96
90
|
"vibes": {
|
|
97
91
|
"visibility": "public-framework"
|
|
92
|
+
},
|
|
93
|
+
"homepage": "https://docs.vibes.dev/packages/client",
|
|
94
|
+
"bugs": {
|
|
95
|
+
"url": "https://docs.vibes.dev/packages/client#support"
|
|
98
96
|
}
|
|
99
97
|
}
|
package/SPEC.md
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# Client Package SPEC
|
|
2
|
-
|
|
3
|
-
**Status:** Production
|
|
4
|
-
**Package:** `@vibesdotdev/client`
|
|
5
|
-
**Location:** `packages/client`
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Base API client with runtime kind integration and per-app client factories. Wraps `@vibesdotdev/kit`'s VibesClient with a standardized `ApiClientImplementation` interface and registers `api/client` as a runtime kind for descriptor-based client resolution.
|
|
10
|
-
|
|
11
|
-
## Architecture
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
+-----------------------------------------------------------------------+
|
|
15
|
-
| Client Package |
|
|
16
|
-
+-----------------------------------------------------------------------+
|
|
17
|
-
| FACTORY |
|
|
18
|
-
| ------- |
|
|
19
|
-
| vibesApiClient(config) -> Create API client from config |
|
|
20
|
-
| fromVibesClient(client) -> Wrap existing VibesClient |
|
|
21
|
-
| ApiClientConfig -> baseUrl, auth, fetch, timeout, headers |
|
|
22
|
-
+-----------------------------------------------------------------------+
|
|
23
|
-
| SCHEMAS |
|
|
24
|
-
| ------- |
|
|
25
|
-
| ApiClientDescriptor -> Runtime descriptor for api/client kind |
|
|
26
|
-
| kind: 'api/client' -> Runtime kind identifier |
|
|
27
|
-
| baseUrl, timeout, debug -> Per-client configuration |
|
|
28
|
-
| ApiClientImplementation -> Standard interface: get/post/put/delete |
|
|
29
|
-
| ApiRequestOptions -> query, headers, timeout, params |
|
|
30
|
-
+-----------------------------------------------------------------------+
|
|
31
|
-
| RUNTIME PLUGIN |
|
|
32
|
-
| -------------- |
|
|
33
|
-
| clientPlugin -> Registers 'api/client' kind |
|
|
34
|
-
| DefaultApiClient -> Default implementation from descriptor |
|
|
35
|
-
| Runtime query: |
|
|
36
|
-
| runtime.query('api/client').withId('auth').resolve() |
|
|
37
|
-
+-----------------------------------------------------------------------+
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Key Exports
|
|
41
|
-
|
|
42
|
-
### Factory (`@vibesdotdev/client` or `@vibesdotdev/client/factory`)
|
|
43
|
-
- `vibesApiClient(config?)` -- Create new API client instance
|
|
44
|
-
- `fromVibesClient(client)` -- Wrap existing VibesClient
|
|
45
|
-
- `ApiClientConfig` -- Configuration type
|
|
46
|
-
|
|
47
|
-
### Schemas (`@vibesdotdev/client/schemas`)
|
|
48
|
-
- `ApiClientDescriptor` -- Runtime descriptor interface
|
|
49
|
-
- `ApiClientDescriptorSchema` -- Zod validation schema
|
|
50
|
-
- `ApiClientImplementation` -- Standard client interface (get/post/put/delete/request)
|
|
51
|
-
- `ApiRequestOptions` -- Per-request options (query, headers, timeout, params)
|
|
52
|
-
|
|
53
|
-
### Plugin (`@vibesdotdev/client/plugin`)
|
|
54
|
-
- `clientPlugin` -- Runtime plugin registering `api/client` kind
|
|
55
|
-
- Enables `runtime.query('api/client').withId('auth').resolve()`
|
|
56
|
-
|
|
57
|
-
## ApiClientImplementation Interface
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
interface ApiClientImplementation {
|
|
61
|
-
get<T>(endpoint: string, options?: ApiRequestOptions): Promise<T>;
|
|
62
|
-
post<T>(endpoint: string, body?: unknown, options?: ApiRequestOptions): Promise<T>;
|
|
63
|
-
put<T>(endpoint: string, body?: unknown, options?: ApiRequestOptions): Promise<T>;
|
|
64
|
-
delete<T>(endpoint: string, options?: ApiRequestOptions): Promise<T>;
|
|
65
|
-
request<T>(endpoint: string, options?: ApiRequestOptions & { method?: string; body?: unknown }): Promise<T>;
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Runtime Integration
|
|
70
|
-
|
|
71
|
-
The plugin registers `api/client` as a runtime kind. Apps register descriptors:
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
// auth-client.client-api.descriptor.ts
|
|
75
|
-
export default {
|
|
76
|
-
id: 'auth',
|
|
77
|
-
kind: 'api/client',
|
|
78
|
-
baseUrl: 'https://auth.vibes.dev',
|
|
79
|
-
timeout: 10000
|
|
80
|
-
};
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Other packages resolve clients via the runtime:
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
const authClient = await runtime.query('api/client').withId('auth').resolve();
|
|
87
|
-
const session = await authClient.get('/api/session');
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Done Means
|
|
91
|
-
|
|
92
|
-
- [ ] `vibesApiClient` creates working clients with proper auth, headers, and timeout
|
|
93
|
-
- [ ] `fromVibesClient` correctly wraps VibesClient to ApiClientImplementation
|
|
94
|
-
- [ ] Custom headers hook applies headers to all requests
|
|
95
|
-
- [ ] Runtime plugin registers `api/client` kind and resolves descriptors
|
|
96
|
-
- [ ] DefaultApiClient constructs from descriptor config (baseUrl, timeout, debug)
|
|
97
|
-
- [ ] All HTTP methods (GET, POST, PUT, DELETE, generic request) work correctly
|
|
98
|
-
- [ ] ApiRequestOptions supports query params, custom headers, and timeout override
|
|
99
|
-
- [ ] Error handling propagates HTTP errors with useful context
|
|
100
|
-
- [ ] Tests cover factory creation, plugin registration, and request lifecycle
|
|
101
|
-
|
|
102
|
-
## Dependencies
|
|
103
|
-
|
|
104
|
-
- `@vibesdotdev/kit` -- VibesClient base class and client types
|
|
105
|
-
- `@vibesdotdev/runtime` -- Runtime plugin registration and kind system
|
|
106
|
-
- `@vibesdotdev/logging` -- Structured logging
|
|
107
|
-
- `zod` -- Schema validation for descriptors
|