@alienplatform/bindings 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/AGENTS.md +70 -0
- package/dist/index.d.ts +1770 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44772 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
- package/scripts/generate-proto.sh +46 -0
- package/src/bindings/AGENTS.md +105 -0
- package/src/bindings/artifact-registry.ts +314 -0
- package/src/bindings/build.ts +195 -0
- package/src/bindings/function.ts +164 -0
- package/src/bindings/index.ts +12 -0
- package/src/bindings/kv.ts +240 -0
- package/src/bindings/queue.ts +191 -0
- package/src/bindings/service-account.ts +113 -0
- package/src/bindings/storage.ts +535 -0
- package/src/bindings/vault.ts +133 -0
- package/src/channel.ts +94 -0
- package/src/commands.ts +76 -0
- package/src/context.ts +368 -0
- package/src/errors.ts +259 -0
- package/src/events.ts +463 -0
- package/src/generated/artifact_registry.ts +1934 -0
- package/src/generated/build.ts +1263 -0
- package/src/generated/container.ts +485 -0
- package/src/generated/control.ts +1574 -0
- package/src/generated/function.ts +741 -0
- package/src/generated/google/protobuf/duration.ts +196 -0
- package/src/generated/google/protobuf/timestamp.ts +225 -0
- package/src/generated/kv.ts +1137 -0
- package/src/generated/queue.ts +729 -0
- package/src/generated/service_account.ts +766 -0
- package/src/generated/storage.ts +3653 -0
- package/src/generated/vault.ts +519 -0
- package/src/generated/wait_until.ts +781 -0
- package/src/global.ts +316 -0
- package/src/grpc-utils.ts +159 -0
- package/src/index.ts +156 -0
- package/src/types.ts +384 -0
- package/src/wait-until.ts +257 -0
- package/tsconfig.json +8 -0
- package/tsdown.config.ts +14 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @alienplatform/bindings
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for Alien bindings. Provides gRPC clients for Storage, KV, Queue, Vault, Build, ArtifactRegistry, Function, and ServiceAccount.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm generate # Regenerate TypeScript from Proto
|
|
9
|
+
pnpm build # Build the package
|
|
10
|
+
pnpm test:ts # Type check
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Type Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────┐
|
|
17
|
+
│ Rust Types │ ← Source of truth (alien-core)
|
|
18
|
+
└────────┬────────┘
|
|
19
|
+
│
|
|
20
|
+
┌────┴────┐
|
|
21
|
+
▼ ▼
|
|
22
|
+
┌───────┐ ┌───────────┐
|
|
23
|
+
│ Proto │ │ OpenAPI │
|
|
24
|
+
│ (wire)│ │ (schema) │
|
|
25
|
+
└───┬───┘ └─────┬─────┘
|
|
26
|
+
│ │
|
|
27
|
+
▼ ▼
|
|
28
|
+
┌─────────┐ ┌────────────┐
|
|
29
|
+
│ts-proto │ │ Kubb/Zod │
|
|
30
|
+
│(internal)│ │(@alien/core)│ ← Public API types
|
|
31
|
+
└────┬────┘ └──────┬─────┘
|
|
32
|
+
│ │
|
|
33
|
+
└──────┬───────┘
|
|
34
|
+
▼
|
|
35
|
+
Transform proto → core types
|
|
36
|
+
in binding implementations
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Key principle:** Domain types (`BuildStatus`, `StorageEvent`, etc.) come from `@alienplatform/core`. Proto types are internal - used only for gRPC wire format. Bindings transform proto ↔ public types.
|
|
40
|
+
|
|
41
|
+
## Package Structure
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
src/
|
|
45
|
+
├── generated/ # Auto-generated from Proto (DO NOT EDIT)
|
|
46
|
+
├── bindings/ # Individual binding clients (see bindings/AGENTS.md)
|
|
47
|
+
├── context.ts # AlienContext - main entry point
|
|
48
|
+
├── events.ts # Event handlers (storage, cron, queue)
|
|
49
|
+
├── types.ts # SDK-specific types (options, results)
|
|
50
|
+
└── index.ts # Public exports
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Proto Definitions
|
|
54
|
+
|
|
55
|
+
Protos live in `crates/alien-bindings/proto/`. When modified:
|
|
56
|
+
|
|
57
|
+
1. Run `pnpm generate` in this package
|
|
58
|
+
2. Update binding implementations to match new proto types
|
|
59
|
+
3. Verify TypeScript matches Rust behavior (see `src/bindings/AGENTS.md`)
|
|
60
|
+
|
|
61
|
+
## Adding New Bindings
|
|
62
|
+
|
|
63
|
+
1. Add proto in `crates/alien-bindings/proto/`
|
|
64
|
+
2. Run `pnpm generate`
|
|
65
|
+
3. Create binding in `src/bindings/<name>.ts`
|
|
66
|
+
4. Add types to `src/types.ts` (public API)
|
|
67
|
+
5. Export from `src/bindings/index.ts` and `src/index.ts`
|
|
68
|
+
6. Add accessor method to `AlienContext`
|
|
69
|
+
|
|
70
|
+
See `src/bindings/AGENTS.md` for implementation guidelines.
|