@alienplatform/bindings 1.0.0 → 2.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.
Files changed (56) hide show
  1. package/LICENSE.md +105 -0
  2. package/README.md +59 -0
  3. package/dist/errors.d.ts +56 -0
  4. package/dist/errors.d.ts.map +1 -0
  5. package/dist/factories.d.ts +26 -0
  6. package/dist/factories.d.ts.map +1 -0
  7. package/dist/index.d.ts +19 -1768
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +23 -44772
  10. package/dist/loader.d.ts +171 -0
  11. package/dist/loader.d.ts.map +1 -0
  12. package/dist/loader.js +3712 -0
  13. package/dist/native.d.ts +41 -0
  14. package/dist/native.d.ts.map +1 -0
  15. package/dist/native.js +46 -0
  16. package/dist/types.d.ts +150 -0
  17. package/dist/types.d.ts.map +1 -0
  18. package/package.json +39 -21
  19. package/AGENTS.md +0 -70
  20. package/dist/index.js.map +0 -1
  21. package/scripts/generate-proto.sh +0 -46
  22. package/src/bindings/AGENTS.md +0 -105
  23. package/src/bindings/artifact-registry.ts +0 -314
  24. package/src/bindings/build.ts +0 -195
  25. package/src/bindings/function.ts +0 -164
  26. package/src/bindings/index.ts +0 -12
  27. package/src/bindings/kv.ts +0 -240
  28. package/src/bindings/queue.ts +0 -191
  29. package/src/bindings/service-account.ts +0 -113
  30. package/src/bindings/storage.ts +0 -535
  31. package/src/bindings/vault.ts +0 -133
  32. package/src/channel.ts +0 -94
  33. package/src/commands.ts +0 -76
  34. package/src/context.ts +0 -368
  35. package/src/errors.ts +0 -259
  36. package/src/events.ts +0 -463
  37. package/src/generated/artifact_registry.ts +0 -1934
  38. package/src/generated/build.ts +0 -1263
  39. package/src/generated/container.ts +0 -485
  40. package/src/generated/control.ts +0 -1574
  41. package/src/generated/function.ts +0 -741
  42. package/src/generated/google/protobuf/duration.ts +0 -196
  43. package/src/generated/google/protobuf/timestamp.ts +0 -225
  44. package/src/generated/kv.ts +0 -1137
  45. package/src/generated/queue.ts +0 -729
  46. package/src/generated/service_account.ts +0 -766
  47. package/src/generated/storage.ts +0 -3653
  48. package/src/generated/vault.ts +0 -519
  49. package/src/generated/wait_until.ts +0 -781
  50. package/src/global.ts +0 -316
  51. package/src/grpc-utils.ts +0 -159
  52. package/src/index.ts +0 -156
  53. package/src/types.ts +0 -384
  54. package/src/wait-until.ts +0 -257
  55. package/tsconfig.json +0 -8
  56. package/tsdown.config.ts +0 -14
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `@alienplatform/bindings/native` — static-embed entry for `bun build --compile`.
3
+ *
4
+ * This module imports the native addon through the literal specifier
5
+ * `./alien-bindings.node` so bun's compiler can detect the reference and embed
6
+ * the addon into the single-file executable. Unlike the default entry, it does
7
+ * NOT probe the filesystem or resolve a prebuild package — the addon must
8
+ * already be staged next to the built `native.js`.
9
+ *
10
+ * Staging contract (produced by `alien build`'s TypeScript toolchain; see
11
+ * PACKAGE_LAYOUT.md): before this module is bundled and compiled, the correct
12
+ * per-platform addon is copied next to `dist/native.js` as
13
+ * `alien-bindings.node`. The build owns that copy step; this module only
14
+ * consumes the staged file.
15
+ *
16
+ * The specifier is kept external at build time (see tsdown.config.ts) so the
17
+ * literal survives into `dist/native.js` for bun to resolve and embed.
18
+ *
19
+ * `bun build --compile` on this entry needs `--format=cjs` or the produced
20
+ * binary crashes on load (`__require is not defined`) — see
21
+ * `packages/package-layout/steps/compile.ts` for the verified repro and required flag.
22
+ */
23
+ /**
24
+ * Register the bun-embedded addon with the default loader, so plain
25
+ * `@alienplatform/bindings` imports (which go through `loader.ts`) resolve to
26
+ * it inside a compiled binary. `alien build` emits an explicit call to this
27
+ * from the compiled entry — an explicit call rather than a bare side-effect
28
+ * import so it survives this package's `sideEffects: false` tree-shaking.
29
+ */
30
+ export declare function installEmbeddedAddon(): void;
31
+ /** Resolve the storage binding named `name`. */
32
+ export declare const storage: (name: string) => import("./types.js").Storage;
33
+ /** Resolve the key-value binding named `name`. */
34
+ export declare const kv: (name: string) => import("./types.js").Kv;
35
+ /** Resolve the queue binding named `name`. */
36
+ export declare const queue: (name: string) => import("./types.js").Queue;
37
+ /** Resolve the vault binding named `name`. */
38
+ export declare const vault: (name: string) => import("./types.js").Vault;
39
+ export { AlienError, BindingNotConfiguredError, defineError } from "./errors.js";
40
+ export type { Kv, KvScanItem, KvScanResult, KvSetOptions, ObjectMeta, PresignedRequest, Queue, QueueMessage, SignedUrlMethod, SignedUrlOptions, Storage, Vault, } from "./types.js";
41
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAID,gDAAgD;AAChD,eAAO,MAAM,OAAO,gDAAoB,CAAA;AACxC,kDAAkD;AAClD,eAAO,MAAM,EAAE,2CAAe,CAAA;AAC9B,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AACpC,8CAA8C;AAC9C,eAAO,MAAM,KAAK,8CAAkB,CAAA;AAEpC,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEhF,YAAY,EACV,EAAE,EACF,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,KAAK,GACN,MAAM,YAAY,CAAA"}
package/dist/native.js ADDED
@@ -0,0 +1,46 @@
1
+ import { a as BindingNotConfiguredError, i as AlienError, n as registerEmbeddedAddon, o as defineError, r as createFactories } from "./loader.js";
2
+ import addon from "./alien-bindings.node";
3
+ //#region src/native.ts
4
+ /**
5
+ * `@alienplatform/bindings/native` — static-embed entry for `bun build --compile`.
6
+ *
7
+ * This module imports the native addon through the literal specifier
8
+ * `./alien-bindings.node` so bun's compiler can detect the reference and embed
9
+ * the addon into the single-file executable. Unlike the default entry, it does
10
+ * NOT probe the filesystem or resolve a prebuild package — the addon must
11
+ * already be staged next to the built `native.js`.
12
+ *
13
+ * Staging contract (produced by `alien build`'s TypeScript toolchain; see
14
+ * PACKAGE_LAYOUT.md): before this module is bundled and compiled, the correct
15
+ * per-platform addon is copied next to `dist/native.js` as
16
+ * `alien-bindings.node`. The build owns that copy step; this module only
17
+ * consumes the staged file.
18
+ *
19
+ * The specifier is kept external at build time (see tsdown.config.ts) so the
20
+ * literal survives into `dist/native.js` for bun to resolve and embed.
21
+ *
22
+ * `bun build --compile` on this entry needs `--format=cjs` or the produced
23
+ * binary crashes on load (`__require is not defined`) — see
24
+ * `packages/package-layout/steps/compile.ts` for the verified repro and required flag.
25
+ */
26
+ /**
27
+ * Register the bun-embedded addon with the default loader, so plain
28
+ * `@alienplatform/bindings` imports (which go through `loader.ts`) resolve to
29
+ * it inside a compiled binary. `alien build` emits an explicit call to this
30
+ * from the compiled entry — an explicit call rather than a bare side-effect
31
+ * import so it survives this package's `sideEffects: false` tree-shaking.
32
+ */
33
+ function installEmbeddedAddon() {
34
+ registerEmbeddedAddon(addon);
35
+ }
36
+ const factories = createFactories(() => addon);
37
+ /** Resolve the storage binding named `name`. */
38
+ const storage = factories.storage;
39
+ /** Resolve the key-value binding named `name`. */
40
+ const kv = factories.kv;
41
+ /** Resolve the queue binding named `name`. */
42
+ const queue = factories.queue;
43
+ /** Resolve the vault binding named `name`. */
44
+ const vault = factories.vault;
45
+ //#endregion
46
+ export { AlienError, BindingNotConfiguredError, defineError, installEmbeddedAddon, kv, queue, storage, vault };
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Public types for `@alienplatform/bindings`: the four resource handle
3
+ * interfaces and their operation option/result shapes. These mirror the Rust
4
+ * `alien-bindings` handles; the native (napi) surface is an internal detail.
5
+ */
6
+ /** Metadata for a single stored object. */
7
+ export interface ObjectMeta {
8
+ /** Object location (path) within the store. */
9
+ location: string;
10
+ /** Object size in bytes. */
11
+ size: number;
12
+ /** Last-modified timestamp as an RFC 3339 string. */
13
+ lastModified: string;
14
+ }
15
+ /** HTTP method a presigned request may be issued for. */
16
+ export type SignedUrlMethod = "GET" | "PUT" | "DELETE";
17
+ /** Options for {@link Storage.signedUrl}. */
18
+ export interface SignedUrlOptions {
19
+ /** Which operation the presigned request authorizes. */
20
+ method: SignedUrlMethod;
21
+ /** Object path within the store. */
22
+ path: string;
23
+ /** Validity window, in seconds. */
24
+ expiresIn: number;
25
+ }
26
+ /**
27
+ * A presigned request: the URL plus the method and headers to replay it with.
28
+ * This is a full request description (not a bare URL) so it matches every
29
+ * provider, including local stores whose URL is a `local://` scheme.
30
+ */
31
+ export interface PresignedRequest {
32
+ url: string;
33
+ method: string;
34
+ headers: Record<string, string>;
35
+ }
36
+ /** A resolved object-storage binding. */
37
+ export interface Storage {
38
+ /** Fetch the object at `path`. */
39
+ get(path: string): Promise<Buffer>;
40
+ /** Store `data` at `path`. */
41
+ put(path: string, data: Buffer | Uint8Array): Promise<void>;
42
+ /** Delete the object at `path`. */
43
+ delete(path: string): Promise<void>;
44
+ /** List objects, optionally filtered by `prefix`. */
45
+ list(prefix?: string): Promise<ObjectMeta[]>;
46
+ /** Fetch metadata for the object at `path`. */
47
+ head(path: string): Promise<ObjectMeta>;
48
+ /** Copy the object at `from` to `to`. */
49
+ copy(from: string, to: string): Promise<void>;
50
+ /** Create a presigned request for `path`. */
51
+ signedUrl(options: SignedUrlOptions): Promise<PresignedRequest>;
52
+ }
53
+ /** Options for {@link Kv.set}. */
54
+ export interface KvSetOptions {
55
+ /** Time-to-live, in seconds. */
56
+ ttl?: number;
57
+ /** Only create the key if it does not already exist. */
58
+ ifNotExists?: boolean;
59
+ }
60
+ /** A single key-value pair returned by a scan. */
61
+ export interface KvScanItem {
62
+ /** The key. */
63
+ key: string;
64
+ /** The raw value bytes. */
65
+ value: Buffer;
66
+ }
67
+ /** A page of scan results. */
68
+ export interface KvScanResult {
69
+ /**
70
+ * Key-value pairs found on this page. Values are returned alongside their
71
+ * keys (the provider already reads them), so a scan needs no follow-up `get`.
72
+ */
73
+ items: KvScanItem[];
74
+ /** Opaque cursor for the next page, or `undefined` when exhausted. */
75
+ nextCursor?: string;
76
+ }
77
+ /** A resolved key-value binding. */
78
+ export interface Kv {
79
+ /** Get the raw value bytes for `key`, or `null` if absent/expired. */
80
+ get(key: string): Promise<Buffer | null>;
81
+ /** Get the value for `key` as UTF-8 text, or `null` if absent/expired. */
82
+ getText(key: string): Promise<string | null>;
83
+ /** Get the value for `key` parsed as JSON, or `null` if absent/expired. */
84
+ getJson<T = unknown>(key: string): Promise<T | null>;
85
+ /**
86
+ * Set `key` to the UTF-8 `value`. With `ifNotExists`, resolves `true` when
87
+ * created and `false` when the key already existed; otherwise `true`.
88
+ */
89
+ set(key: string, value: string, options?: KvSetOptions): Promise<boolean>;
90
+ /**
91
+ * Set `key` to `value` serialized as JSON (via `JSON.stringify`). With
92
+ * `ifNotExists`, resolves `true` when created and `false` when the key already
93
+ * existed; otherwise `true`.
94
+ */
95
+ setJson(key: string, value: unknown, options?: KvSetOptions): Promise<boolean>;
96
+ /** Delete `key` (no error if absent). */
97
+ delete(key: string): Promise<void>;
98
+ /** Check whether `key` exists. */
99
+ exists(key: string): Promise<boolean>;
100
+ /** Scan keys under `prefix`, with optional pagination. */
101
+ scan(prefix: string, limit?: number, cursor?: string): Promise<KvScanResult>;
102
+ }
103
+ /** A message received from a queue. */
104
+ export interface QueueMessage {
105
+ /** Payload discriminant: `"json"` or `"text"`. */
106
+ payloadType: "json" | "text";
107
+ /**
108
+ * The payload string: serialized JSON when `payloadType === "json"`, raw text
109
+ * when `payloadType === "text"`.
110
+ */
111
+ payload: string;
112
+ /** Opaque receipt handle for ack/nack. */
113
+ receiptHandle: string;
114
+ /**
115
+ * Delivery attempt, 1-based (1 = first delivery). Providers that do not report
116
+ * redelivery counts always set 1; use it to enforce retry limits.
117
+ */
118
+ attempt: number;
119
+ }
120
+ /** A resolved queue binding. */
121
+ export interface Queue {
122
+ /** Send a JSON message (the object is serialized with `JSON.stringify`). */
123
+ send(message: unknown): Promise<void>;
124
+ /** Send a raw text message. */
125
+ sendText(text: string): Promise<void>;
126
+ /** Receive up to `max` messages. */
127
+ receive(max: number): Promise<QueueMessage[]>;
128
+ /** Acknowledge a message by its receipt handle. */
129
+ ack(receipt: string): Promise<void>;
130
+ /** Negative-acknowledge a message, making it immediately redeliverable. */
131
+ nack(receipt: string): Promise<void>;
132
+ /** Delete every message in the queue. */
133
+ purge(): Promise<void>;
134
+ }
135
+ /** A resolved vault (secrets) binding. */
136
+ export interface Vault {
137
+ /** Get the secret named `name` as a string. */
138
+ get(name: string): Promise<string>;
139
+ /** Get the secret named `name`, parsed as JSON. */
140
+ getJson<T = unknown>(name: string): Promise<T>;
141
+ /** Create or update the secret named `name` with a string value. */
142
+ put(name: string, value: string): Promise<void>;
143
+ /** Create or update the secret named `name`, serialized as JSON. */
144
+ putJson(name: string, value: unknown): Promise<void>;
145
+ /** Delete the secret named `name`. */
146
+ delete(name: string): Promise<void>;
147
+ /** List the names of all secrets in this vault. */
148
+ list(): Promise<string[]>;
149
+ }
150
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEtD,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,MAAM,EAAE,eAAe,CAAA;IACvB,oCA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AC,CAAA;IACnC,mDAAmD;IACnD,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAC1B"}
package/package.json CHANGED
@@ -1,22 +1,39 @@
1
1
  {
2
2
  "name": "@alienplatform/bindings",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
+ "sideEffects": false,
6
+ "types": "./dist/index.d.ts",
5
7
  "exports": {
6
8
  ".": {
7
- "import": "./dist/index.js",
8
- "types": "./dist/index.d.ts"
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./native": {
13
+ "types": "./dist/native.d.ts",
14
+ "import": "./dist/native.js"
9
15
  }
10
16
  },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "engines": {
21
+ "node": ">=18",
22
+ "bun": ">=1.0.23"
23
+ },
11
24
  "keywords": [
12
25
  "alien",
13
26
  "bindings",
14
- "grpc",
15
- "sdk"
27
+ "storage",
28
+ "kv",
29
+ "queue",
30
+ "vault",
31
+ "napi"
16
32
  ],
17
- "author": "",
18
- "license": "ISC",
19
- "description": "TypeScript SDK for Alien bindings - gRPC client for Storage, KV, Queue, Vault, and more",
33
+ "author": "Alien Software, Inc. <hi@alien.dev>",
34
+ "license": "FSL-1.1-Apache-2.0",
35
+ "description": "Direct TypeScript bindings for Alien storage, kv, queue, and vault over an in-process napi-rs addon",
36
+ "homepage": "https://alien.dev",
20
37
  "repository": {
21
38
  "type": "git",
22
39
  "url": "https://github.com/alienplatform/alien.git",
@@ -27,29 +44,30 @@
27
44
  },
28
45
  "devDependencies": {
29
46
  "@biomejs/biome": "^1.9.4",
47
+ "@napi-rs/cli": "^3.0.0",
30
48
  "@types/node": "^24.0.15",
31
- "ts-proto": "^2.7.0",
32
49
  "tsdown": "^0.13.0",
33
50
  "typescript": "^5.8.3",
34
51
  "vitest": "^3.1.4",
52
+ "zod": "4.3.2",
35
53
  "@alienplatform/typescript-config": "^1.0.0"
36
54
  },
37
55
  "dependencies": {
38
- "@bufbuild/protobuf": "^2.5.3",
39
- "@grpc/grpc-js": "^1.13.4",
40
- "long": "^5.3.2",
41
- "nice-grpc": "^2.1.11",
42
- "nice-grpc-common": "^2.0.2",
43
- "protobufjs": "^7.5.3",
44
- "ts-pattern": "^5.7.1",
45
- "zod": "4.3.2",
46
- "@alienplatform/core": "^1.0.1"
56
+ "@alienplatform/core": "^2.0.0"
57
+ },
58
+ "optionalDependencies": {
59
+ "@alienplatform/bindings-darwin-arm64": "2.0.0",
60
+ "@alienplatform/bindings-darwin-x64": "2.0.0",
61
+ "@alienplatform/bindings-linux-x64-gnu": "2.0.0",
62
+ "@alienplatform/bindings-linux-arm64-gnu": "2.0.0"
47
63
  },
48
64
  "scripts": {
49
- "build": "tsdown",
50
- "test": "vitest run --passWithNoTests",
65
+ "build": "tsdown && tsc -p tsconfig.build.json --emitDeclarationOnly",
66
+ "build:addon": "napi build --platform --release --cwd ../../crates/alien-bindings-node",
67
+ "test": "vitest run",
68
+ "test:bun": "bun scripts/run-bun-tests.mjs",
51
69
  "test:ts": "tsc --noEmit",
52
- "generate": "./scripts/generate-proto.sh",
70
+ "smoke": "node scripts/smoke-envelope.mjs",
53
71
  "format-and-lint": "biome check .",
54
72
  "format-and-lint:fix": "biome check . --write"
55
73
  }
package/AGENTS.md DELETED
@@ -1,70 +0,0 @@
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.