Skip to content

Commit ea00702

Browse files
committed
Build SDK
Stainless-Generated-From: 67ce0a957d9385067efdc62fec3c17095a9728b6
1 parent 28fc3a5 commit ea00702

13 files changed

Lines changed: 344 additions & 11 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Please
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
if: github.repository == 'kernel/hypeman-ts'
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1
18+
id: release
19+
with:
20+
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
CHANGELOG.md
2-
pnpm-lock.yaml
32
/ecosystem-tests/*/**
43
/node_modules
54
/pnpm-lock.yaml
65
/deno
76

87
# don't format tsc output, will break source maps
98
/dist
9+
10+
/.github/workflows/release-doctor.yml

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 53
1+
configured_endpoints: 58

api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ Methods:
187187
- <code title="get /resources">client.resources.<a href="./src/resources/resources.ts">get</a>() -> Resources</code>
188188
- <code title="post /resources/memory/reclaim">client.resources.<a href="./src/resources/resources.ts">reclaimMemory</a>({ ...params }) -> MemoryReclaimResponse</code>
189189

190+
# Builders
191+
192+
Types:
193+
194+
- <code><a href="./src/resources/builders.ts">Builder</a></code>
195+
- <code><a href="./src/resources/builders.ts">BuilderStatus</a></code>
196+
- <code><a href="./src/resources/builders.ts">BuilderListResponse</a></code>
197+
198+
Methods:
199+
200+
- <code title="post /builders">client.builders.<a href="./src/resources/builders.ts">create</a>({ ...params }) -> Builder</code>
201+
- <code title="get /builders">client.builders.<a href="./src/resources/builders.ts">list</a>({ ...params }) -> BuilderListResponse</code>
202+
- <code title="delete /builders/{id}">client.builders.<a href="./src/resources/builders.ts">delete</a>(id) -> void</code>
203+
- <code title="get /builders/{id}">client.builders.<a href="./src/resources/builders.ts">get</a>(id) -> Builder</code>
204+
- <code title="post /builders/{id}/prune">client.builders.<a href="./src/resources/builders.ts">prune</a>(id) -> Builder</code>
205+
190206
# Builds
191207

192208
Types:

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/utils/upload-artifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ UPLOAD_RESPONSE=$(curl -v -X PUT \
2020

2121
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
2222
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
23-
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/hypeman-ts/$SHA'\033[0m"
23+
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/hypeman-ts-staging/$SHA'\033[0m"
2424
else
2525
echo -e "\033[31mFailed to upload artifact.\033[0m"
2626
exit 1

src/client.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ import * as Errors from './core/error';
1717
import * as Uploads from './core/uploads';
1818
import * as API from './resources/index';
1919
import { APIPromise } from './core/api-promise';
20+
import {
21+
Builder,
22+
BuilderCreateParams,
23+
BuilderListParams,
24+
BuilderListResponse,
25+
BuilderStatus,
26+
Builders,
27+
} from './resources/builders';
2028
import {
2129
Build,
2230
BuildCreateParams,
@@ -225,7 +233,7 @@ export class Hypeman {
225233
* API Client for interfacing with the Hypeman API.
226234
*
227235
* @param {string | undefined} [opts.apiKey=process.env['HYPEMAN_API_KEY'] ?? undefined]
228-
* @param {string} [opts.baseURL=process.env['HYPEMAN_BASE_URL'] ?? http://localhost:8080] - Override the default base URL for the API.
236+
* @param {string} [opts.baseURL=process.env['HYPEMAN_BASE_URL'] ?? http://localhost:4973] - Override the default base URL for the API.
229237
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
230238
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
231239
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -247,7 +255,7 @@ export class Hypeman {
247255
const options: ClientOptions = {
248256
apiKey,
249257
...opts,
250-
baseURL: baseURL || `http://localhost:8080`,
258+
baseURL: baseURL || `http://localhost:4973`,
251259
};
252260

253261
this.baseURL = options.baseURL!;
@@ -305,7 +313,7 @@ export class Hypeman {
305313
* Check whether the base URL is set to its default.
306314
*/
307315
#baseURLOverridden(): boolean {
308-
return this.baseURL !== 'http://localhost:8080';
316+
return this.baseURL !== 'http://localhost:4973';
309317
}
310318

311319
protected defaultQuery(): Record<string, string | undefined> | undefined {
@@ -840,6 +848,7 @@ export class Hypeman {
840848
devices: API.Devices = new API.Devices(this);
841849
ingresses: API.Ingresses = new API.Ingresses(this);
842850
resources: API.Resources = new API.Resources(this);
851+
builders: API.Builders = new API.Builders(this);
843852
builds: API.Builds = new API.Builds(this);
844853
}
845854

@@ -850,6 +859,7 @@ Hypeman.Snapshots = Snapshots;
850859
Hypeman.Volumes = Volumes;
851860
Hypeman.Devices = Devices;
852861
Hypeman.Ingresses = Ingresses;
862+
Hypeman.Builders = Builders;
853863
Hypeman.Builds = Builds;
854864

855865
export declare namespace Hypeman {
@@ -955,6 +965,15 @@ export declare namespace Hypeman {
955965
type ResourceReclaimMemoryParams as ResourceReclaimMemoryParams,
956966
};
957967

968+
export {
969+
Builders as Builders,
970+
type Builder as Builder,
971+
type BuilderStatus as BuilderStatus,
972+
type BuilderListResponse as BuilderListResponse,
973+
type BuilderCreateParams as BuilderCreateParams,
974+
type BuilderListParams as BuilderListParams,
975+
};
976+
958977
export {
959978
Builds as Builds,
960979
type Build as Build,

src/resources/builders.ts

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../core/resource';
4+
import { APIPromise } from '../core/api-promise';
5+
import { buildHeaders } from '../internal/headers';
6+
import { RequestOptions } from '../internal/request-options';
7+
import { path } from '../internal/utils/path';
8+
9+
export class Builders extends APIResource {
10+
/**
11+
* Creates a builder and its cache disk. One build at a time runs per builder.
12+
*
13+
* @example
14+
* ```ts
15+
* const builder = await client.builders.create();
16+
* ```
17+
*/
18+
create(body: BuilderCreateParams, options?: RequestOptions): APIPromise<Builder> {
19+
return this._client.post('/builders', { body, ...options });
20+
}
21+
22+
/**
23+
* List builders
24+
*
25+
* @example
26+
* ```ts
27+
* const builders = await client.builders.list();
28+
* ```
29+
*/
30+
list(
31+
query: BuilderListParams | null | undefined = {},
32+
options?: RequestOptions,
33+
): APIPromise<BuilderListResponse> {
34+
return this._client.get('/builders', { query, ...options });
35+
}
36+
37+
/**
38+
* Permanently deletes a builder and its cache disk.
39+
*
40+
* @example
41+
* ```ts
42+
* await client.builders.delete('id');
43+
* ```
44+
*/
45+
delete(id: string, options?: RequestOptions): APIPromise<void> {
46+
return this._client.delete(path`/builders/${id}`, {
47+
...options,
48+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
49+
});
50+
}
51+
52+
/**
53+
* Get builder details
54+
*
55+
* @example
56+
* ```ts
57+
* const builder = await client.builders.get('id');
58+
* ```
59+
*/
60+
get(id: string, options?: RequestOptions): APIPromise<Builder> {
61+
return this._client.get(path`/builders/${id}`, options);
62+
}
63+
64+
/**
65+
* Resets the builder's cache disk. The builder transitions to pruning, then ready.
66+
* Builder identity is preserved.
67+
*
68+
* @example
69+
* ```ts
70+
* const builder = await client.builders.prune('id');
71+
* ```
72+
*/
73+
prune(id: string, options?: RequestOptions): APIPromise<Builder> {
74+
return this._client.post(path`/builders/${id}/prune`, options);
75+
}
76+
}
77+
78+
export interface Builder {
79+
/**
80+
* Builder identifier
81+
*/
82+
id: string;
83+
84+
/**
85+
* Creation timestamp (RFC3339)
86+
*/
87+
created_at: string;
88+
89+
/**
90+
* Persistent builder cache disk size in gigabytes. Cannot be changed after
91+
* creation.
92+
*/
93+
disk_size_gb: number;
94+
95+
/**
96+
* Maximum concurrent builds on this builder. Currently fixed at 1.
97+
*/
98+
max_concurrency: number;
99+
100+
/**
101+
* Point-in-time IDs of queued builds waiting for this builder, oldest first
102+
*/
103+
queued_builds: Array<string>;
104+
105+
/**
106+
* Builder lifecycle status
107+
*/
108+
status: BuilderStatus;
109+
110+
/**
111+
* Point-in-time ID of the build currently running on this builder
112+
*/
113+
active_build_id?: string | null;
114+
115+
/**
116+
* When a build last ran on this builder
117+
*/
118+
last_used_at?: string | null;
119+
120+
/**
121+
* Optional non-unique display name
122+
*/
123+
name?: string;
124+
125+
/**
126+
* User-defined key-value tags.
127+
*/
128+
tags?: { [key: string]: string };
129+
}
130+
131+
/**
132+
* Builder lifecycle status
133+
*/
134+
export type BuilderStatus = 'ready' | 'pruning' | 'deleting' | 'error';
135+
136+
export type BuilderListResponse = Array<Builder>;
137+
138+
export interface BuilderCreateParams {
139+
/**
140+
* Optional caller-supplied identifier, auto-generated if not provided
141+
*/
142+
id?: string;
143+
144+
/**
145+
* Cache disk size in gigabytes. Omit to use the server default.
146+
*/
147+
disk_size_gb?: number;
148+
149+
/**
150+
* Optional non-unique display name
151+
*/
152+
name?: string;
153+
154+
/**
155+
* User-defined key-value tags.
156+
*/
157+
tags?: { [key: string]: string };
158+
}
159+
160+
export interface BuilderListParams {
161+
/**
162+
* Filter builders by tag key-value pairs.
163+
*/
164+
tags?: { [key: string]: string };
165+
}
166+
167+
export declare namespace Builders {
168+
export {
169+
type Builder as Builder,
170+
type BuilderStatus as BuilderStatus,
171+
type BuilderListResponse as BuilderListResponse,
172+
type BuilderCreateParams as BuilderCreateParams,
173+
type BuilderListParams as BuilderListParams,
174+
};
175+
}

src/resources/builds.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ export interface Build {
8585
status: BuildStatus;
8686

8787
/**
88-
* Instance ID of the builder VM (for debugging)
88+
* Persistent Builder resource whose cache backed this build
89+
*/
90+
builder_id?: string | null;
91+
92+
/**
93+
* Disposable VM instance that executed this build; distinct from builder_id
8994
*/
9095
builder_instance_id?: string | null;
9196

@@ -221,6 +226,13 @@ export interface BuildCreateParams {
221226
*/
222227
base_image_digest?: string;
223228

229+
/**
230+
* Optional Builder ID whose persistent cache disk backs this build. This is the
231+
* only builder selector. One build at a time runs on a builder; builds for the
232+
* same builder are serialized.
233+
*/
234+
builder_id?: string;
235+
224236
/**
225237
* Tenant-specific cache key prefix
226238
*/

src/resources/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
export * from './shared';
4+
export {
5+
Builders,
6+
type Builder,
7+
type BuilderStatus,
8+
type BuilderListResponse,
9+
type BuilderCreateParams,
10+
type BuilderListParams,
11+
} from './builders';
412
export {
513
Builds,
614
type Build,

0 commit comments

Comments
 (0)