@edgespark/server-types 0.0.1-alpha.5 → 0.0.1-alpha.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 +21 -79
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,90 +1,32 @@
|
|
|
1
1
|
# @edgespark/server-types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript type definitions for EdgeSpark server SDK.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What's Included
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- `Client<TSchema>` - Main SDK client interface
|
|
8
|
+
- `AuthClient` - Authentication with path-based conventions
|
|
9
|
+
- `User` - Authenticated user identity
|
|
10
|
+
- `StorageClient` / `BucketClient` - File storage operations
|
|
11
|
+
- `SecretClient` - Environment secrets access
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
sdk/server-types/src/index.ts ← Types (this package)
|
|
11
|
-
↓
|
|
12
|
-
workspace:*
|
|
13
|
-
↓
|
|
14
|
-
sdk-server/ ← Implementation (imports types from here)
|
|
15
|
-
↓
|
|
16
|
-
deployed
|
|
17
|
-
↓
|
|
18
|
-
user-worker ← Runtime (serves SDK to user code)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Development Flow
|
|
22
|
-
|
|
23
|
-
### Adding a New Feature
|
|
24
|
-
|
|
25
|
-
1. **Add types** in `sdk/server-types/src/index.ts`
|
|
26
|
-
```typescript
|
|
27
|
-
export interface QueueClient {
|
|
28
|
-
send(message: string): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface Client<TSchema> {
|
|
32
|
-
// ... existing
|
|
33
|
-
queue: QueueClient; // new
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
2. **Implement** in `edge/workers/user-worker/src/sdk-server/`
|
|
38
|
-
```typescript
|
|
39
|
-
import type { QueueClient } from "@edgespark/server-types";
|
|
40
|
-
// ... implementation
|
|
41
|
-
```
|
|
13
|
+
## Usage
|
|
42
14
|
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
cd edge/workers/user-worker
|
|
46
|
-
wrangler deploy
|
|
47
|
-
```
|
|
15
|
+
This package is pre-installed in EdgeSpark projects. Types are used for autocompletion and type checking:
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
pnpm version minor # 0.0.1 → 0.1.0
|
|
53
|
-
pnpm publish
|
|
54
|
-
```
|
|
17
|
+
```typescript
|
|
18
|
+
import type { Client } from "@edgespark/server-types";
|
|
19
|
+
import { tables } from "@generated";
|
|
55
20
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
21
|
+
export async function createApp(edgespark: Client<typeof tables>) {
|
|
22
|
+
// Full IntelliSense for:
|
|
23
|
+
// - edgespark.db (Drizzle ORM)
|
|
24
|
+
// - edgespark.auth
|
|
25
|
+
// - edgespark.storage
|
|
26
|
+
// - edgespark.secret
|
|
27
|
+
}
|
|
63
28
|
```
|
|
64
29
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Rules
|
|
68
|
-
|
|
69
|
-
| Rule | Why |
|
|
70
|
-
|------|-----|
|
|
71
|
-
| Deploy impl BEFORE publishing types | New types + old impl = runtime errors |
|
|
72
|
-
| Types can publish WITHOUT deploy | JSDoc/comment changes are safe |
|
|
73
|
-
| Use `workspace:*` locally | Instant feedback during dev |
|
|
74
|
-
| Bump version on every publish | npm requires unique versions |
|
|
75
|
-
|
|
76
|
-
## Local Development
|
|
30
|
+
## Learn More
|
|
77
31
|
|
|
78
|
-
|
|
79
|
-
- Changes to `sdk/server-types/src/index.ts` are immediately available
|
|
80
|
-
- Run `pnpm build` in `sdk/server-types/` to update `dist/`
|
|
81
|
-
- No need to publish during development
|
|
82
|
-
|
|
83
|
-
## Publishing
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
cd sdk/server-types
|
|
87
|
-
pnpm build # Compile TypeScript
|
|
88
|
-
pnpm version <patch|minor|major>
|
|
89
|
-
pnpm publish --access public
|
|
90
|
-
```
|
|
32
|
+
Visit [edgespark.dev](https://edgespark.dev) to get started.
|