@hoststack.dev/sdk 0.2.0 → 0.3.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/dist/index.cjs +88 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +196 -26
- package/dist/index.d.ts +196 -26
- package/dist/index.js +88 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -37,28 +37,70 @@ interface CreateServiceInput {
|
|
|
37
37
|
buildCommand?: string;
|
|
38
38
|
startCommand?: string;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
|
|
42
|
+
* Nullable fields accept `null` to clear; `undefined` leaves the value unchanged.
|
|
43
|
+
*/
|
|
40
44
|
interface UpdateServiceInput {
|
|
41
45
|
name?: string;
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
branch?: string;
|
|
47
|
+
rootDirectory?: string;
|
|
48
|
+
autoDeploy?: boolean;
|
|
49
|
+
installCommand?: string | null;
|
|
44
50
|
buildCommand?: string | null;
|
|
45
51
|
startCommand?: string | null;
|
|
46
|
-
branch?: string | null;
|
|
47
|
-
rootDirectory?: string | null;
|
|
48
52
|
dockerfilePath?: string | null;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
healthCheckPath?: string | null;
|
|
54
|
+
cronSchedule?: string | null;
|
|
55
|
+
publishPath?: string | null;
|
|
56
|
+
runtime?: string;
|
|
52
57
|
}
|
|
58
|
+
interface ServiceConfig {
|
|
59
|
+
memoryMb?: number;
|
|
60
|
+
cpuShares?: number;
|
|
61
|
+
diskSizeGb?: number;
|
|
62
|
+
port?: number;
|
|
63
|
+
protocol?: 'http' | 'tcp';
|
|
64
|
+
healthCheckEnabled?: boolean;
|
|
65
|
+
healthCheckInterval?: number;
|
|
66
|
+
healthCheckTimeout?: number;
|
|
67
|
+
healthCheckGracePeriodSec?: number;
|
|
68
|
+
preDeployCommand?: string | null;
|
|
69
|
+
restartPolicy?: 'always' | 'on-failure' | 'no';
|
|
70
|
+
minInstances?: number;
|
|
71
|
+
maxInstances?: number;
|
|
72
|
+
scaleCpuThreshold?: number;
|
|
73
|
+
scaleMemoryThreshold?: number;
|
|
74
|
+
scaleRequestsPerSecThreshold?: number | null;
|
|
75
|
+
dockerImage?: string | null;
|
|
76
|
+
registryUsername?: string | null;
|
|
77
|
+
registryPassword?: string | null;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fields that live on the `service_config` row — write via PATCH
|
|
81
|
+
* /services/:tid/:sid/config. Build/runtime fields (build/start command,
|
|
82
|
+
* branch, rootDirectory) belong on UpdateServiceInput, not here.
|
|
83
|
+
*/
|
|
53
84
|
interface UpdateServiceConfigInput {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
85
|
+
memoryMb?: number;
|
|
86
|
+
cpuShares?: number;
|
|
87
|
+
diskSizeGb?: number;
|
|
88
|
+
port?: number;
|
|
89
|
+
protocol?: 'http' | 'tcp';
|
|
90
|
+
healthCheckEnabled?: boolean;
|
|
91
|
+
healthCheckInterval?: number;
|
|
92
|
+
healthCheckTimeout?: number;
|
|
93
|
+
healthCheckGracePeriodSec?: number;
|
|
94
|
+
preDeployCommand?: string;
|
|
95
|
+
restartPolicy?: 'always' | 'on-failure' | 'no';
|
|
96
|
+
minInstances?: number;
|
|
97
|
+
maxInstances?: number;
|
|
98
|
+
scaleCpuThreshold?: number;
|
|
99
|
+
scaleMemoryThreshold?: number;
|
|
100
|
+
scaleRequestsPerSecThreshold?: number | null;
|
|
101
|
+
dockerImage?: string | null;
|
|
102
|
+
registryUsername?: string | null;
|
|
103
|
+
registryPassword?: string | null;
|
|
62
104
|
}
|
|
63
105
|
interface Deploy {
|
|
64
106
|
id: number;
|
|
@@ -74,22 +116,30 @@ interface Deploy {
|
|
|
74
116
|
interface TriggerDeployInput {
|
|
75
117
|
clearCache?: boolean;
|
|
76
118
|
}
|
|
119
|
+
/** Managed database engines supported by HostStack. */
|
|
120
|
+
type DatabaseEngine = 'postgres' | 'redis' | 'mysql' | 'mariadb' | 'mongodb';
|
|
77
121
|
interface Database {
|
|
78
122
|
id: number;
|
|
79
123
|
publicId: string;
|
|
80
124
|
name: string;
|
|
81
|
-
type
|
|
125
|
+
/** The engine name. The legacy `type` alias still ships in API responses
|
|
126
|
+
* but is deprecated — read `engine` going forward. */
|
|
127
|
+
engine: DatabaseEngine;
|
|
82
128
|
status: string;
|
|
83
129
|
version?: string | null;
|
|
130
|
+
plan?: string | null;
|
|
131
|
+
region?: string | null;
|
|
84
132
|
projectId: number;
|
|
85
133
|
createdAt: string;
|
|
86
134
|
updatedAt: string;
|
|
87
135
|
}
|
|
88
136
|
interface CreateDatabaseInput {
|
|
89
137
|
name: string;
|
|
90
|
-
|
|
138
|
+
engine: DatabaseEngine;
|
|
91
139
|
projectId: number;
|
|
92
140
|
version?: string;
|
|
141
|
+
plan?: 'free' | 'starter' | 'standard' | 'pro';
|
|
142
|
+
region?: string;
|
|
93
143
|
}
|
|
94
144
|
interface UpdateDatabaseInput {
|
|
95
145
|
name?: string;
|
|
@@ -102,6 +152,36 @@ interface DatabaseCredentials {
|
|
|
102
152
|
database: string;
|
|
103
153
|
connectionUrl: string;
|
|
104
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* A persistent disk attached to a service. Survives redeploys and
|
|
157
|
+
* container restarts. One service can have multiple volumes; each one is
|
|
158
|
+
* identified by a short `name` and a `mountPath` inside the container.
|
|
159
|
+
*/
|
|
160
|
+
interface Volume {
|
|
161
|
+
id: number;
|
|
162
|
+
publicId: string;
|
|
163
|
+
name: string;
|
|
164
|
+
mountPath: string;
|
|
165
|
+
sizeGb: number;
|
|
166
|
+
status: 'pending' | 'active' | 'deleting';
|
|
167
|
+
serviceId: number;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
updatedAt: string;
|
|
170
|
+
}
|
|
171
|
+
interface CreateVolumeInput {
|
|
172
|
+
/** Lowercase alphanumeric and hyphens, ≤64 chars. Used as the docker
|
|
173
|
+
* volume identifier — change with care once data is written. */
|
|
174
|
+
name: string;
|
|
175
|
+
/** In-container absolute path where the volume mounts. */
|
|
176
|
+
mountPath: string;
|
|
177
|
+
/** Disk size in GB. 1–100, default 1. Counts against your plan's
|
|
178
|
+
* storage quota and is metered for billing. */
|
|
179
|
+
sizeGb?: number;
|
|
180
|
+
}
|
|
181
|
+
interface UpdateVolumeInput {
|
|
182
|
+
mountPath?: string;
|
|
183
|
+
sizeGb?: number;
|
|
184
|
+
}
|
|
105
185
|
interface Domain {
|
|
106
186
|
id: number;
|
|
107
187
|
publicId: string;
|
|
@@ -156,8 +236,14 @@ interface Team {
|
|
|
156
236
|
role: string;
|
|
157
237
|
}
|
|
158
238
|
interface MeResponse {
|
|
159
|
-
user
|
|
160
|
-
|
|
239
|
+
/** Null when authenticated with an API key (no associated user). */
|
|
240
|
+
user: User | null;
|
|
241
|
+
team?: Team | null;
|
|
242
|
+
apiKey?: {
|
|
243
|
+
id: number;
|
|
244
|
+
permission: string;
|
|
245
|
+
};
|
|
246
|
+
stripeMode?: string;
|
|
161
247
|
}
|
|
162
248
|
interface ServiceMetrics {
|
|
163
249
|
cpu: number;
|
|
@@ -238,13 +324,24 @@ declare class DatabasesResource {
|
|
|
238
324
|
resetPassword(teamId: IdInput, databaseId: IdInput): Promise<void>;
|
|
239
325
|
}
|
|
240
326
|
|
|
327
|
+
interface DeployListResponse {
|
|
328
|
+
data: Deploy[];
|
|
329
|
+
page: number;
|
|
330
|
+
perPage: number;
|
|
331
|
+
total: number;
|
|
332
|
+
totalPages: number;
|
|
333
|
+
}
|
|
241
334
|
declare class DeploysResource {
|
|
242
335
|
private client;
|
|
243
336
|
constructor(client: HostStack);
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
337
|
+
/**
|
|
338
|
+
* List deploys for a service. Paginated — pass `page` / `perPage` to walk
|
|
339
|
+
* pages. Default page=1, perPage=25, hard cap perPage=100.
|
|
340
|
+
*/
|
|
341
|
+
list(teamId: IdInput, serviceId: IdInput, options?: {
|
|
342
|
+
page?: number;
|
|
343
|
+
perPage?: number;
|
|
344
|
+
}): Promise<DeployListResponse>;
|
|
248
345
|
/** Get a single deploy by ID. */
|
|
249
346
|
get(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<{
|
|
250
347
|
deploy: Deploy;
|
|
@@ -257,11 +354,31 @@ declare class DeploysResource {
|
|
|
257
354
|
cancel(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
258
355
|
/** Rollback to a previous deploy. */
|
|
259
356
|
rollback(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
357
|
+
/**
|
|
358
|
+
* Get build logs for a deploy.
|
|
359
|
+
*
|
|
360
|
+
* Pagination: pass `afterId` from the previous response's `nextAfterId`
|
|
361
|
+
* to fetch the next page. Per-call cap is 5000; default 500.
|
|
362
|
+
*/
|
|
363
|
+
getLogs(teamId: IdInput, serviceId: IdInput, deployId: IdInput, options?: {
|
|
364
|
+
search?: string;
|
|
365
|
+
level?: string;
|
|
366
|
+
phase?: string;
|
|
367
|
+
limit?: number;
|
|
368
|
+
afterId?: number;
|
|
369
|
+
}): Promise<{
|
|
370
|
+
logs: DeployLogEntry[];
|
|
371
|
+
nextAfterId: number | null;
|
|
263
372
|
}>;
|
|
264
373
|
}
|
|
374
|
+
interface DeployLogEntry {
|
|
375
|
+
id: number;
|
|
376
|
+
deployId: number;
|
|
377
|
+
timestamp: string;
|
|
378
|
+
level: 'info' | 'warn' | 'error' | 'debug';
|
|
379
|
+
phase: string | null;
|
|
380
|
+
message: string;
|
|
381
|
+
}
|
|
265
382
|
|
|
266
383
|
declare class DomainsResource {
|
|
267
384
|
private client;
|
|
@@ -411,6 +528,53 @@ declare class ServicesResource {
|
|
|
411
528
|
streamLogs(teamId: IdInput, serviceId: IdInput, options?: StreamLogsOptions): AsyncGenerator<LogEntry>;
|
|
412
529
|
}
|
|
413
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Manage persistent disks attached to a service.
|
|
533
|
+
*
|
|
534
|
+
* Volumes mount a writable disk into a service's container at the path you
|
|
535
|
+
* choose, surviving redeploys and container restarts. One service can have
|
|
536
|
+
* multiple volumes; each one is identified by a short `name` and a
|
|
537
|
+
* `mountPath`.
|
|
538
|
+
*
|
|
539
|
+
* Renderers porting from render.yaml: a volume here is the same concept as
|
|
540
|
+
* Render's `disk:` block. Use {@link create} to attach one programmatically,
|
|
541
|
+
* or declare it in `hoststack.yaml` for IaC workflows.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* await client.volumes.create(team, service, {
|
|
546
|
+
* name: 'data',
|
|
547
|
+
* mountPath: '/var/data',
|
|
548
|
+
* sizeGb: 10,
|
|
549
|
+
* });
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
declare class VolumesResource {
|
|
553
|
+
private client;
|
|
554
|
+
constructor(client: HostStack);
|
|
555
|
+
/** List volumes attached to a service. */
|
|
556
|
+
list(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
557
|
+
volumes: Volume[];
|
|
558
|
+
}>;
|
|
559
|
+
/** Attach a new volume to a service. Triggers provisioning on the host. */
|
|
560
|
+
create(teamId: IdInput, serviceId: IdInput, data: CreateVolumeInput): Promise<{
|
|
561
|
+
volume: Volume;
|
|
562
|
+
}>;
|
|
563
|
+
/**
|
|
564
|
+
* Update a volume's mountPath or sizeGb. Resizes that take effect on the
|
|
565
|
+
* next deploy; mountPath changes require a redeploy to remount.
|
|
566
|
+
*/
|
|
567
|
+
update(teamId: IdInput, serviceId: IdInput, volumeId: IdInput, data: UpdateVolumeInput): Promise<{
|
|
568
|
+
volume: Volume;
|
|
569
|
+
}>;
|
|
570
|
+
/**
|
|
571
|
+
* Detach and deprovision a volume. The underlying disk is destroyed —
|
|
572
|
+
* back up any data first. Async: the row is marked `deleting` and the
|
|
573
|
+
* agent finalises the removal once it acks.
|
|
574
|
+
*/
|
|
575
|
+
delete(teamId: IdInput, serviceId: IdInput, volumeId: IdInput): Promise<void>;
|
|
576
|
+
}
|
|
577
|
+
|
|
414
578
|
/** A numeric id or a publicId string (e.g. 42, "42", "svc_abc…"). */
|
|
415
579
|
type IdInput = number | string;
|
|
416
580
|
interface HostStackOptions {
|
|
@@ -437,6 +601,10 @@ type ResolveScope = {
|
|
|
437
601
|
} | {
|
|
438
602
|
kind: 'domain';
|
|
439
603
|
teamId: number;
|
|
604
|
+
} | {
|
|
605
|
+
kind: 'volume';
|
|
606
|
+
teamId: number;
|
|
607
|
+
serviceId: number;
|
|
440
608
|
} | {
|
|
441
609
|
kind: 'envVar';
|
|
442
610
|
teamId: number;
|
|
@@ -464,6 +632,8 @@ declare class HostStack {
|
|
|
464
632
|
readonly envVars: EnvVarsResource;
|
|
465
633
|
/** Manage cron job executions. */
|
|
466
634
|
readonly cron: CronResource;
|
|
635
|
+
/** Manage persistent disks attached to services. */
|
|
636
|
+
readonly volumes: VolumesResource;
|
|
467
637
|
constructor(options: HostStackOptions);
|
|
468
638
|
/**
|
|
469
639
|
* Make an authenticated request to the HostStack API.
|
package/dist/index.d.ts
CHANGED
|
@@ -37,28 +37,70 @@ interface CreateServiceInput {
|
|
|
37
37
|
buildCommand?: string;
|
|
38
38
|
startCommand?: string;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
|
|
42
|
+
* Nullable fields accept `null` to clear; `undefined` leaves the value unchanged.
|
|
43
|
+
*/
|
|
40
44
|
interface UpdateServiceInput {
|
|
41
45
|
name?: string;
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
branch?: string;
|
|
47
|
+
rootDirectory?: string;
|
|
48
|
+
autoDeploy?: boolean;
|
|
49
|
+
installCommand?: string | null;
|
|
44
50
|
buildCommand?: string | null;
|
|
45
51
|
startCommand?: string | null;
|
|
46
|
-
branch?: string | null;
|
|
47
|
-
rootDirectory?: string | null;
|
|
48
52
|
dockerfilePath?: string | null;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
healthCheckPath?: string | null;
|
|
54
|
+
cronSchedule?: string | null;
|
|
55
|
+
publishPath?: string | null;
|
|
56
|
+
runtime?: string;
|
|
52
57
|
}
|
|
58
|
+
interface ServiceConfig {
|
|
59
|
+
memoryMb?: number;
|
|
60
|
+
cpuShares?: number;
|
|
61
|
+
diskSizeGb?: number;
|
|
62
|
+
port?: number;
|
|
63
|
+
protocol?: 'http' | 'tcp';
|
|
64
|
+
healthCheckEnabled?: boolean;
|
|
65
|
+
healthCheckInterval?: number;
|
|
66
|
+
healthCheckTimeout?: number;
|
|
67
|
+
healthCheckGracePeriodSec?: number;
|
|
68
|
+
preDeployCommand?: string | null;
|
|
69
|
+
restartPolicy?: 'always' | 'on-failure' | 'no';
|
|
70
|
+
minInstances?: number;
|
|
71
|
+
maxInstances?: number;
|
|
72
|
+
scaleCpuThreshold?: number;
|
|
73
|
+
scaleMemoryThreshold?: number;
|
|
74
|
+
scaleRequestsPerSecThreshold?: number | null;
|
|
75
|
+
dockerImage?: string | null;
|
|
76
|
+
registryUsername?: string | null;
|
|
77
|
+
registryPassword?: string | null;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fields that live on the `service_config` row — write via PATCH
|
|
81
|
+
* /services/:tid/:sid/config. Build/runtime fields (build/start command,
|
|
82
|
+
* branch, rootDirectory) belong on UpdateServiceInput, not here.
|
|
83
|
+
*/
|
|
53
84
|
interface UpdateServiceConfigInput {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
85
|
+
memoryMb?: number;
|
|
86
|
+
cpuShares?: number;
|
|
87
|
+
diskSizeGb?: number;
|
|
88
|
+
port?: number;
|
|
89
|
+
protocol?: 'http' | 'tcp';
|
|
90
|
+
healthCheckEnabled?: boolean;
|
|
91
|
+
healthCheckInterval?: number;
|
|
92
|
+
healthCheckTimeout?: number;
|
|
93
|
+
healthCheckGracePeriodSec?: number;
|
|
94
|
+
preDeployCommand?: string;
|
|
95
|
+
restartPolicy?: 'always' | 'on-failure' | 'no';
|
|
96
|
+
minInstances?: number;
|
|
97
|
+
maxInstances?: number;
|
|
98
|
+
scaleCpuThreshold?: number;
|
|
99
|
+
scaleMemoryThreshold?: number;
|
|
100
|
+
scaleRequestsPerSecThreshold?: number | null;
|
|
101
|
+
dockerImage?: string | null;
|
|
102
|
+
registryUsername?: string | null;
|
|
103
|
+
registryPassword?: string | null;
|
|
62
104
|
}
|
|
63
105
|
interface Deploy {
|
|
64
106
|
id: number;
|
|
@@ -74,22 +116,30 @@ interface Deploy {
|
|
|
74
116
|
interface TriggerDeployInput {
|
|
75
117
|
clearCache?: boolean;
|
|
76
118
|
}
|
|
119
|
+
/** Managed database engines supported by HostStack. */
|
|
120
|
+
type DatabaseEngine = 'postgres' | 'redis' | 'mysql' | 'mariadb' | 'mongodb';
|
|
77
121
|
interface Database {
|
|
78
122
|
id: number;
|
|
79
123
|
publicId: string;
|
|
80
124
|
name: string;
|
|
81
|
-
type
|
|
125
|
+
/** The engine name. The legacy `type` alias still ships in API responses
|
|
126
|
+
* but is deprecated — read `engine` going forward. */
|
|
127
|
+
engine: DatabaseEngine;
|
|
82
128
|
status: string;
|
|
83
129
|
version?: string | null;
|
|
130
|
+
plan?: string | null;
|
|
131
|
+
region?: string | null;
|
|
84
132
|
projectId: number;
|
|
85
133
|
createdAt: string;
|
|
86
134
|
updatedAt: string;
|
|
87
135
|
}
|
|
88
136
|
interface CreateDatabaseInput {
|
|
89
137
|
name: string;
|
|
90
|
-
|
|
138
|
+
engine: DatabaseEngine;
|
|
91
139
|
projectId: number;
|
|
92
140
|
version?: string;
|
|
141
|
+
plan?: 'free' | 'starter' | 'standard' | 'pro';
|
|
142
|
+
region?: string;
|
|
93
143
|
}
|
|
94
144
|
interface UpdateDatabaseInput {
|
|
95
145
|
name?: string;
|
|
@@ -102,6 +152,36 @@ interface DatabaseCredentials {
|
|
|
102
152
|
database: string;
|
|
103
153
|
connectionUrl: string;
|
|
104
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* A persistent disk attached to a service. Survives redeploys and
|
|
157
|
+
* container restarts. One service can have multiple volumes; each one is
|
|
158
|
+
* identified by a short `name` and a `mountPath` inside the container.
|
|
159
|
+
*/
|
|
160
|
+
interface Volume {
|
|
161
|
+
id: number;
|
|
162
|
+
publicId: string;
|
|
163
|
+
name: string;
|
|
164
|
+
mountPath: string;
|
|
165
|
+
sizeGb: number;
|
|
166
|
+
status: 'pending' | 'active' | 'deleting';
|
|
167
|
+
serviceId: number;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
updatedAt: string;
|
|
170
|
+
}
|
|
171
|
+
interface CreateVolumeInput {
|
|
172
|
+
/** Lowercase alphanumeric and hyphens, ≤64 chars. Used as the docker
|
|
173
|
+
* volume identifier — change with care once data is written. */
|
|
174
|
+
name: string;
|
|
175
|
+
/** In-container absolute path where the volume mounts. */
|
|
176
|
+
mountPath: string;
|
|
177
|
+
/** Disk size in GB. 1–100, default 1. Counts against your plan's
|
|
178
|
+
* storage quota and is metered for billing. */
|
|
179
|
+
sizeGb?: number;
|
|
180
|
+
}
|
|
181
|
+
interface UpdateVolumeInput {
|
|
182
|
+
mountPath?: string;
|
|
183
|
+
sizeGb?: number;
|
|
184
|
+
}
|
|
105
185
|
interface Domain {
|
|
106
186
|
id: number;
|
|
107
187
|
publicId: string;
|
|
@@ -156,8 +236,14 @@ interface Team {
|
|
|
156
236
|
role: string;
|
|
157
237
|
}
|
|
158
238
|
interface MeResponse {
|
|
159
|
-
user
|
|
160
|
-
|
|
239
|
+
/** Null when authenticated with an API key (no associated user). */
|
|
240
|
+
user: User | null;
|
|
241
|
+
team?: Team | null;
|
|
242
|
+
apiKey?: {
|
|
243
|
+
id: number;
|
|
244
|
+
permission: string;
|
|
245
|
+
};
|
|
246
|
+
stripeMode?: string;
|
|
161
247
|
}
|
|
162
248
|
interface ServiceMetrics {
|
|
163
249
|
cpu: number;
|
|
@@ -238,13 +324,24 @@ declare class DatabasesResource {
|
|
|
238
324
|
resetPassword(teamId: IdInput, databaseId: IdInput): Promise<void>;
|
|
239
325
|
}
|
|
240
326
|
|
|
327
|
+
interface DeployListResponse {
|
|
328
|
+
data: Deploy[];
|
|
329
|
+
page: number;
|
|
330
|
+
perPage: number;
|
|
331
|
+
total: number;
|
|
332
|
+
totalPages: number;
|
|
333
|
+
}
|
|
241
334
|
declare class DeploysResource {
|
|
242
335
|
private client;
|
|
243
336
|
constructor(client: HostStack);
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
337
|
+
/**
|
|
338
|
+
* List deploys for a service. Paginated — pass `page` / `perPage` to walk
|
|
339
|
+
* pages. Default page=1, perPage=25, hard cap perPage=100.
|
|
340
|
+
*/
|
|
341
|
+
list(teamId: IdInput, serviceId: IdInput, options?: {
|
|
342
|
+
page?: number;
|
|
343
|
+
perPage?: number;
|
|
344
|
+
}): Promise<DeployListResponse>;
|
|
248
345
|
/** Get a single deploy by ID. */
|
|
249
346
|
get(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<{
|
|
250
347
|
deploy: Deploy;
|
|
@@ -257,11 +354,31 @@ declare class DeploysResource {
|
|
|
257
354
|
cancel(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
258
355
|
/** Rollback to a previous deploy. */
|
|
259
356
|
rollback(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
357
|
+
/**
|
|
358
|
+
* Get build logs for a deploy.
|
|
359
|
+
*
|
|
360
|
+
* Pagination: pass `afterId` from the previous response's `nextAfterId`
|
|
361
|
+
* to fetch the next page. Per-call cap is 5000; default 500.
|
|
362
|
+
*/
|
|
363
|
+
getLogs(teamId: IdInput, serviceId: IdInput, deployId: IdInput, options?: {
|
|
364
|
+
search?: string;
|
|
365
|
+
level?: string;
|
|
366
|
+
phase?: string;
|
|
367
|
+
limit?: number;
|
|
368
|
+
afterId?: number;
|
|
369
|
+
}): Promise<{
|
|
370
|
+
logs: DeployLogEntry[];
|
|
371
|
+
nextAfterId: number | null;
|
|
263
372
|
}>;
|
|
264
373
|
}
|
|
374
|
+
interface DeployLogEntry {
|
|
375
|
+
id: number;
|
|
376
|
+
deployId: number;
|
|
377
|
+
timestamp: string;
|
|
378
|
+
level: 'info' | 'warn' | 'error' | 'debug';
|
|
379
|
+
phase: string | null;
|
|
380
|
+
message: string;
|
|
381
|
+
}
|
|
265
382
|
|
|
266
383
|
declare class DomainsResource {
|
|
267
384
|
private client;
|
|
@@ -411,6 +528,53 @@ declare class ServicesResource {
|
|
|
411
528
|
streamLogs(teamId: IdInput, serviceId: IdInput, options?: StreamLogsOptions): AsyncGenerator<LogEntry>;
|
|
412
529
|
}
|
|
413
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Manage persistent disks attached to a service.
|
|
533
|
+
*
|
|
534
|
+
* Volumes mount a writable disk into a service's container at the path you
|
|
535
|
+
* choose, surviving redeploys and container restarts. One service can have
|
|
536
|
+
* multiple volumes; each one is identified by a short `name` and a
|
|
537
|
+
* `mountPath`.
|
|
538
|
+
*
|
|
539
|
+
* Renderers porting from render.yaml: a volume here is the same concept as
|
|
540
|
+
* Render's `disk:` block. Use {@link create} to attach one programmatically,
|
|
541
|
+
* or declare it in `hoststack.yaml` for IaC workflows.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* await client.volumes.create(team, service, {
|
|
546
|
+
* name: 'data',
|
|
547
|
+
* mountPath: '/var/data',
|
|
548
|
+
* sizeGb: 10,
|
|
549
|
+
* });
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
declare class VolumesResource {
|
|
553
|
+
private client;
|
|
554
|
+
constructor(client: HostStack);
|
|
555
|
+
/** List volumes attached to a service. */
|
|
556
|
+
list(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
557
|
+
volumes: Volume[];
|
|
558
|
+
}>;
|
|
559
|
+
/** Attach a new volume to a service. Triggers provisioning on the host. */
|
|
560
|
+
create(teamId: IdInput, serviceId: IdInput, data: CreateVolumeInput): Promise<{
|
|
561
|
+
volume: Volume;
|
|
562
|
+
}>;
|
|
563
|
+
/**
|
|
564
|
+
* Update a volume's mountPath or sizeGb. Resizes that take effect on the
|
|
565
|
+
* next deploy; mountPath changes require a redeploy to remount.
|
|
566
|
+
*/
|
|
567
|
+
update(teamId: IdInput, serviceId: IdInput, volumeId: IdInput, data: UpdateVolumeInput): Promise<{
|
|
568
|
+
volume: Volume;
|
|
569
|
+
}>;
|
|
570
|
+
/**
|
|
571
|
+
* Detach and deprovision a volume. The underlying disk is destroyed —
|
|
572
|
+
* back up any data first. Async: the row is marked `deleting` and the
|
|
573
|
+
* agent finalises the removal once it acks.
|
|
574
|
+
*/
|
|
575
|
+
delete(teamId: IdInput, serviceId: IdInput, volumeId: IdInput): Promise<void>;
|
|
576
|
+
}
|
|
577
|
+
|
|
414
578
|
/** A numeric id or a publicId string (e.g. 42, "42", "svc_abc…"). */
|
|
415
579
|
type IdInput = number | string;
|
|
416
580
|
interface HostStackOptions {
|
|
@@ -437,6 +601,10 @@ type ResolveScope = {
|
|
|
437
601
|
} | {
|
|
438
602
|
kind: 'domain';
|
|
439
603
|
teamId: number;
|
|
604
|
+
} | {
|
|
605
|
+
kind: 'volume';
|
|
606
|
+
teamId: number;
|
|
607
|
+
serviceId: number;
|
|
440
608
|
} | {
|
|
441
609
|
kind: 'envVar';
|
|
442
610
|
teamId: number;
|
|
@@ -464,6 +632,8 @@ declare class HostStack {
|
|
|
464
632
|
readonly envVars: EnvVarsResource;
|
|
465
633
|
/** Manage cron job executions. */
|
|
466
634
|
readonly cron: CronResource;
|
|
635
|
+
/** Manage persistent disks attached to services. */
|
|
636
|
+
readonly volumes: VolumesResource;
|
|
467
637
|
constructor(options: HostStackOptions);
|
|
468
638
|
/**
|
|
469
639
|
* Make an authenticated request to the HostStack API.
|