@alienplatform/sdk 1.3.3
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/.turbo/turbo-build.log +27 -0
- package/AGENTS.md +70 -0
- package/LICENSE.md +105 -0
- package/dist/bindings/artifact-registry.d.ts +88 -0
- package/dist/bindings/artifact-registry.d.ts.map +1 -0
- package/dist/bindings/build.d.ts +67 -0
- package/dist/bindings/build.d.ts.map +1 -0
- package/dist/bindings/function.d.ts +72 -0
- package/dist/bindings/function.d.ts.map +1 -0
- package/dist/bindings/index.d.ts +12 -0
- package/dist/bindings/index.d.ts.map +1 -0
- package/dist/bindings/kv.d.ts +113 -0
- package/dist/bindings/kv.d.ts.map +1 -0
- package/dist/bindings/queue.d.ts +81 -0
- package/dist/bindings/queue.d.ts.map +1 -0
- package/dist/bindings/service-account.d.ts +46 -0
- package/dist/bindings/service-account.d.ts.map +1 -0
- package/dist/bindings/storage.d.ts +164 -0
- package/dist/bindings/storage.d.ts.map +1 -0
- package/dist/bindings/vault.d.ts +65 -0
- package/dist/bindings/vault.d.ts.map +1 -0
- package/dist/channel.d.ts +39 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/commands/client.d.ts +47 -0
- package/dist/commands/client.d.ts.map +1 -0
- package/dist/commands/errors.d.ts +198 -0
- package/dist/commands/errors.d.ts.map +1 -0
- package/dist/commands/index.d.ts +23 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +387 -0
- package/dist/commands/types.d.ts +40 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands.d.ts +55 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/context.d.ts +182 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/dist.js +6021 -0
- package/dist/errors.d.ts +334 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/events.d.ts +163 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/generated/artifact_registry.d.ts +292 -0
- package/dist/generated/artifact_registry.d.ts.map +1 -0
- package/dist/generated/build.d.ts +184 -0
- package/dist/generated/build.d.ts.map +1 -0
- package/dist/generated/container.d.ts +101 -0
- package/dist/generated/container.d.ts.map +1 -0
- package/dist/generated/control.d.ts +236 -0
- package/dist/generated/control.d.ts.map +1 -0
- package/dist/generated/function.d.ts +107 -0
- package/dist/generated/function.d.ts.map +1 -0
- package/dist/generated/google/protobuf/duration.d.ts +94 -0
- package/dist/generated/google/protobuf/duration.d.ts.map +1 -0
- package/dist/generated/google/protobuf/timestamp.d.ts +124 -0
- package/dist/generated/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/generated/kv.d.ts +182 -0
- package/dist/generated/kv.d.ts.map +1 -0
- package/dist/generated/queue.d.ts +127 -0
- package/dist/generated/queue.d.ts.map +1 -0
- package/dist/generated/service_account.d.ts +112 -0
- package/dist/generated/service_account.d.ts.map +1 -0
- package/dist/generated/storage.d.ts +783 -0
- package/dist/generated/storage.d.ts.map +1 -0
- package/dist/generated/vault.d.ts +107 -0
- package/dist/generated/vault.d.ts.map +1 -0
- package/dist/generated/wait_until.d.ts +149 -0
- package/dist/generated/wait_until.d.ts.map +1 -0
- package/dist/global.d.ts +208 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/grpc-utils.d.ts +25 -0
- package/dist/grpc-utils.d.ts.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38713 -0
- package/dist/types.d.ts +327 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/wait-until.d.ts +115 -0
- package/dist/wait-until.d.ts.map +1 -0
- package/package.json +63 -0
- package/scripts/generate-proto.sh +46 -0
- package/src/bindings/AGENTS.md +105 -0
- package/src/bindings/artifact-registry.ts +316 -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 +102 -0
- package/src/commands/client.ts +446 -0
- package/src/commands/errors.ts +126 -0
- package/src/commands/index.ts +41 -0
- package/src/commands/types.ts +52 -0
- package/src/commands.ts +76 -0
- package/src/context.ts +368 -0
- package/src/errors.ts +259 -0
- package/src/events.ts +511 -0
- package/src/generated/artifact_registry.ts +1952 -0
- package/src/generated/build.ts +1263 -0
- package/src/generated/container.ts +485 -0
- package/src/generated/control.ts +1922 -0
- package/src/generated/function.ts +741 -0
- package/src/generated/google/protobuf/duration.ts +196 -0
- package/src/generated/google/protobuf/timestamp.ts +226 -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 +287 -0
- package/src/grpc-utils.ts +159 -0
- package/src/index.ts +154 -0
- package/src/types.ts +386 -0
- package/src/wait-until.ts +273 -0
- package/tsconfig.json +8 -0
- package/tsdown.config.ts +17 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
> @alienplatform/sdk@1.3.3 build /home/runner/work/alien/alien/packages/sdk
|
|
3
|
+
> tsdown && tsc --emitDeclarationOnly
|
|
4
|
+
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.13.5[22m powered by rolldown [2mv1.0.0-rc.15[22m
|
|
6
|
+
[34mℹ[39m Using tsdown config: [4m/home/runner/work/alien/alien/packages/sdk/tsdown.config.ts[24m
|
|
7
|
+
[34mℹ[39m entry: [34msrc/index.ts, src/commands/index.ts[39m
|
|
8
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
+
[34mℹ[39m Build start
|
|
10
|
+
[34mℹ[39m Cleaning 80 files
|
|
11
|
+
[33mWarning: Invalid input options (1 issue found)
|
|
12
|
+
- For the "define". Invalid key: Expected never but received "define". [0m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m1333.83 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1mcommands/index.js[22m [2m 12.03 kB[22m [2m│ gzip: 3.11 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22mdist.js [2m 226.66 kB[22m [2m│ gzip: 45.87 kB[22m
|
|
16
|
+
[34mℹ[39m 3 files, total: 1572.52 kB
|
|
17
|
+
../../node_modules/.pnpm/@protobufjs+inquire@1.1.0/node_modules/@protobufjs/inquire/index.js (12:18) [33m[EVAL] Warning:[0m Use of direct `eval` function is strongly discouraged as it poses security risks and may cause issues with minification.
|
|
18
|
+
[38;5;246m╭[0m[38;5;246m─[0m[38;5;246m[[0m ../../node_modules/.pnpm/@protobufjs+inquire@1.1.0/node_modules/@protobufjs/inquire/index.js:12:19 [38;5;246m][0m
|
|
19
|
+
[38;5;246m│[0m
|
|
20
|
+
[38;5;246m12 │[0m [38;5;249m [0m[38;5;249m [0m[38;5;249m [0m[38;5;249m [0m[38;5;249m [0m[38;5;249m [0m[38;5;249m [0m[38;5;249m [0m[38;5;249mv[0m[38;5;249ma[0m[38;5;249mr[0m[38;5;249m [0m[38;5;249mm[0m[38;5;249mo[0m[38;5;249md[0m[38;5;249m [0m[38;5;249m=[0m[38;5;249m [0meval[38;5;249m([0m[38;5;249m"[0m[38;5;249mq[0m[38;5;249mu[0m[38;5;249mi[0m[38;5;249mr[0m[38;5;249me[0m[38;5;249m"[0m[38;5;249m.[0m[38;5;249mr[0m[38;5;249me[0m[38;5;249mp[0m[38;5;249ml[0m[38;5;249ma[0m[38;5;249mc[0m[38;5;249me[0m[38;5;249m([0m[38;5;249m/[0m[38;5;249m^[0m[38;5;249m/[0m[38;5;249m,[0m[38;5;249m"[0m[38;5;249mr[0m[38;5;249me[0m[38;5;249m"[0m[38;5;249m)[0m[38;5;249m)[0m[38;5;249m([0m[38;5;249mm[0m[38;5;249mo[0m[38;5;249md[0m[38;5;249mu[0m[38;5;249ml[0m[38;5;249me[0m[38;5;249mN[0m[38;5;249ma[0m[38;5;249mm[0m[38;5;249me[0m[38;5;249m)[0m[38;5;249m;[0m[38;5;249m [0m[38;5;249m/[0m[38;5;249m/[0m[38;5;249m [0m[38;5;249me[0m[38;5;249ms[0m[38;5;249ml[0m[38;5;249mi[0m[38;5;249mn[0m[38;5;249mt[0m[38;5;249m-[0m[38;5;249md[0m[38;5;249mi[0m[38;5;249ms[0m[38;5;249ma[0m[38;5;249mb[0m[38;5;249ml[0m[38;5;249me[0m[38;5;249m-[0m[38;5;249ml[0m[38;5;249mi[0m[38;5;249mn[0m[38;5;249me[0m[38;5;249m [0m[38;5;249mn[0m[38;5;249mo[0m[38;5;249m-[0m[38;5;249me[0m[38;5;249mv[0m[38;5;249ma[0m[38;5;249ml[0m
|
|
21
|
+
[38;5;240m │[0m ──┬─
|
|
22
|
+
[38;5;240m │[0m ╰─── Use of direct `eval` here.
|
|
23
|
+
[38;5;240m │[0m
|
|
24
|
+
[38;5;240m │[0m [38;5;115mHelp[0m: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
|
|
25
|
+
[38;5;246m────╯[0m
|
|
26
|
+
|
|
27
|
+
[32m✔[39m Build complete in [32m98ms[39m
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @alienplatform/sdk
|
|
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.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Alien Software, Inc.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArtifactRegistry binding implementation.
|
|
3
|
+
*
|
|
4
|
+
* Provides container image repository management.
|
|
5
|
+
*/
|
|
6
|
+
import { type Channel } from "nice-grpc";
|
|
7
|
+
import type { ArtifactRegistryCredentials, ArtifactRegistryPermissions, CrossAccountAccess, CrossAccountPermissions, RepositoryInfo } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* ArtifactRegistry binding for container repository management.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { artifactRegistry } from "@alienplatform/sdk"
|
|
14
|
+
*
|
|
15
|
+
* const registry = artifactRegistry("my-registry")
|
|
16
|
+
*
|
|
17
|
+
* // Create a repository
|
|
18
|
+
* const repo = await registry.createRepository("my-app")
|
|
19
|
+
* console.log("Repository URI:", repo.uri)
|
|
20
|
+
*
|
|
21
|
+
* // Generate push credentials
|
|
22
|
+
* const creds = await registry.generateCredentials("my-app", "push-pull")
|
|
23
|
+
* console.log("Username:", creds.username)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class ArtifactRegistry {
|
|
27
|
+
private readonly client;
|
|
28
|
+
private readonly bindingName;
|
|
29
|
+
constructor(channel: Channel, bindingName: string);
|
|
30
|
+
/**
|
|
31
|
+
* Create a repository.
|
|
32
|
+
*
|
|
33
|
+
* @param repoName - Name of the repository
|
|
34
|
+
* @returns Repository information
|
|
35
|
+
*/
|
|
36
|
+
createRepository(repoName: string): Promise<RepositoryInfo>;
|
|
37
|
+
/**
|
|
38
|
+
* Get repository details.
|
|
39
|
+
*
|
|
40
|
+
* @param repoId - Repository ID
|
|
41
|
+
* @returns Repository information
|
|
42
|
+
*/
|
|
43
|
+
getRepository(repoId: string): Promise<RepositoryInfo>;
|
|
44
|
+
/**
|
|
45
|
+
* Add cross-account access to a repository.
|
|
46
|
+
*
|
|
47
|
+
* @param repoId - Repository ID
|
|
48
|
+
* @param access - Cross-account access configuration
|
|
49
|
+
*/
|
|
50
|
+
addCrossAccountAccess(repoId: string, access: CrossAccountAccess): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Remove cross-account access from a repository.
|
|
53
|
+
*
|
|
54
|
+
* @param repoId - Repository ID
|
|
55
|
+
* @param access - Cross-account access configuration to remove
|
|
56
|
+
*/
|
|
57
|
+
removeCrossAccountAccess(repoId: string, access: CrossAccountAccess): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Get current cross-account access permissions for a repository.
|
|
60
|
+
*
|
|
61
|
+
* @param repoId - Repository ID
|
|
62
|
+
* @returns Current cross-account permissions
|
|
63
|
+
*/
|
|
64
|
+
getCrossAccountAccess(repoId: string): Promise<CrossAccountPermissions>;
|
|
65
|
+
/**
|
|
66
|
+
* Generate credentials for repository access.
|
|
67
|
+
*
|
|
68
|
+
* @param repoId - Repository ID
|
|
69
|
+
* @param permissions - Permission level (pull or push-pull)
|
|
70
|
+
* @param ttlSeconds - Optional TTL in seconds
|
|
71
|
+
* @returns Repository credentials
|
|
72
|
+
*/
|
|
73
|
+
generateCredentials(repoId: string, permissions: ArtifactRegistryPermissions, ttlSeconds?: number): Promise<ArtifactRegistryCredentials>;
|
|
74
|
+
/**
|
|
75
|
+
* Delete a repository.
|
|
76
|
+
*
|
|
77
|
+
* @param repoId - Repository ID
|
|
78
|
+
*/
|
|
79
|
+
deleteRepository(repoId: string): Promise<void>;
|
|
80
|
+
private fromProtoResult;
|
|
81
|
+
private fromProtoCredentials;
|
|
82
|
+
private toProtoCrossAccountAccess;
|
|
83
|
+
private fromProtoCrossAccountAccess;
|
|
84
|
+
private fromProtoCrossAccountPermissions;
|
|
85
|
+
private computeServiceTypeToProto;
|
|
86
|
+
private protoToComputeServiceType;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=artifact-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-registry.d.ts","sourceRoot":"","sources":["../../src/bindings/artifact-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAYtD,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAE3B,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACf,MAAM,aAAa,CAAA;AAQpB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAejE;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAe5D;;;;;OAKG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAetF;;;;;OAKG;IACG,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAezF;;;;;OAKG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAe7E;;;;;;;OAOG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,2BAA2B,EACxC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC;IAiBvC;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBrD,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,yBAAyB;IA0BjC,OAAO,CAAC,2BAA2B;IA6BnC,OAAO,CAAC,gCAAgC;IAYxC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,yBAAyB;CAQlC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build binding implementation.
|
|
3
|
+
*
|
|
4
|
+
* Provides build execution capabilities.
|
|
5
|
+
*/
|
|
6
|
+
import { type Channel } from "nice-grpc";
|
|
7
|
+
import type { BuildExecution, BuildStartConfig } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Build binding for executing build operations.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { build } from "@alienplatform/sdk"
|
|
14
|
+
*
|
|
15
|
+
* const builder = build("my-builder")
|
|
16
|
+
*
|
|
17
|
+
* // Start a build
|
|
18
|
+
* const execution = await builder.start({
|
|
19
|
+
* script: "npm run build",
|
|
20
|
+
* computeType: "medium",
|
|
21
|
+
* timeoutSeconds: 600,
|
|
22
|
+
* })
|
|
23
|
+
*
|
|
24
|
+
* // Wait for completion
|
|
25
|
+
* const result = await builder.waitForCompletion(execution.id)
|
|
26
|
+
* console.log("Build status:", result.status)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class Build {
|
|
30
|
+
private readonly client;
|
|
31
|
+
private readonly bindingName;
|
|
32
|
+
constructor(channel: Channel, bindingName: string);
|
|
33
|
+
/**
|
|
34
|
+
* Start a new build.
|
|
35
|
+
*
|
|
36
|
+
* @param config - Build configuration
|
|
37
|
+
* @returns Build execution information
|
|
38
|
+
*/
|
|
39
|
+
start(config: BuildStartConfig): Promise<BuildExecution>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the status of a build.
|
|
42
|
+
*
|
|
43
|
+
* @param buildId - Build execution ID
|
|
44
|
+
* @returns Build execution information
|
|
45
|
+
*/
|
|
46
|
+
getStatus(buildId: string): Promise<BuildExecution>;
|
|
47
|
+
/**
|
|
48
|
+
* Stop a running build.
|
|
49
|
+
*
|
|
50
|
+
* @param buildId - Build execution ID
|
|
51
|
+
*/
|
|
52
|
+
stop(buildId: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Wait for a build to complete.
|
|
55
|
+
*
|
|
56
|
+
* @param buildId - Build execution ID
|
|
57
|
+
* @param options - Polling options
|
|
58
|
+
* @returns Final build execution information
|
|
59
|
+
*/
|
|
60
|
+
waitForCompletion(buildId: string, options?: {
|
|
61
|
+
pollIntervalMs?: number;
|
|
62
|
+
timeoutMs?: number;
|
|
63
|
+
}): Promise<BuildExecution>;
|
|
64
|
+
private toProtoConfig;
|
|
65
|
+
private fromProtoExecution;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/bindings/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAUtD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAqBnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAiB9D;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAezD;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1C;;;;;;OAMG;IACG,iBAAiB,CACrB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GACxD,OAAO,CAAC,cAAc,CAAC;IAyB1B,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,kBAAkB;CAQ3B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function binding implementation.
|
|
3
|
+
*
|
|
4
|
+
* Provides direct function-to-function invocation.
|
|
5
|
+
*/
|
|
6
|
+
import { type Channel } from "nice-grpc";
|
|
7
|
+
import type { FunctionInvokeRequest, FunctionInvokeResponse } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Function binding for direct function invocation.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { func } from "@alienplatform/sdk"
|
|
14
|
+
*
|
|
15
|
+
* const processor = func("image-processor")
|
|
16
|
+
*
|
|
17
|
+
* // Invoke with JSON body
|
|
18
|
+
* const response = await processor.invokeJson("resize-image", {
|
|
19
|
+
* imageUrl: "https://...",
|
|
20
|
+
* width: 800,
|
|
21
|
+
* height: 600,
|
|
22
|
+
* })
|
|
23
|
+
*
|
|
24
|
+
* // Get function URL
|
|
25
|
+
* const url = await processor.getUrl()
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class FunctionBinding {
|
|
29
|
+
private readonly client;
|
|
30
|
+
private readonly bindingName;
|
|
31
|
+
constructor(channel: Channel, bindingName: string);
|
|
32
|
+
/**
|
|
33
|
+
* Invoke a function with raw request data.
|
|
34
|
+
*
|
|
35
|
+
* @param request - Invocation request
|
|
36
|
+
* @returns Function response
|
|
37
|
+
*/
|
|
38
|
+
invoke(request: FunctionInvokeRequest): Promise<FunctionInvokeResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Invoke a function with a JSON body.
|
|
41
|
+
*
|
|
42
|
+
* @param targetFunction - Target function identifier
|
|
43
|
+
* @param body - JSON body
|
|
44
|
+
* @param options - Optional request options
|
|
45
|
+
* @returns Parsed JSON response
|
|
46
|
+
*/
|
|
47
|
+
invokeJson<TRequest, TResponse = unknown>(targetFunction: string, body: TRequest, options?: {
|
|
48
|
+
method?: string;
|
|
49
|
+
path?: string;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
timeoutMs?: number;
|
|
52
|
+
}): Promise<TResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Invoke a function with GET request.
|
|
55
|
+
*
|
|
56
|
+
* @param targetFunction - Target function identifier
|
|
57
|
+
* @param path - Request path
|
|
58
|
+
* @param options - Optional request options
|
|
59
|
+
* @returns Parsed JSON response
|
|
60
|
+
*/
|
|
61
|
+
get<TResponse = unknown>(targetFunction: string, path?: string, options?: {
|
|
62
|
+
headers?: Record<string, string>;
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
}): Promise<TResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Get the public URL of the function.
|
|
67
|
+
*
|
|
68
|
+
* @returns Function URL if available
|
|
69
|
+
*/
|
|
70
|
+
getUrl(): Promise<string | undefined>;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/bindings/function.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAMtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAwB7E;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,EAC5C,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,QAAQ,EACd,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,GACA,OAAO,CAAC,SAAS,CAAC;IAsBrB;;;;;;;OAOG;IACG,GAAG,CAAC,SAAS,GAAG,OAAO,EAC3B,cAAc,EAAE,MAAM,EACtB,IAAI,SAAM,EACV,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,GACA,OAAO,CAAC,SAAS,CAAC;IAkBrB;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAa5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binding exports.
|
|
3
|
+
*/
|
|
4
|
+
export { Storage } from "./storage.js";
|
|
5
|
+
export { Kv } from "./kv.js";
|
|
6
|
+
export { Queue } from "./queue.js";
|
|
7
|
+
export { Vault } from "./vault.js";
|
|
8
|
+
export { Build } from "./build.js";
|
|
9
|
+
export { ArtifactRegistry } from "./artifact-registry.js";
|
|
10
|
+
export { FunctionBinding } from "./function.js";
|
|
11
|
+
export { ServiceAccount } from "./service-account.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bindings/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KV binding implementation.
|
|
3
|
+
*
|
|
4
|
+
* Provides key-value storage operations with TTL support.
|
|
5
|
+
*/
|
|
6
|
+
import { type Channel } from "nice-grpc";
|
|
7
|
+
import type { KvPutOptions, KvScanResult } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* KV binding for key-value storage operations.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { kv } from "@alienplatform/sdk"
|
|
14
|
+
*
|
|
15
|
+
* const cache = kv("my-cache")
|
|
16
|
+
*
|
|
17
|
+
* // Set a value
|
|
18
|
+
* await cache.set("user:123", { name: "John", email: "john@example.com" })
|
|
19
|
+
*
|
|
20
|
+
* // Get a value
|
|
21
|
+
* const user = await cache.getJson<User>("user:123")
|
|
22
|
+
*
|
|
23
|
+
* // Set with TTL (expires in 1 hour)
|
|
24
|
+
* await cache.set("session:abc", sessionData, { ttlMs: 60 * 60 * 1000 })
|
|
25
|
+
*
|
|
26
|
+
* // Delete
|
|
27
|
+
* await cache.delete("user:123")
|
|
28
|
+
*
|
|
29
|
+
* // Scan by prefix
|
|
30
|
+
* for await (const { key, value } of cache.scan("user:")) {
|
|
31
|
+
* console.log(key, value)
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class Kv {
|
|
36
|
+
private readonly client;
|
|
37
|
+
private readonly bindingName;
|
|
38
|
+
constructor(channel: Channel, bindingName: string);
|
|
39
|
+
/**
|
|
40
|
+
* Get a value by key.
|
|
41
|
+
*
|
|
42
|
+
* @param key - Key to retrieve
|
|
43
|
+
* @returns Value as Uint8Array, or undefined if not found
|
|
44
|
+
*/
|
|
45
|
+
get(key: string): Promise<Uint8Array | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Get a value as a UTF-8 string.
|
|
48
|
+
*
|
|
49
|
+
* @param key - Key to retrieve
|
|
50
|
+
* @returns Value as string, or undefined if not found
|
|
51
|
+
*/
|
|
52
|
+
getText(key: string): Promise<string | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Get a value and parse as JSON.
|
|
55
|
+
*
|
|
56
|
+
* @param key - Key to retrieve
|
|
57
|
+
* @returns Parsed JSON value, or undefined if not found
|
|
58
|
+
*/
|
|
59
|
+
getJson<T = unknown>(key: string): Promise<T | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Set a value.
|
|
62
|
+
*
|
|
63
|
+
* @param key - Key to store
|
|
64
|
+
* @param value - Value to store (string, Uint8Array, or object for JSON)
|
|
65
|
+
* @param options - Optional put options (TTL, ifNotExists)
|
|
66
|
+
* @returns True if stored, false if ifNotExists was true and key already exists
|
|
67
|
+
*/
|
|
68
|
+
set(key: string, value: string | Uint8Array | object, options?: KvPutOptions): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Delete a key.
|
|
71
|
+
*
|
|
72
|
+
* @param key - Key to delete
|
|
73
|
+
*/
|
|
74
|
+
delete(key: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a key exists.
|
|
77
|
+
*
|
|
78
|
+
* @param key - Key to check
|
|
79
|
+
* @returns True if the key exists
|
|
80
|
+
*/
|
|
81
|
+
exists(key: string): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Scan keys with a prefix.
|
|
84
|
+
*
|
|
85
|
+
* @param prefix - Prefix to scan for
|
|
86
|
+
* @param options - Optional scan options (limit)
|
|
87
|
+
* @returns Async iterable of key-value pairs
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Scan all users
|
|
92
|
+
* for await (const { key, value } of cache.scan("user:")) {
|
|
93
|
+
* console.log(key, new TextDecoder().decode(value))
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
scan(prefix: string, options?: {
|
|
98
|
+
limit?: number;
|
|
99
|
+
}): AsyncIterable<{
|
|
100
|
+
key: string;
|
|
101
|
+
value: Uint8Array;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Scan a single page of results.
|
|
105
|
+
*
|
|
106
|
+
* @param prefix - Prefix to scan for
|
|
107
|
+
* @param limit - Maximum items to return
|
|
108
|
+
* @param cursor - Pagination cursor
|
|
109
|
+
* @returns Scan result with items and next cursor
|
|
110
|
+
*/
|
|
111
|
+
scanPage(prefix: string, limit?: number, cursor?: string): Promise<KvScanResult>;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=kv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kv.d.ts","sourceRoot":"","sources":["../../src/bindings/kv.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAMtD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,EAAE;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAevD;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKvD;;;;;OAKG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAK/D;;;;;;;OAOG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EACnC,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,OAAO,CAAC;IAgCnB;;;;OAIG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxC;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe3C;;;;;;;;;;;;;;OAcG;IACI,IAAI,CACT,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3B,aAAa,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC;IAcpD;;;;;;;OAOG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAsBvF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue binding implementation.
|
|
3
|
+
*
|
|
4
|
+
* Provides message queue operations for async task processing.
|
|
5
|
+
*/
|
|
6
|
+
import { type Channel } from "nice-grpc";
|
|
7
|
+
import type { ReceivedQueueMessage } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Queue binding for message queue operations.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { queue } from "@alienplatform/sdk"
|
|
14
|
+
*
|
|
15
|
+
* const tasks = queue("task-queue")
|
|
16
|
+
*
|
|
17
|
+
* // Send a message (JSON)
|
|
18
|
+
* await tasks.send("process-image", { imageId: "123", format: "webp" })
|
|
19
|
+
*
|
|
20
|
+
* // Receive messages
|
|
21
|
+
* const messages = await tasks.receive("process-image", 10)
|
|
22
|
+
* for (const msg of messages) {
|
|
23
|
+
* await processImage(msg.payload)
|
|
24
|
+
* await tasks.ack("process-image", msg.receiptHandle)
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class Queue {
|
|
29
|
+
private readonly client;
|
|
30
|
+
private readonly bindingName;
|
|
31
|
+
constructor(channel: Channel, bindingName: string);
|
|
32
|
+
/**
|
|
33
|
+
* Send a message to a queue.
|
|
34
|
+
*
|
|
35
|
+
* @param queueName - Name of the queue
|
|
36
|
+
* @param payload - Message payload (object for JSON, string for text)
|
|
37
|
+
*/
|
|
38
|
+
send(queueName: string, payload: unknown): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Send a text message to a queue.
|
|
41
|
+
*
|
|
42
|
+
* @param queueName - Name of the queue
|
|
43
|
+
* @param text - Text message
|
|
44
|
+
*/
|
|
45
|
+
sendText(queueName: string, text: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Receive messages from a queue.
|
|
48
|
+
*
|
|
49
|
+
* @param queueName - Name of the queue
|
|
50
|
+
* @param maxMessages - Maximum number of messages to receive (1-10)
|
|
51
|
+
* @returns Array of messages with receipt handles
|
|
52
|
+
*/
|
|
53
|
+
receive<T = unknown>(queueName: string, maxMessages?: number): Promise<ReceivedQueueMessage<T>[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Acknowledge a message (remove it from the queue).
|
|
56
|
+
*
|
|
57
|
+
* @param queueName - Name of the queue
|
|
58
|
+
* @param receiptHandle - Receipt handle from the received message
|
|
59
|
+
*/
|
|
60
|
+
ack(queueName: string, receiptHandle: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Process messages from a queue with automatic acknowledgment.
|
|
63
|
+
*
|
|
64
|
+
* @param queueName - Name of the queue
|
|
65
|
+
* @param handler - Handler function for each message
|
|
66
|
+
* @param options - Processing options
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* await tasks.process("image-tasks", async (payload) => {
|
|
71
|
+
* await processImage(payload.imageId)
|
|
72
|
+
* })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
process<T = unknown>(queueName: string, handler: (payload: T) => Promise<void>, options?: {
|
|
76
|
+
maxMessages?: number;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
private toProtoPayload;
|
|
79
|
+
private fromProtoMessage;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/bindings/queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,WAAW,CAAA;AAQtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM;IAKjD;;;;;OAKG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB9D;;;;;OAKG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe9D;;;;;;OAMG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,WAAW,SAAI,GACd,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;IAgBrC;;;;;OAKG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAelE;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EACtC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC,IAAI,CAAC;IAahB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,gBAAgB;CAgBzB"}
|