@ebowwa/codespaces-types 0.1.0 → 1.0.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/README.md +34 -37
- package/dist/runtime/ai.d.ts +1336 -0
- package/dist/runtime/ai.d.ts.map +1 -0
- package/dist/runtime/ai.js +416 -0
- package/dist/runtime/api.d.ts +1304 -0
- package/dist/runtime/api.d.ts.map +1 -0
- package/dist/runtime/api.js +673 -0
- package/dist/runtime/database.d.ts +376 -0
- package/dist/runtime/database.d.ts.map +1 -0
- package/dist/runtime/database.js +91 -0
- package/dist/runtime/env.d.ts +121 -0
- package/dist/runtime/env.d.ts.map +1 -0
- package/dist/runtime/env.js +54 -0
- package/dist/runtime/glm.d.ts +17 -0
- package/dist/runtime/glm.d.ts.map +1 -0
- package/dist/runtime/glm.js +25 -0
- package/dist/runtime/index.d.ts +13 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +12 -0
- package/dist/runtime/ssh.d.ts +111 -0
- package/dist/runtime/ssh.d.ts.map +1 -0
- package/dist/runtime/ssh.js +44 -0
- package/dist/{index.d.ts → types/index.d.ts} +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/{resources.d.ts → types/resources.d.ts} +1 -0
- package/dist/types/resources.d.ts.map +1 -0
- package/dist/{schemas → types/schemas}/resources.d.ts +5 -4
- package/dist/types/schemas/resources.d.ts.map +1 -0
- package/dist/{terminal-websocket.d.ts → types/terminal-websocket.d.ts} +1 -0
- package/dist/types/terminal-websocket.d.ts.map +1 -0
- package/dist/{time.d.ts → types/time.d.ts} +1 -0
- package/dist/types/time.d.ts.map +1 -0
- package/dist/{user → types/user}/distributions.d.ts +1 -1
- package/dist/types/user/distributions.d.ts.map +1 -0
- package/dist/{user → types/user}/distributions.js +1 -1
- package/dist/{validation.d.ts → types/validation.d.ts} +1 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/package.json +48 -53
- package/LICENSE +0 -21
- /package/dist/{index.js → types/index.js} +0 -0
- /package/dist/{resources.js → types/resources.js} +0 -0
- /package/dist/{schemas → types/schemas}/resources.js +0 -0
- /package/dist/{terminal-websocket.js → types/terminal-websocket.js} +0 -0
- /package/dist/{time.js → types/time.js} +0 -0
- /package/dist/{validation.js → types/validation.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# @ebowwa/codespaces-types
|
|
2
2
|
|
|
3
|
-
Shared
|
|
3
|
+
Shared types and runtime validation schemas for codespaces projects.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
- **`/runtime`** - Zod schemas for runtime validation
|
|
8
|
+
- **`/types`** - TypeScript type definitions for compile-time checking
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
@@ -10,58 +15,50 @@ npm install @ebowwa/codespaces-types
|
|
|
10
15
|
|
|
11
16
|
## Usage
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Main Types
|
|
18
|
+
### Runtime Validation (Zod Schemas)
|
|
16
19
|
|
|
17
20
|
```typescript
|
|
18
|
-
import {
|
|
19
|
-
Environment,
|
|
20
|
-
EnvironmentStatus,
|
|
21
|
-
HetznerServerType,
|
|
22
|
-
HetznerLocation,
|
|
23
|
-
// ... and more
|
|
24
|
-
} from '@ebowwa/codespaces-types';
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Resource Parsing
|
|
21
|
+
import { CreateEnvironmentRequestSchema } from '@ebowwa/codespaces-types/runtime/api';
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
// Validate data at runtime
|
|
24
|
+
const result = CreateEnvironmentRequestSchema.parse(userData);
|
|
31
25
|
```
|
|
32
26
|
|
|
33
|
-
###
|
|
27
|
+
### Compile-Time Types
|
|
34
28
|
|
|
35
29
|
```typescript
|
|
36
|
-
import {
|
|
37
|
-
ClientToServerMessage,
|
|
38
|
-
ServerToClientMessage,
|
|
39
|
-
WebSocketCloseCode
|
|
40
|
-
} from '@ebowwa/codespaces-types/terminal-websocket';
|
|
41
|
-
```
|
|
30
|
+
import type { Environment, HetznerServerType } from '@ebowwa/codespaces-types/types';
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
import { formatElapsedTime } from '@ebowwa/codespaces-types/time';
|
|
32
|
+
// Type checking at compile time
|
|
33
|
+
const env: Environment = { /* ... */ };
|
|
47
34
|
```
|
|
48
35
|
|
|
49
|
-
###
|
|
36
|
+
### Type Inference (Recommended)
|
|
37
|
+
|
|
38
|
+
Runtime schemas automatically export inferred TypeScript types:
|
|
50
39
|
|
|
51
40
|
```typescript
|
|
52
41
|
import {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} from '@ebowwa/codespaces-types/
|
|
42
|
+
CreateEnvironmentRequestSchema,
|
|
43
|
+
type CreateEnvironmentRequest
|
|
44
|
+
} from '@ebowwa/codespaces-types/runtime/api';
|
|
45
|
+
|
|
46
|
+
const data: CreateEnvironmentRequest = { /* ... */ };
|
|
47
|
+
const validated = CreateEnvironmentRequestSchema.parse(data);
|
|
56
48
|
```
|
|
57
49
|
|
|
58
|
-
##
|
|
50
|
+
## Available Exports
|
|
51
|
+
|
|
52
|
+
### Runtime (`./runtime/*`)
|
|
53
|
+
- `api` - API request/response validation schemas
|
|
54
|
+
- `ai` - AI-related schemas
|
|
55
|
+
- `database` - Database validation schemas
|
|
56
|
+
- `env` - Environment variable schemas
|
|
57
|
+
- `glm` - GLM-specific schemas
|
|
58
|
+
- `ssh` - SSH configuration schemas
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
- **WebSocket Types**: Terminal WebSocket message types for real-time communication
|
|
63
|
-
- **Validation**: Zod schemas for validating environment names, SSH keys, and API tokens
|
|
64
|
-
- **Time Utilities**: Functions for formatting elapsed time
|
|
60
|
+
### Types (`./types/*`)
|
|
61
|
+
- `index` - Main type exports (Environment, Hetzner types, etc.)
|
|
65
62
|
|
|
66
63
|
## License
|
|
67
64
|
|