@aerostack/core 0.8.4 → 0.8.6
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 +85 -3
- package/dist/__tests__/client.test.d.ts +1 -0
- package/dist/__tests__/client.test.js +1240 -0
- package/dist/__tests__/registry.test.d.ts +1 -0
- package/dist/__tests__/registry.test.js +264 -0
- package/package.json +1 -1
- package/src/__tests__/client.test.ts +1475 -0
- package/src/__tests__/registry.test.ts +310 -0
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# @aerostack/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@aerostack/core)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Shared core types, RPC client, and validation schemas for the Aerostack SDK ecosystem.
|
|
7
|
+
|
|
8
|
+
> **Note:** This is an internal package. If you're building an application, use [`@aerostack/node`](../node), [`@aerostack/react`](../react), [`@aerostack/web`](../web), or [`@aerostack/sdk`](../sdk) instead.
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
@@ -8,6 +13,83 @@ Shared core types and utilities for Aerostack SDKs.
|
|
|
8
13
|
npm install @aerostack/core
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## What's Inside
|
|
17
|
+
|
|
18
|
+
### RPC Client
|
|
19
|
+
|
|
20
|
+
The `AerostackClient` class provides the low-level HTTP transport used by all TypeScript SDKs:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { AerostackClient } from '@aerostack/core';
|
|
24
|
+
|
|
25
|
+
const client = new AerostackClient({
|
|
26
|
+
baseUrl: 'https://your-project.aerostack.dev',
|
|
27
|
+
apiKey: 'your-api-key',
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Capabilities:**
|
|
32
|
+
- Authenticated HTTP requests (API key and JWT)
|
|
33
|
+
- Multipart form data uploads (for storage)
|
|
34
|
+
- Consistent error handling across all operations
|
|
35
|
+
|
|
36
|
+
### Service Namespaces
|
|
37
|
+
|
|
38
|
+
The RPC interface exposes the following service namespaces:
|
|
39
|
+
|
|
40
|
+
| Namespace | Operations |
|
|
41
|
+
|-----------|-----------|
|
|
42
|
+
| `db` | `query`, `batch` |
|
|
43
|
+
| `cache` | `get`, `set`, `delete`, `list`, `keys`, `getMany`, `setMany`, `deleteMany`, `flush`, `expire`, `increment` |
|
|
44
|
+
| `queue` | `enqueue`, `getJob`, `listJobs`, `cancelJob` |
|
|
45
|
+
| `ai` | `chat`, `search.ingest`, `search.query`, `search.delete`, `search.configure`, and more |
|
|
46
|
+
| `storage` | `upload`, `get`, `getUrl`, `getMetadata`, `list`, `delete`, `exists`, `copy`, `move` |
|
|
47
|
+
| `services` | `invoke` |
|
|
48
|
+
| `auth` | `signup`, `signin` |
|
|
49
|
+
| `collections` | `list`, `get`, `create`, `update`, `delete` |
|
|
50
|
+
| `ecommerce` | `config`, `products`, `categories`, `cart` |
|
|
51
|
+
|
|
52
|
+
### Type Definitions
|
|
53
|
+
|
|
54
|
+
Exports TypeScript interfaces used across all SDKs:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import type { User, Project, Product, Order, Cart, Job } from '@aerostack/core';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Available types:** `User`, `Project`, `Component`, `Page`, `Product`, `ProductVariant`, `Order`, `Cart`, `CartItem`, `Customer`, `Job`, `Collection`, `Store`, `Category`, `StorageObject`, `CacheKeyEntry`, and more.
|
|
61
|
+
|
|
62
|
+
### Validation Schemas
|
|
63
|
+
|
|
64
|
+
Zod-based validation for registry configuration:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { validateRegistryConfig, safeValidateRegistryConfig } from '@aerostack/core/schemas/registry';
|
|
68
|
+
|
|
69
|
+
const result = safeValidateRegistryConfig(config);
|
|
70
|
+
if (!result.success) {
|
|
71
|
+
console.error(result.error.issues);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Build
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run build # Compiles with tsc
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This package must be built **before** all other TypeScript SDKs in the monorepo.
|
|
82
|
+
|
|
83
|
+
## Related Packages
|
|
84
|
+
|
|
85
|
+
| Package | Description |
|
|
86
|
+
|---------|-------------|
|
|
87
|
+
| [`@aerostack/node`](../node) | Node.js SDK for server-side applications |
|
|
88
|
+
| [`@aerostack/web`](../web) | Browser SDK for client-side applications |
|
|
89
|
+
| [`@aerostack/react`](../react) | React hooks for Aerostack services |
|
|
90
|
+
| [`@aerostack/sdk`](../sdk) | Universal SDK for Cloudflare Workers + Browser |
|
|
91
|
+
| [`@aerostack/react-native`](../react-native) | React Native SDK for mobile apps |
|
|
92
|
+
|
|
93
|
+
## License
|
|
12
94
|
|
|
13
|
-
|
|
95
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|