@hoststack.dev/sdk 0.8.1 → 0.9.1
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 +36 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -38
- package/dist/index.d.ts +101 -38
- package/dist/index.js +37 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,35 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region identifiers accepted by every endpoint that takes a `region`
|
|
3
|
+
* input. Mirrors `packages/shared/src/constants/regions.ts:30` — keep
|
|
4
|
+
* the two in sync when adding a region.
|
|
5
|
+
*/
|
|
6
|
+
type RegionId = 'eu-central-1' | 'eu-central-2' | 'eu-west-1' | 'us-east-1';
|
|
1
7
|
interface Project {
|
|
2
8
|
id: number;
|
|
3
9
|
publicId: string;
|
|
4
10
|
name: string;
|
|
5
11
|
slug: string;
|
|
6
12
|
description?: string | null;
|
|
7
|
-
region:
|
|
13
|
+
region: RegionId;
|
|
8
14
|
createdAt: string;
|
|
9
15
|
updatedAt: string;
|
|
10
16
|
}
|
|
11
17
|
interface CreateProjectInput {
|
|
12
18
|
name: string;
|
|
13
19
|
description?: string;
|
|
14
|
-
region?:
|
|
20
|
+
region?: RegionId;
|
|
15
21
|
}
|
|
16
22
|
interface UpdateProjectInput {
|
|
17
23
|
name?: string;
|
|
18
24
|
description?: string;
|
|
19
25
|
}
|
|
26
|
+
type ServiceType = 'web_service' | 'private_service' | 'worker' | 'cron_job' | 'static_site';
|
|
27
|
+
/**
|
|
28
|
+
* v89: `sleeping` is the free-tier idle state — container is `docker pause`d
|
|
29
|
+
* but warm-resumes <100ms on the next request. Distinct from `suspended`
|
|
30
|
+
* (admin/user action; container fully stopped, requires a deploy to revive).
|
|
31
|
+
*/
|
|
32
|
+
type ServiceStatus = 'active' | 'deploying' | 'suspended' | 'failed' | 'not_deployed' | 'sleeping';
|
|
33
|
+
type ServicePlan = 'pico' | 'nano' | 'micro' | 'starter' | 'standard' | 'pro_standard' | 'pro_large';
|
|
20
34
|
interface Service {
|
|
21
35
|
id: number;
|
|
22
36
|
publicId: string;
|
|
23
37
|
name: string;
|
|
24
|
-
type:
|
|
25
|
-
status:
|
|
38
|
+
type: ServiceType;
|
|
39
|
+
status: ServiceStatus;
|
|
26
40
|
internalUrl?: string | null;
|
|
27
41
|
projectId: number;
|
|
28
42
|
createdAt: string;
|
|
29
43
|
updatedAt: string;
|
|
30
44
|
}
|
|
31
|
-
type ServiceType = 'web_service' | 'private_service' | 'worker' | 'cron_job' | 'static_site';
|
|
32
|
-
type ServicePlan = 'pico' | 'nano' | 'micro' | 'starter' | 'standard' | 'pro_standard' | 'pro_large';
|
|
33
45
|
interface CreateServiceInput {
|
|
34
46
|
name: string;
|
|
35
47
|
type: ServiceType;
|
|
@@ -147,11 +159,17 @@ interface UpdateServiceConfigInput {
|
|
|
147
159
|
action: 'drop' | 'downgrade';
|
|
148
160
|
}> | null;
|
|
149
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* `superseded` (v63 P4) means a newer push for the same (service, branch) arrived
|
|
164
|
+
* before this deploy could finish. Distinct from `cancelled` (operator-initiated).
|
|
165
|
+
*/
|
|
166
|
+
type DeployStatus = 'pending' | 'building' | 'build_failed' | 'deploying' | 'live' | 'failed' | 'cancelled' | 'deactivated' | 'superseded';
|
|
167
|
+
type DeployTrigger = 'github_push' | 'gitlab_push' | 'bitbucket_push' | 'manual' | 'rollback' | 'api' | 'config_change';
|
|
150
168
|
interface Deploy {
|
|
151
169
|
id: number;
|
|
152
170
|
publicId: string;
|
|
153
|
-
status:
|
|
154
|
-
trigger:
|
|
171
|
+
status: DeployStatus;
|
|
172
|
+
trigger: DeployTrigger;
|
|
155
173
|
commitHash?: string | null;
|
|
156
174
|
commitMessage?: string | null;
|
|
157
175
|
createdAt: string;
|
|
@@ -196,6 +214,13 @@ interface TriggerDeployInput {
|
|
|
196
214
|
}
|
|
197
215
|
/** Managed database engines supported by HostStack. */
|
|
198
216
|
type DatabaseEngine = 'postgres' | 'redis' | 'mysql' | 'mariadb' | 'mongodb';
|
|
217
|
+
/**
|
|
218
|
+
* `migrating` (v89 Phase 4) is the transient state while the agent runs the
|
|
219
|
+
* single-node → HA migration (pg_dump → bootstrap → pg_restore). Reads stay
|
|
220
|
+
* read-only during this window.
|
|
221
|
+
*/
|
|
222
|
+
type DatabaseStatus = 'creating' | 'available' | 'suspended' | 'deleting' | 'error' | 'migrating';
|
|
223
|
+
type DatabasePlan = 'free' | 'micro' | 'starter' | 'standard' | 'pro';
|
|
199
224
|
interface Database {
|
|
200
225
|
id: number;
|
|
201
226
|
publicId: string;
|
|
@@ -203,10 +228,10 @@ interface Database {
|
|
|
203
228
|
/** The engine name. The legacy `type` alias still ships in API responses
|
|
204
229
|
* but is deprecated — read `engine` going forward. */
|
|
205
230
|
engine: DatabaseEngine;
|
|
206
|
-
status:
|
|
231
|
+
status: DatabaseStatus;
|
|
207
232
|
version?: string | null;
|
|
208
|
-
plan?:
|
|
209
|
-
region?:
|
|
233
|
+
plan?: DatabasePlan | null;
|
|
234
|
+
region?: RegionId | null;
|
|
210
235
|
projectId: number;
|
|
211
236
|
diskSizeGb?: number;
|
|
212
237
|
memoryMb?: number;
|
|
@@ -227,12 +252,12 @@ interface CreateDatabaseInput {
|
|
|
227
252
|
*/
|
|
228
253
|
environmentId?: number;
|
|
229
254
|
version?: string;
|
|
230
|
-
plan?:
|
|
231
|
-
region?:
|
|
255
|
+
plan?: DatabasePlan;
|
|
256
|
+
region?: RegionId;
|
|
232
257
|
}
|
|
233
258
|
interface UpdateDatabaseInput {
|
|
234
259
|
name?: string;
|
|
235
|
-
plan?:
|
|
260
|
+
plan?: DatabasePlan;
|
|
236
261
|
/** Grow the database disk in GB. Cannot shrink. */
|
|
237
262
|
diskSizeGb?: number;
|
|
238
263
|
}
|
|
@@ -275,19 +300,20 @@ interface UpdateVolumeInput {
|
|
|
275
300
|
mountPath?: string;
|
|
276
301
|
sizeGb?: number;
|
|
277
302
|
}
|
|
303
|
+
type DomainStatus = 'pending' | 'active' | 'failed' | 'deleting';
|
|
278
304
|
interface Domain {
|
|
279
305
|
id: number;
|
|
280
306
|
publicId: string;
|
|
281
307
|
domain: string;
|
|
282
|
-
status:
|
|
308
|
+
status: DomainStatus;
|
|
283
309
|
verified: boolean;
|
|
284
310
|
serviceId?: number | null;
|
|
285
311
|
createdAt: string;
|
|
286
312
|
}
|
|
287
313
|
interface AddDomainInput {
|
|
288
314
|
domain: string;
|
|
289
|
-
/**
|
|
290
|
-
serviceId: number;
|
|
315
|
+
/** Service to bind the domain to (required). Accepts either a numeric id or a publicId (`svc_…`); the SDK resolves publicIds before sending. */
|
|
316
|
+
serviceId: number | string;
|
|
291
317
|
/** Path-prefix routing — point one hostname at multiple services (e.g. `/api` → api svc, `/` → web svc). */
|
|
292
318
|
pathPrefix?: string | null;
|
|
293
319
|
}
|
|
@@ -330,12 +356,13 @@ interface User {
|
|
|
330
356
|
email: string;
|
|
331
357
|
avatarUrl?: string | null;
|
|
332
358
|
}
|
|
359
|
+
type TeamRole = 'owner' | 'admin' | 'member';
|
|
333
360
|
interface Team {
|
|
334
361
|
id: number;
|
|
335
362
|
publicId: string;
|
|
336
363
|
name: string;
|
|
337
364
|
slug: string;
|
|
338
|
-
role:
|
|
365
|
+
role: TeamRole;
|
|
339
366
|
}
|
|
340
367
|
interface MeResponse {
|
|
341
368
|
/** Null when authenticated with an API key (no associated user). */
|
|
@@ -345,7 +372,12 @@ interface MeResponse {
|
|
|
345
372
|
id: number;
|
|
346
373
|
permission: string;
|
|
347
374
|
};
|
|
375
|
+
/** `'test'` when the API is wired to Stripe's test mode, `'live'` otherwise. */
|
|
348
376
|
stripeMode?: string;
|
|
377
|
+
/** True when the caller is a superadmin acting on behalf of another team. Always false for API-key auth. */
|
|
378
|
+
isImpersonating?: boolean;
|
|
379
|
+
/** v88 P1b: server-side flag the dashboard renders as a "please add a card" prompt for free-tier teams 14+ days in. */
|
|
380
|
+
cardPromptVisible?: boolean;
|
|
349
381
|
}
|
|
350
382
|
/**
|
|
351
383
|
* A single point in a service metrics time series. Same shape used for
|
|
@@ -376,14 +408,16 @@ interface ServiceMetricsSnapshot {
|
|
|
376
408
|
containerCount: number;
|
|
377
409
|
} | null;
|
|
378
410
|
}
|
|
411
|
+
type CronExecutionStatus = 'pending' | 'running' | 'succeeded' | 'failed';
|
|
412
|
+
type CronExecutionTrigger = 'scheduled' | 'manual';
|
|
379
413
|
interface CronExecution {
|
|
380
414
|
id: number;
|
|
381
415
|
publicId: string;
|
|
382
|
-
status:
|
|
416
|
+
status: CronExecutionStatus;
|
|
383
417
|
startedAt?: string | null;
|
|
384
418
|
finishedAt?: string | null;
|
|
385
419
|
exitCode?: number | null;
|
|
386
|
-
triggeredBy?:
|
|
420
|
+
triggeredBy?: CronExecutionTrigger | null;
|
|
387
421
|
createdAt: string;
|
|
388
422
|
}
|
|
389
423
|
interface ActivityLogEntry {
|
|
@@ -827,8 +861,8 @@ declare class ServicesResource {
|
|
|
827
861
|
list(teamId: IdInput, filters?: {
|
|
828
862
|
projectId?: number | string;
|
|
829
863
|
environmentId?: number | string;
|
|
830
|
-
status?:
|
|
831
|
-
type?:
|
|
864
|
+
status?: ServiceStatus;
|
|
865
|
+
type?: ServiceType;
|
|
832
866
|
}): Promise<{
|
|
833
867
|
services: Service[];
|
|
834
868
|
}>;
|
|
@@ -904,7 +938,7 @@ declare class ServicesResource {
|
|
|
904
938
|
since?: string;
|
|
905
939
|
until?: string;
|
|
906
940
|
stream?: 'stdout' | 'stderr';
|
|
907
|
-
level?: 'stdout' | 'stderr' | 'debug' | 'info' | 'warn' | 'error';
|
|
941
|
+
level?: 'stdout' | 'stderr' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
908
942
|
search?: string;
|
|
909
943
|
grep?: string;
|
|
910
944
|
countOnly?: boolean;
|
|
@@ -928,6 +962,20 @@ declare class ServicesResource {
|
|
|
928
962
|
streamLogs(teamId: IdInput, serviceId: IdInput, options?: StreamLogsOptions): AsyncGenerator<LogEntry>;
|
|
929
963
|
}
|
|
930
964
|
|
|
965
|
+
declare class TeamsResource {
|
|
966
|
+
private client;
|
|
967
|
+
constructor(client: HostStack);
|
|
968
|
+
/**
|
|
969
|
+
* List the teams the authenticated principal can access.
|
|
970
|
+
*
|
|
971
|
+
* Session auth: all teams the user belongs to.
|
|
972
|
+
* API-key auth: the single team the key is bound to.
|
|
973
|
+
*/
|
|
974
|
+
list(): Promise<{
|
|
975
|
+
teams: Team[];
|
|
976
|
+
}>;
|
|
977
|
+
}
|
|
978
|
+
|
|
931
979
|
/**
|
|
932
980
|
* Manage persistent disks attached to a service.
|
|
933
981
|
*
|
|
@@ -1041,7 +1089,15 @@ declare class HostStack {
|
|
|
1041
1089
|
* failures, restart loops, ACME failures, git auth losses, etc.
|
|
1042
1090
|
*/
|
|
1043
1091
|
readonly notifications: NotificationsResource;
|
|
1092
|
+
/** List the teams this API key (or session) can access. */
|
|
1093
|
+
readonly teams: TeamsResource;
|
|
1044
1094
|
constructor(options: HostStackOptions);
|
|
1095
|
+
/**
|
|
1096
|
+
* Identify the authenticated principal. For API-key auth, `user` is
|
|
1097
|
+
* `null` and `team` is the team the key is bound to; `apiKey` carries
|
|
1098
|
+
* the key's permission scope (read or full).
|
|
1099
|
+
*/
|
|
1100
|
+
me(): Promise<MeResponse>;
|
|
1045
1101
|
/**
|
|
1046
1102
|
* Make an authenticated request to the HostStack API.
|
|
1047
1103
|
* Used internally by resource classes. Can also be used for custom API calls.
|
|
@@ -1089,32 +1145,39 @@ declare class RateLimitError extends HostStackError {
|
|
|
1089
1145
|
|
|
1090
1146
|
/**
|
|
1091
1147
|
* Standard pagination parameters for list requests.
|
|
1148
|
+
*
|
|
1149
|
+
* Mirrors `packages/shared/src/schemas/pagination.ts` — the API uses
|
|
1150
|
+
* `page` (1-based) + `perPage` (≤100) everywhere. Use these names
|
|
1151
|
+
* directly in your code; the SDK serializes them as the matching
|
|
1152
|
+
* query-string params.
|
|
1092
1153
|
*/
|
|
1093
1154
|
interface PaginationParams {
|
|
1094
|
-
/**
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
|
|
1155
|
+
/** 1-based page number. Default `1`. */
|
|
1156
|
+
page?: number;
|
|
1157
|
+
/** Items per page. Range 1–100, default `20`. */
|
|
1158
|
+
perPage?: number;
|
|
1159
|
+
/** Free-text search applied server-side. ≤200 chars. */
|
|
1160
|
+
search?: string;
|
|
1161
|
+
/** Column to sort by (route-dependent). */
|
|
1162
|
+
sortBy?: string;
|
|
1163
|
+
/** Sort direction. Default `'desc'`. */
|
|
1164
|
+
sortOrder?: 'asc' | 'desc';
|
|
1098
1165
|
}
|
|
1099
1166
|
/**
|
|
1100
|
-
* A paginated response wrapper.
|
|
1167
|
+
* A paginated response wrapper. Mirrors the shape every paginated API
|
|
1168
|
+
* endpoint returns under `data` + `total` + `page` + `perPage` + `totalPages`.
|
|
1101
1169
|
*/
|
|
1102
1170
|
interface PaginatedResponse<T> {
|
|
1103
|
-
|
|
1171
|
+
data: T[];
|
|
1104
1172
|
total: number;
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1173
|
+
page: number;
|
|
1174
|
+
perPage: number;
|
|
1175
|
+
totalPages: number;
|
|
1108
1176
|
}
|
|
1109
1177
|
/**
|
|
1110
1178
|
* Builds a query string from pagination params.
|
|
1111
1179
|
* Returns an empty string if no params are set.
|
|
1112
1180
|
*/
|
|
1113
1181
|
declare function buildPaginationQuery(params?: PaginationParams): string;
|
|
1114
|
-
/**
|
|
1115
|
-
* Wraps a plain array result into a PaginatedResponse.
|
|
1116
|
-
* Useful when the API returns a flat array without pagination metadata.
|
|
1117
|
-
*/
|
|
1118
|
-
declare function wrapArray<T>(items: T[], params?: PaginationParams): PaginatedResponse<T>;
|
|
1119
1182
|
|
|
1120
|
-
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type Database, type DatabaseCredentials, type Deploy, type DeployListResponse, type DeployLogEntry, type Domain, type EnvVar, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceType, type StreamLogsOptions, type Team, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery
|
|
1183
|
+
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type CronExecutionStatus, type CronExecutionTrigger, type Database, type DatabaseCredentials, type DatabaseEngine, type DatabasePlan, type DatabaseStatus, type Deploy, type DeployListResponse, type DeployLogEntry, type DeployStatus, type DeployTrigger, type Domain, type DomainStatus, type EnvVar, type EnvVarTarget, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type RegionId, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceStatus, type ServiceType, type StreamLogsOptions, type Team, type TeamRole, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region identifiers accepted by every endpoint that takes a `region`
|
|
3
|
+
* input. Mirrors `packages/shared/src/constants/regions.ts:30` — keep
|
|
4
|
+
* the two in sync when adding a region.
|
|
5
|
+
*/
|
|
6
|
+
type RegionId = 'eu-central-1' | 'eu-central-2' | 'eu-west-1' | 'us-east-1';
|
|
1
7
|
interface Project {
|
|
2
8
|
id: number;
|
|
3
9
|
publicId: string;
|
|
4
10
|
name: string;
|
|
5
11
|
slug: string;
|
|
6
12
|
description?: string | null;
|
|
7
|
-
region:
|
|
13
|
+
region: RegionId;
|
|
8
14
|
createdAt: string;
|
|
9
15
|
updatedAt: string;
|
|
10
16
|
}
|
|
11
17
|
interface CreateProjectInput {
|
|
12
18
|
name: string;
|
|
13
19
|
description?: string;
|
|
14
|
-
region?:
|
|
20
|
+
region?: RegionId;
|
|
15
21
|
}
|
|
16
22
|
interface UpdateProjectInput {
|
|
17
23
|
name?: string;
|
|
18
24
|
description?: string;
|
|
19
25
|
}
|
|
26
|
+
type ServiceType = 'web_service' | 'private_service' | 'worker' | 'cron_job' | 'static_site';
|
|
27
|
+
/**
|
|
28
|
+
* v89: `sleeping` is the free-tier idle state — container is `docker pause`d
|
|
29
|
+
* but warm-resumes <100ms on the next request. Distinct from `suspended`
|
|
30
|
+
* (admin/user action; container fully stopped, requires a deploy to revive).
|
|
31
|
+
*/
|
|
32
|
+
type ServiceStatus = 'active' | 'deploying' | 'suspended' | 'failed' | 'not_deployed' | 'sleeping';
|
|
33
|
+
type ServicePlan = 'pico' | 'nano' | 'micro' | 'starter' | 'standard' | 'pro_standard' | 'pro_large';
|
|
20
34
|
interface Service {
|
|
21
35
|
id: number;
|
|
22
36
|
publicId: string;
|
|
23
37
|
name: string;
|
|
24
|
-
type:
|
|
25
|
-
status:
|
|
38
|
+
type: ServiceType;
|
|
39
|
+
status: ServiceStatus;
|
|
26
40
|
internalUrl?: string | null;
|
|
27
41
|
projectId: number;
|
|
28
42
|
createdAt: string;
|
|
29
43
|
updatedAt: string;
|
|
30
44
|
}
|
|
31
|
-
type ServiceType = 'web_service' | 'private_service' | 'worker' | 'cron_job' | 'static_site';
|
|
32
|
-
type ServicePlan = 'pico' | 'nano' | 'micro' | 'starter' | 'standard' | 'pro_standard' | 'pro_large';
|
|
33
45
|
interface CreateServiceInput {
|
|
34
46
|
name: string;
|
|
35
47
|
type: ServiceType;
|
|
@@ -147,11 +159,17 @@ interface UpdateServiceConfigInput {
|
|
|
147
159
|
action: 'drop' | 'downgrade';
|
|
148
160
|
}> | null;
|
|
149
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* `superseded` (v63 P4) means a newer push for the same (service, branch) arrived
|
|
164
|
+
* before this deploy could finish. Distinct from `cancelled` (operator-initiated).
|
|
165
|
+
*/
|
|
166
|
+
type DeployStatus = 'pending' | 'building' | 'build_failed' | 'deploying' | 'live' | 'failed' | 'cancelled' | 'deactivated' | 'superseded';
|
|
167
|
+
type DeployTrigger = 'github_push' | 'gitlab_push' | 'bitbucket_push' | 'manual' | 'rollback' | 'api' | 'config_change';
|
|
150
168
|
interface Deploy {
|
|
151
169
|
id: number;
|
|
152
170
|
publicId: string;
|
|
153
|
-
status:
|
|
154
|
-
trigger:
|
|
171
|
+
status: DeployStatus;
|
|
172
|
+
trigger: DeployTrigger;
|
|
155
173
|
commitHash?: string | null;
|
|
156
174
|
commitMessage?: string | null;
|
|
157
175
|
createdAt: string;
|
|
@@ -196,6 +214,13 @@ interface TriggerDeployInput {
|
|
|
196
214
|
}
|
|
197
215
|
/** Managed database engines supported by HostStack. */
|
|
198
216
|
type DatabaseEngine = 'postgres' | 'redis' | 'mysql' | 'mariadb' | 'mongodb';
|
|
217
|
+
/**
|
|
218
|
+
* `migrating` (v89 Phase 4) is the transient state while the agent runs the
|
|
219
|
+
* single-node → HA migration (pg_dump → bootstrap → pg_restore). Reads stay
|
|
220
|
+
* read-only during this window.
|
|
221
|
+
*/
|
|
222
|
+
type DatabaseStatus = 'creating' | 'available' | 'suspended' | 'deleting' | 'error' | 'migrating';
|
|
223
|
+
type DatabasePlan = 'free' | 'micro' | 'starter' | 'standard' | 'pro';
|
|
199
224
|
interface Database {
|
|
200
225
|
id: number;
|
|
201
226
|
publicId: string;
|
|
@@ -203,10 +228,10 @@ interface Database {
|
|
|
203
228
|
/** The engine name. The legacy `type` alias still ships in API responses
|
|
204
229
|
* but is deprecated — read `engine` going forward. */
|
|
205
230
|
engine: DatabaseEngine;
|
|
206
|
-
status:
|
|
231
|
+
status: DatabaseStatus;
|
|
207
232
|
version?: string | null;
|
|
208
|
-
plan?:
|
|
209
|
-
region?:
|
|
233
|
+
plan?: DatabasePlan | null;
|
|
234
|
+
region?: RegionId | null;
|
|
210
235
|
projectId: number;
|
|
211
236
|
diskSizeGb?: number;
|
|
212
237
|
memoryMb?: number;
|
|
@@ -227,12 +252,12 @@ interface CreateDatabaseInput {
|
|
|
227
252
|
*/
|
|
228
253
|
environmentId?: number;
|
|
229
254
|
version?: string;
|
|
230
|
-
plan?:
|
|
231
|
-
region?:
|
|
255
|
+
plan?: DatabasePlan;
|
|
256
|
+
region?: RegionId;
|
|
232
257
|
}
|
|
233
258
|
interface UpdateDatabaseInput {
|
|
234
259
|
name?: string;
|
|
235
|
-
plan?:
|
|
260
|
+
plan?: DatabasePlan;
|
|
236
261
|
/** Grow the database disk in GB. Cannot shrink. */
|
|
237
262
|
diskSizeGb?: number;
|
|
238
263
|
}
|
|
@@ -275,19 +300,20 @@ interface UpdateVolumeInput {
|
|
|
275
300
|
mountPath?: string;
|
|
276
301
|
sizeGb?: number;
|
|
277
302
|
}
|
|
303
|
+
type DomainStatus = 'pending' | 'active' | 'failed' | 'deleting';
|
|
278
304
|
interface Domain {
|
|
279
305
|
id: number;
|
|
280
306
|
publicId: string;
|
|
281
307
|
domain: string;
|
|
282
|
-
status:
|
|
308
|
+
status: DomainStatus;
|
|
283
309
|
verified: boolean;
|
|
284
310
|
serviceId?: number | null;
|
|
285
311
|
createdAt: string;
|
|
286
312
|
}
|
|
287
313
|
interface AddDomainInput {
|
|
288
314
|
domain: string;
|
|
289
|
-
/**
|
|
290
|
-
serviceId: number;
|
|
315
|
+
/** Service to bind the domain to (required). Accepts either a numeric id or a publicId (`svc_…`); the SDK resolves publicIds before sending. */
|
|
316
|
+
serviceId: number | string;
|
|
291
317
|
/** Path-prefix routing — point one hostname at multiple services (e.g. `/api` → api svc, `/` → web svc). */
|
|
292
318
|
pathPrefix?: string | null;
|
|
293
319
|
}
|
|
@@ -330,12 +356,13 @@ interface User {
|
|
|
330
356
|
email: string;
|
|
331
357
|
avatarUrl?: string | null;
|
|
332
358
|
}
|
|
359
|
+
type TeamRole = 'owner' | 'admin' | 'member';
|
|
333
360
|
interface Team {
|
|
334
361
|
id: number;
|
|
335
362
|
publicId: string;
|
|
336
363
|
name: string;
|
|
337
364
|
slug: string;
|
|
338
|
-
role:
|
|
365
|
+
role: TeamRole;
|
|
339
366
|
}
|
|
340
367
|
interface MeResponse {
|
|
341
368
|
/** Null when authenticated with an API key (no associated user). */
|
|
@@ -345,7 +372,12 @@ interface MeResponse {
|
|
|
345
372
|
id: number;
|
|
346
373
|
permission: string;
|
|
347
374
|
};
|
|
375
|
+
/** `'test'` when the API is wired to Stripe's test mode, `'live'` otherwise. */
|
|
348
376
|
stripeMode?: string;
|
|
377
|
+
/** True when the caller is a superadmin acting on behalf of another team. Always false for API-key auth. */
|
|
378
|
+
isImpersonating?: boolean;
|
|
379
|
+
/** v88 P1b: server-side flag the dashboard renders as a "please add a card" prompt for free-tier teams 14+ days in. */
|
|
380
|
+
cardPromptVisible?: boolean;
|
|
349
381
|
}
|
|
350
382
|
/**
|
|
351
383
|
* A single point in a service metrics time series. Same shape used for
|
|
@@ -376,14 +408,16 @@ interface ServiceMetricsSnapshot {
|
|
|
376
408
|
containerCount: number;
|
|
377
409
|
} | null;
|
|
378
410
|
}
|
|
411
|
+
type CronExecutionStatus = 'pending' | 'running' | 'succeeded' | 'failed';
|
|
412
|
+
type CronExecutionTrigger = 'scheduled' | 'manual';
|
|
379
413
|
interface CronExecution {
|
|
380
414
|
id: number;
|
|
381
415
|
publicId: string;
|
|
382
|
-
status:
|
|
416
|
+
status: CronExecutionStatus;
|
|
383
417
|
startedAt?: string | null;
|
|
384
418
|
finishedAt?: string | null;
|
|
385
419
|
exitCode?: number | null;
|
|
386
|
-
triggeredBy?:
|
|
420
|
+
triggeredBy?: CronExecutionTrigger | null;
|
|
387
421
|
createdAt: string;
|
|
388
422
|
}
|
|
389
423
|
interface ActivityLogEntry {
|
|
@@ -827,8 +861,8 @@ declare class ServicesResource {
|
|
|
827
861
|
list(teamId: IdInput, filters?: {
|
|
828
862
|
projectId?: number | string;
|
|
829
863
|
environmentId?: number | string;
|
|
830
|
-
status?:
|
|
831
|
-
type?:
|
|
864
|
+
status?: ServiceStatus;
|
|
865
|
+
type?: ServiceType;
|
|
832
866
|
}): Promise<{
|
|
833
867
|
services: Service[];
|
|
834
868
|
}>;
|
|
@@ -904,7 +938,7 @@ declare class ServicesResource {
|
|
|
904
938
|
since?: string;
|
|
905
939
|
until?: string;
|
|
906
940
|
stream?: 'stdout' | 'stderr';
|
|
907
|
-
level?: 'stdout' | 'stderr' | 'debug' | 'info' | 'warn' | 'error';
|
|
941
|
+
level?: 'stdout' | 'stderr' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
908
942
|
search?: string;
|
|
909
943
|
grep?: string;
|
|
910
944
|
countOnly?: boolean;
|
|
@@ -928,6 +962,20 @@ declare class ServicesResource {
|
|
|
928
962
|
streamLogs(teamId: IdInput, serviceId: IdInput, options?: StreamLogsOptions): AsyncGenerator<LogEntry>;
|
|
929
963
|
}
|
|
930
964
|
|
|
965
|
+
declare class TeamsResource {
|
|
966
|
+
private client;
|
|
967
|
+
constructor(client: HostStack);
|
|
968
|
+
/**
|
|
969
|
+
* List the teams the authenticated principal can access.
|
|
970
|
+
*
|
|
971
|
+
* Session auth: all teams the user belongs to.
|
|
972
|
+
* API-key auth: the single team the key is bound to.
|
|
973
|
+
*/
|
|
974
|
+
list(): Promise<{
|
|
975
|
+
teams: Team[];
|
|
976
|
+
}>;
|
|
977
|
+
}
|
|
978
|
+
|
|
931
979
|
/**
|
|
932
980
|
* Manage persistent disks attached to a service.
|
|
933
981
|
*
|
|
@@ -1041,7 +1089,15 @@ declare class HostStack {
|
|
|
1041
1089
|
* failures, restart loops, ACME failures, git auth losses, etc.
|
|
1042
1090
|
*/
|
|
1043
1091
|
readonly notifications: NotificationsResource;
|
|
1092
|
+
/** List the teams this API key (or session) can access. */
|
|
1093
|
+
readonly teams: TeamsResource;
|
|
1044
1094
|
constructor(options: HostStackOptions);
|
|
1095
|
+
/**
|
|
1096
|
+
* Identify the authenticated principal. For API-key auth, `user` is
|
|
1097
|
+
* `null` and `team` is the team the key is bound to; `apiKey` carries
|
|
1098
|
+
* the key's permission scope (read or full).
|
|
1099
|
+
*/
|
|
1100
|
+
me(): Promise<MeResponse>;
|
|
1045
1101
|
/**
|
|
1046
1102
|
* Make an authenticated request to the HostStack API.
|
|
1047
1103
|
* Used internally by resource classes. Can also be used for custom API calls.
|
|
@@ -1089,32 +1145,39 @@ declare class RateLimitError extends HostStackError {
|
|
|
1089
1145
|
|
|
1090
1146
|
/**
|
|
1091
1147
|
* Standard pagination parameters for list requests.
|
|
1148
|
+
*
|
|
1149
|
+
* Mirrors `packages/shared/src/schemas/pagination.ts` — the API uses
|
|
1150
|
+
* `page` (1-based) + `perPage` (≤100) everywhere. Use these names
|
|
1151
|
+
* directly in your code; the SDK serializes them as the matching
|
|
1152
|
+
* query-string params.
|
|
1092
1153
|
*/
|
|
1093
1154
|
interface PaginationParams {
|
|
1094
|
-
/**
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
|
|
1155
|
+
/** 1-based page number. Default `1`. */
|
|
1156
|
+
page?: number;
|
|
1157
|
+
/** Items per page. Range 1–100, default `20`. */
|
|
1158
|
+
perPage?: number;
|
|
1159
|
+
/** Free-text search applied server-side. ≤200 chars. */
|
|
1160
|
+
search?: string;
|
|
1161
|
+
/** Column to sort by (route-dependent). */
|
|
1162
|
+
sortBy?: string;
|
|
1163
|
+
/** Sort direction. Default `'desc'`. */
|
|
1164
|
+
sortOrder?: 'asc' | 'desc';
|
|
1098
1165
|
}
|
|
1099
1166
|
/**
|
|
1100
|
-
* A paginated response wrapper.
|
|
1167
|
+
* A paginated response wrapper. Mirrors the shape every paginated API
|
|
1168
|
+
* endpoint returns under `data` + `total` + `page` + `perPage` + `totalPages`.
|
|
1101
1169
|
*/
|
|
1102
1170
|
interface PaginatedResponse<T> {
|
|
1103
|
-
|
|
1171
|
+
data: T[];
|
|
1104
1172
|
total: number;
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1173
|
+
page: number;
|
|
1174
|
+
perPage: number;
|
|
1175
|
+
totalPages: number;
|
|
1108
1176
|
}
|
|
1109
1177
|
/**
|
|
1110
1178
|
* Builds a query string from pagination params.
|
|
1111
1179
|
* Returns an empty string if no params are set.
|
|
1112
1180
|
*/
|
|
1113
1181
|
declare function buildPaginationQuery(params?: PaginationParams): string;
|
|
1114
|
-
/**
|
|
1115
|
-
* Wraps a plain array result into a PaginatedResponse.
|
|
1116
|
-
* Useful when the API returns a flat array without pagination metadata.
|
|
1117
|
-
*/
|
|
1118
|
-
declare function wrapArray<T>(items: T[], params?: PaginationParams): PaginatedResponse<T>;
|
|
1119
1182
|
|
|
1120
|
-
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type Database, type DatabaseCredentials, type Deploy, type DeployListResponse, type DeployLogEntry, type Domain, type EnvVar, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceType, type StreamLogsOptions, type Team, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery
|
|
1183
|
+
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, ConflictError, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CreateVolumeInput, type CronExecution, type CronExecutionStatus, type CronExecutionTrigger, type Database, type DatabaseCredentials, type DatabaseEngine, type DatabasePlan, type DatabaseStatus, type Deploy, type DeployListResponse, type DeployLogEntry, type DeployStatus, type DeployTrigger, type Domain, type DomainStatus, type EnvVar, type EnvVarTarget, type Environment, ForbiddenError, HostStack, HostStackError, type HostStackOptions, type IdInput, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type NotificationChannel, type NotificationChannelEvent, type NotificationChannelType, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type RegionId, type Service, type ServiceConfig, type ServiceMetricsPoint, type ServiceMetricsSnapshot, type ServicePlan, type ServiceStatus, type ServiceType, type StreamLogsOptions, type Team, type TeamRole, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type UpdateVolumeInput, type User, type Volume, buildPaginationQuery };
|