@hoststack.dev/sdk 0.2.1 → 0.4.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/README.md +2 -0
- package/dist/index.cjs +154 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +198 -2
- package/dist/index.d.ts +198 -2
- package/dist/index.js +154 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -32,6 +32,12 @@ interface CreateServiceInput {
|
|
|
32
32
|
name: string;
|
|
33
33
|
type: string;
|
|
34
34
|
projectId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* v66 P5: bind the new service to a specific environment in the
|
|
37
|
+
* project. Omit to default to the project's Production env. Find or
|
|
38
|
+
* list envs with `client.environments.list(teamId, projectId)`.
|
|
39
|
+
*/
|
|
40
|
+
environmentId?: number;
|
|
35
41
|
gitUrl?: string;
|
|
36
42
|
branch?: string;
|
|
37
43
|
buildCommand?: string;
|
|
@@ -137,6 +143,11 @@ interface CreateDatabaseInput {
|
|
|
137
143
|
name: string;
|
|
138
144
|
engine: DatabaseEngine;
|
|
139
145
|
projectId: number;
|
|
146
|
+
/**
|
|
147
|
+
* v66 P5: bind the new database to a specific environment in the
|
|
148
|
+
* project. Omit to default to the project's Production env.
|
|
149
|
+
*/
|
|
150
|
+
environmentId?: number;
|
|
140
151
|
version?: string;
|
|
141
152
|
plan?: 'free' | 'starter' | 'standard' | 'pro';
|
|
142
153
|
region?: string;
|
|
@@ -152,6 +163,36 @@ interface DatabaseCredentials {
|
|
|
152
163
|
database: string;
|
|
153
164
|
connectionUrl: string;
|
|
154
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* A persistent disk attached to a service. Survives redeploys and
|
|
168
|
+
* container restarts. One service can have multiple volumes; each one is
|
|
169
|
+
* identified by a short `name` and a `mountPath` inside the container.
|
|
170
|
+
*/
|
|
171
|
+
interface Volume {
|
|
172
|
+
id: number;
|
|
173
|
+
publicId: string;
|
|
174
|
+
name: string;
|
|
175
|
+
mountPath: string;
|
|
176
|
+
sizeGb: number;
|
|
177
|
+
status: 'pending' | 'active' | 'deleting';
|
|
178
|
+
serviceId: number;
|
|
179
|
+
createdAt: string;
|
|
180
|
+
updatedAt: string;
|
|
181
|
+
}
|
|
182
|
+
interface CreateVolumeInput {
|
|
183
|
+
/** Lowercase alphanumeric and hyphens, ≤64 chars. Used as the docker
|
|
184
|
+
* volume identifier — change with care once data is written. */
|
|
185
|
+
name: string;
|
|
186
|
+
/** In-container absolute path where the volume mounts. */
|
|
187
|
+
mountPath: string;
|
|
188
|
+
/** Disk size in GB. 1–100, default 1. Counts against your plan's
|
|
189
|
+
* storage quota and is metered for billing. */
|
|
190
|
+
sizeGb?: number;
|
|
191
|
+
}
|
|
192
|
+
interface UpdateVolumeInput {
|
|
193
|
+
mountPath?: string;
|
|
194
|
+
sizeGb?: number;
|
|
195
|
+
}
|
|
155
196
|
interface Domain {
|
|
156
197
|
id: number;
|
|
157
198
|
publicId: string;
|
|
@@ -324,6 +365,15 @@ declare class DeploysResource {
|
|
|
324
365
|
cancel(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
325
366
|
/** Rollback to a previous deploy. */
|
|
326
367
|
rollback(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* v66 P5: promote a built deploy to a sibling service in another
|
|
370
|
+
* environment. Reuses the source deploy's docker image (no rebuild).
|
|
371
|
+
* If no sibling service exists in the target env yet, the API auto-
|
|
372
|
+
* creates one by cloning the source service's config.
|
|
373
|
+
*/
|
|
374
|
+
promote(teamId: IdInput, serviceId: IdInput, deployId: IdInput, targetEnvironmentId: number): Promise<{
|
|
375
|
+
deploy: Deploy;
|
|
376
|
+
}>;
|
|
327
377
|
/**
|
|
328
378
|
* Get build logs for a deploy.
|
|
329
379
|
*
|
|
@@ -371,6 +421,76 @@ declare class DomainsResource {
|
|
|
371
421
|
verify(teamId: IdInput, domainId: IdInput): Promise<void>;
|
|
372
422
|
}
|
|
373
423
|
|
|
424
|
+
interface Environment {
|
|
425
|
+
id: number;
|
|
426
|
+
publicId: string;
|
|
427
|
+
projectId: number;
|
|
428
|
+
name: string;
|
|
429
|
+
type: 'production' | 'staging' | 'development' | 'preview';
|
|
430
|
+
isDefault: boolean;
|
|
431
|
+
isProtected: boolean;
|
|
432
|
+
createdAt: string;
|
|
433
|
+
updatedAt: string;
|
|
434
|
+
}
|
|
435
|
+
interface CreateEnvironmentInput {
|
|
436
|
+
name: string;
|
|
437
|
+
type: 'production' | 'staging' | 'development' | 'preview';
|
|
438
|
+
isProtected?: boolean;
|
|
439
|
+
}
|
|
440
|
+
interface UpdateEnvironmentInput {
|
|
441
|
+
name?: string;
|
|
442
|
+
isDefault?: boolean;
|
|
443
|
+
isProtected?: boolean;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* v66 P5: programmatic env management. Each project has at least a
|
|
447
|
+
* Production env auto-created at project creation; you can add more
|
|
448
|
+
* via `create` and bind services/databases to them via the
|
|
449
|
+
* `environmentId` field on those resources' create inputs.
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```ts
|
|
453
|
+
* const { environment: staging } = await client.environments.create(
|
|
454
|
+
* teamId,
|
|
455
|
+
* projectId,
|
|
456
|
+
* { name: 'Staging', type: 'staging' }
|
|
457
|
+
* );
|
|
458
|
+
* await client.services.create(teamId, {
|
|
459
|
+
* projectId,
|
|
460
|
+
* environmentId: staging.id,
|
|
461
|
+
* name: 'api',
|
|
462
|
+
* type: 'web_service',
|
|
463
|
+
* // ...
|
|
464
|
+
* });
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
declare class EnvironmentsResource {
|
|
468
|
+
private client;
|
|
469
|
+
constructor(client: HostStack);
|
|
470
|
+
/** List all environments for a project. */
|
|
471
|
+
list(teamId: IdInput, projectId: IdInput): Promise<{
|
|
472
|
+
environments: Environment[];
|
|
473
|
+
}>;
|
|
474
|
+
/** Get a single environment by id. */
|
|
475
|
+
get(teamId: IdInput, projectId: IdInput, envId: IdInput): Promise<{
|
|
476
|
+
environment: Environment;
|
|
477
|
+
}>;
|
|
478
|
+
/** Create a new environment in the given project. */
|
|
479
|
+
create(teamId: IdInput, projectId: IdInput, data: CreateEnvironmentInput): Promise<{
|
|
480
|
+
environment: Environment;
|
|
481
|
+
}>;
|
|
482
|
+
/** Update environment metadata (name, default flag, protected flag). */
|
|
483
|
+
update(teamId: IdInput, projectId: IdInput, envId: IdInput, data: UpdateEnvironmentInput): Promise<{
|
|
484
|
+
environment: Environment;
|
|
485
|
+
}>;
|
|
486
|
+
/**
|
|
487
|
+
* Delete an environment. The API blocks delete when the env still
|
|
488
|
+
* has services or databases attached — destroy them first or move
|
|
489
|
+
* them to another env. Cannot delete the project's default env.
|
|
490
|
+
*/
|
|
491
|
+
delete(teamId: IdInput, projectId: IdInput, envId: IdInput): Promise<void>;
|
|
492
|
+
}
|
|
493
|
+
|
|
374
494
|
declare class EnvVarsResource {
|
|
375
495
|
private client;
|
|
376
496
|
constructor(client: HostStack);
|
|
@@ -475,13 +595,31 @@ declare class ServicesResource {
|
|
|
475
595
|
updateConfig(teamId: IdInput, serviceId: IdInput, data: UpdateServiceConfigInput): Promise<{
|
|
476
596
|
config: ServiceConfig;
|
|
477
597
|
}>;
|
|
478
|
-
/**
|
|
598
|
+
/**
|
|
599
|
+
* Get runtime logs for a service.
|
|
600
|
+
*
|
|
601
|
+
* `since`/`until` accept either an ISO-8601 timestamp or a short
|
|
602
|
+
* relative offset like `-5m`, `-1h`, `-2d`.
|
|
603
|
+
*
|
|
604
|
+
* `search` does case-insensitive substring filtering server-side
|
|
605
|
+
* (≤100 chars). `countOnly` returns just `{ count: N }` for cheap
|
|
606
|
+
* polling — useful when you want to know "how many error lines in the
|
|
607
|
+
* last 5 minutes" without paying the bytes.
|
|
608
|
+
*/
|
|
479
609
|
getRuntimeLogs(teamId: IdInput, serviceId: IdInput, options?: {
|
|
480
610
|
lines?: number;
|
|
611
|
+
limit?: number;
|
|
481
612
|
since?: string;
|
|
613
|
+
until?: string;
|
|
482
614
|
stream?: 'stdout' | 'stderr';
|
|
615
|
+
level?: 'stdout' | 'stderr' | 'info' | 'warn' | 'error' | 'debug';
|
|
616
|
+
search?: string;
|
|
617
|
+
grep?: string;
|
|
618
|
+
countOnly?: boolean;
|
|
483
619
|
}): Promise<{
|
|
484
620
|
logs: LogEntry[] | string;
|
|
621
|
+
} | {
|
|
622
|
+
count: number;
|
|
485
623
|
}>;
|
|
486
624
|
/**
|
|
487
625
|
* Stream runtime logs for a service by polling the logs endpoint.
|
|
@@ -498,6 +636,53 @@ declare class ServicesResource {
|
|
|
498
636
|
streamLogs(teamId: IdInput, serviceId: IdInput, options?: StreamLogsOptions): AsyncGenerator<LogEntry>;
|
|
499
637
|
}
|
|
500
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Manage persistent disks attached to a service.
|
|
641
|
+
*
|
|
642
|
+
* Volumes mount a writable disk into a service's container at the path you
|
|
643
|
+
* choose, surviving redeploys and container restarts. One service can have
|
|
644
|
+
* multiple volumes; each one is identified by a short `name` and a
|
|
645
|
+
* `mountPath`.
|
|
646
|
+
*
|
|
647
|
+
* Renderers porting from render.yaml: a volume here is the same concept as
|
|
648
|
+
* Render's `disk:` block. Use {@link create} to attach one programmatically,
|
|
649
|
+
* or declare it in `hoststack.yaml` for IaC workflows.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* ```ts
|
|
653
|
+
* await client.volumes.create(team, service, {
|
|
654
|
+
* name: 'data',
|
|
655
|
+
* mountPath: '/var/data',
|
|
656
|
+
* sizeGb: 10,
|
|
657
|
+
* });
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
declare class VolumesResource {
|
|
661
|
+
private client;
|
|
662
|
+
constructor(client: HostStack);
|
|
663
|
+
/** List volumes attached to a service. */
|
|
664
|
+
list(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
665
|
+
volumes: Volume[];
|
|
666
|
+
}>;
|
|
667
|
+
/** Attach a new volume to a service. Triggers provisioning on the host. */
|
|
668
|
+
create(teamId: IdInput, serviceId: IdInput, data: CreateVolumeInput): Promise<{
|
|
669
|
+
volume: Volume;
|
|
670
|
+
}>;
|
|
671
|
+
/**
|
|
672
|
+
* Update a volume's mountPath or sizeGb. Resizes that take effect on the
|
|
673
|
+
* next deploy; mountPath changes require a redeploy to remount.
|
|
674
|
+
*/
|
|
675
|
+
update(teamId: IdInput, serviceId: IdInput, volumeId: IdInput, data: UpdateVolumeInput): Promise<{
|
|
676
|
+
volume: Volume;
|
|
677
|
+
}>;
|
|
678
|
+
/**
|
|
679
|
+
* Detach and deprovision a volume. The underlying disk is destroyed —
|
|
680
|
+
* back up any data first. Async: the row is marked `deleting` and the
|
|
681
|
+
* agent finalises the removal once it acks.
|
|
682
|
+
*/
|
|
683
|
+
delete(teamId: IdInput, serviceId: IdInput, volumeId: IdInput): Promise<void>;
|
|
684
|
+
}
|
|
685
|
+
|
|
501
686
|
/** A numeric id or a publicId string (e.g. 42, "42", "svc_abc…"). */
|
|
502
687
|
type IdInput = number | string;
|
|
503
688
|
interface HostStackOptions {
|
|
@@ -524,10 +709,17 @@ type ResolveScope = {
|
|
|
524
709
|
} | {
|
|
525
710
|
kind: 'domain';
|
|
526
711
|
teamId: number;
|
|
712
|
+
} | {
|
|
713
|
+
kind: 'volume';
|
|
714
|
+
teamId: number;
|
|
715
|
+
serviceId: number;
|
|
527
716
|
} | {
|
|
528
717
|
kind: 'envVar';
|
|
529
718
|
teamId: number;
|
|
530
719
|
serviceId: number;
|
|
720
|
+
} | {
|
|
721
|
+
kind: 'environment';
|
|
722
|
+
teamId: number;
|
|
531
723
|
} | {
|
|
532
724
|
kind: 'cronExecution';
|
|
533
725
|
teamId: number;
|
|
@@ -549,8 +741,12 @@ declare class HostStack {
|
|
|
549
741
|
readonly domains: DomainsResource;
|
|
550
742
|
/** Manage service environment variables. */
|
|
551
743
|
readonly envVars: EnvVarsResource;
|
|
744
|
+
/** v66: manage environments (production/staging/development/preview) per project. */
|
|
745
|
+
readonly environments: EnvironmentsResource;
|
|
552
746
|
/** Manage cron job executions. */
|
|
553
747
|
readonly cron: CronResource;
|
|
748
|
+
/** Manage persistent disks attached to services. */
|
|
749
|
+
readonly volumes: VolumesResource;
|
|
554
750
|
constructor(options: HostStackOptions);
|
|
555
751
|
/**
|
|
556
752
|
* Make an authenticated request to the HostStack API.
|
|
@@ -614,4 +810,4 @@ declare function buildPaginationQuery(params?: PaginationParams): string;
|
|
|
614
810
|
*/
|
|
615
811
|
declare function wrapArray<T>(items: T[], params?: PaginationParams): PaginatedResponse<T>;
|
|
616
812
|
|
|
617
|
-
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, type CreateDatabaseInput, type CreateEnvVarInput, type CreateProjectInput, type CreateServiceInput, type CronExecution, type Database, type DatabaseCredentials, type Deploy, type Domain, type EnvVar, HostStack, HostStackError, type HostStackOptions, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type Service, type ServiceConfig, type ServiceMetrics, type StreamLogsOptions, type Team, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type User, buildPaginationQuery, wrapArray };
|
|
813
|
+
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CronExecution, type Database, type DatabaseCredentials, type Deploy, type Domain, type EnvVar, type Environment, HostStack, HostStackError, type HostStackOptions, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type Service, type ServiceConfig, type ServiceMetrics, type StreamLogsOptions, type Team, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type User, buildPaginationQuery, wrapArray };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ interface CreateServiceInput {
|
|
|
32
32
|
name: string;
|
|
33
33
|
type: string;
|
|
34
34
|
projectId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* v66 P5: bind the new service to a specific environment in the
|
|
37
|
+
* project. Omit to default to the project's Production env. Find or
|
|
38
|
+
* list envs with `client.environments.list(teamId, projectId)`.
|
|
39
|
+
*/
|
|
40
|
+
environmentId?: number;
|
|
35
41
|
gitUrl?: string;
|
|
36
42
|
branch?: string;
|
|
37
43
|
buildCommand?: string;
|
|
@@ -137,6 +143,11 @@ interface CreateDatabaseInput {
|
|
|
137
143
|
name: string;
|
|
138
144
|
engine: DatabaseEngine;
|
|
139
145
|
projectId: number;
|
|
146
|
+
/**
|
|
147
|
+
* v66 P5: bind the new database to a specific environment in the
|
|
148
|
+
* project. Omit to default to the project's Production env.
|
|
149
|
+
*/
|
|
150
|
+
environmentId?: number;
|
|
140
151
|
version?: string;
|
|
141
152
|
plan?: 'free' | 'starter' | 'standard' | 'pro';
|
|
142
153
|
region?: string;
|
|
@@ -152,6 +163,36 @@ interface DatabaseCredentials {
|
|
|
152
163
|
database: string;
|
|
153
164
|
connectionUrl: string;
|
|
154
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* A persistent disk attached to a service. Survives redeploys and
|
|
168
|
+
* container restarts. One service can have multiple volumes; each one is
|
|
169
|
+
* identified by a short `name` and a `mountPath` inside the container.
|
|
170
|
+
*/
|
|
171
|
+
interface Volume {
|
|
172
|
+
id: number;
|
|
173
|
+
publicId: string;
|
|
174
|
+
name: string;
|
|
175
|
+
mountPath: string;
|
|
176
|
+
sizeGb: number;
|
|
177
|
+
status: 'pending' | 'active' | 'deleting';
|
|
178
|
+
serviceId: number;
|
|
179
|
+
createdAt: string;
|
|
180
|
+
updatedAt: string;
|
|
181
|
+
}
|
|
182
|
+
interface CreateVolumeInput {
|
|
183
|
+
/** Lowercase alphanumeric and hyphens, ≤64 chars. Used as the docker
|
|
184
|
+
* volume identifier — change with care once data is written. */
|
|
185
|
+
name: string;
|
|
186
|
+
/** In-container absolute path where the volume mounts. */
|
|
187
|
+
mountPath: string;
|
|
188
|
+
/** Disk size in GB. 1–100, default 1. Counts against your plan's
|
|
189
|
+
* storage quota and is metered for billing. */
|
|
190
|
+
sizeGb?: number;
|
|
191
|
+
}
|
|
192
|
+
interface UpdateVolumeInput {
|
|
193
|
+
mountPath?: string;
|
|
194
|
+
sizeGb?: number;
|
|
195
|
+
}
|
|
155
196
|
interface Domain {
|
|
156
197
|
id: number;
|
|
157
198
|
publicId: string;
|
|
@@ -324,6 +365,15 @@ declare class DeploysResource {
|
|
|
324
365
|
cancel(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
325
366
|
/** Rollback to a previous deploy. */
|
|
326
367
|
rollback(teamId: IdInput, serviceId: IdInput, deployId: IdInput): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* v66 P5: promote a built deploy to a sibling service in another
|
|
370
|
+
* environment. Reuses the source deploy's docker image (no rebuild).
|
|
371
|
+
* If no sibling service exists in the target env yet, the API auto-
|
|
372
|
+
* creates one by cloning the source service's config.
|
|
373
|
+
*/
|
|
374
|
+
promote(teamId: IdInput, serviceId: IdInput, deployId: IdInput, targetEnvironmentId: number): Promise<{
|
|
375
|
+
deploy: Deploy;
|
|
376
|
+
}>;
|
|
327
377
|
/**
|
|
328
378
|
* Get build logs for a deploy.
|
|
329
379
|
*
|
|
@@ -371,6 +421,76 @@ declare class DomainsResource {
|
|
|
371
421
|
verify(teamId: IdInput, domainId: IdInput): Promise<void>;
|
|
372
422
|
}
|
|
373
423
|
|
|
424
|
+
interface Environment {
|
|
425
|
+
id: number;
|
|
426
|
+
publicId: string;
|
|
427
|
+
projectId: number;
|
|
428
|
+
name: string;
|
|
429
|
+
type: 'production' | 'staging' | 'development' | 'preview';
|
|
430
|
+
isDefault: boolean;
|
|
431
|
+
isProtected: boolean;
|
|
432
|
+
createdAt: string;
|
|
433
|
+
updatedAt: string;
|
|
434
|
+
}
|
|
435
|
+
interface CreateEnvironmentInput {
|
|
436
|
+
name: string;
|
|
437
|
+
type: 'production' | 'staging' | 'development' | 'preview';
|
|
438
|
+
isProtected?: boolean;
|
|
439
|
+
}
|
|
440
|
+
interface UpdateEnvironmentInput {
|
|
441
|
+
name?: string;
|
|
442
|
+
isDefault?: boolean;
|
|
443
|
+
isProtected?: boolean;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* v66 P5: programmatic env management. Each project has at least a
|
|
447
|
+
* Production env auto-created at project creation; you can add more
|
|
448
|
+
* via `create` and bind services/databases to them via the
|
|
449
|
+
* `environmentId` field on those resources' create inputs.
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```ts
|
|
453
|
+
* const { environment: staging } = await client.environments.create(
|
|
454
|
+
* teamId,
|
|
455
|
+
* projectId,
|
|
456
|
+
* { name: 'Staging', type: 'staging' }
|
|
457
|
+
* );
|
|
458
|
+
* await client.services.create(teamId, {
|
|
459
|
+
* projectId,
|
|
460
|
+
* environmentId: staging.id,
|
|
461
|
+
* name: 'api',
|
|
462
|
+
* type: 'web_service',
|
|
463
|
+
* // ...
|
|
464
|
+
* });
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
declare class EnvironmentsResource {
|
|
468
|
+
private client;
|
|
469
|
+
constructor(client: HostStack);
|
|
470
|
+
/** List all environments for a project. */
|
|
471
|
+
list(teamId: IdInput, projectId: IdInput): Promise<{
|
|
472
|
+
environments: Environment[];
|
|
473
|
+
}>;
|
|
474
|
+
/** Get a single environment by id. */
|
|
475
|
+
get(teamId: IdInput, projectId: IdInput, envId: IdInput): Promise<{
|
|
476
|
+
environment: Environment;
|
|
477
|
+
}>;
|
|
478
|
+
/** Create a new environment in the given project. */
|
|
479
|
+
create(teamId: IdInput, projectId: IdInput, data: CreateEnvironmentInput): Promise<{
|
|
480
|
+
environment: Environment;
|
|
481
|
+
}>;
|
|
482
|
+
/** Update environment metadata (name, default flag, protected flag). */
|
|
483
|
+
update(teamId: IdInput, projectId: IdInput, envId: IdInput, data: UpdateEnvironmentInput): Promise<{
|
|
484
|
+
environment: Environment;
|
|
485
|
+
}>;
|
|
486
|
+
/**
|
|
487
|
+
* Delete an environment. The API blocks delete when the env still
|
|
488
|
+
* has services or databases attached — destroy them first or move
|
|
489
|
+
* them to another env. Cannot delete the project's default env.
|
|
490
|
+
*/
|
|
491
|
+
delete(teamId: IdInput, projectId: IdInput, envId: IdInput): Promise<void>;
|
|
492
|
+
}
|
|
493
|
+
|
|
374
494
|
declare class EnvVarsResource {
|
|
375
495
|
private client;
|
|
376
496
|
constructor(client: HostStack);
|
|
@@ -475,13 +595,31 @@ declare class ServicesResource {
|
|
|
475
595
|
updateConfig(teamId: IdInput, serviceId: IdInput, data: UpdateServiceConfigInput): Promise<{
|
|
476
596
|
config: ServiceConfig;
|
|
477
597
|
}>;
|
|
478
|
-
/**
|
|
598
|
+
/**
|
|
599
|
+
* Get runtime logs for a service.
|
|
600
|
+
*
|
|
601
|
+
* `since`/`until` accept either an ISO-8601 timestamp or a short
|
|
602
|
+
* relative offset like `-5m`, `-1h`, `-2d`.
|
|
603
|
+
*
|
|
604
|
+
* `search` does case-insensitive substring filtering server-side
|
|
605
|
+
* (≤100 chars). `countOnly` returns just `{ count: N }` for cheap
|
|
606
|
+
* polling — useful when you want to know "how many error lines in the
|
|
607
|
+
* last 5 minutes" without paying the bytes.
|
|
608
|
+
*/
|
|
479
609
|
getRuntimeLogs(teamId: IdInput, serviceId: IdInput, options?: {
|
|
480
610
|
lines?: number;
|
|
611
|
+
limit?: number;
|
|
481
612
|
since?: string;
|
|
613
|
+
until?: string;
|
|
482
614
|
stream?: 'stdout' | 'stderr';
|
|
615
|
+
level?: 'stdout' | 'stderr' | 'info' | 'warn' | 'error' | 'debug';
|
|
616
|
+
search?: string;
|
|
617
|
+
grep?: string;
|
|
618
|
+
countOnly?: boolean;
|
|
483
619
|
}): Promise<{
|
|
484
620
|
logs: LogEntry[] | string;
|
|
621
|
+
} | {
|
|
622
|
+
count: number;
|
|
485
623
|
}>;
|
|
486
624
|
/**
|
|
487
625
|
* Stream runtime logs for a service by polling the logs endpoint.
|
|
@@ -498,6 +636,53 @@ declare class ServicesResource {
|
|
|
498
636
|
streamLogs(teamId: IdInput, serviceId: IdInput, options?: StreamLogsOptions): AsyncGenerator<LogEntry>;
|
|
499
637
|
}
|
|
500
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Manage persistent disks attached to a service.
|
|
641
|
+
*
|
|
642
|
+
* Volumes mount a writable disk into a service's container at the path you
|
|
643
|
+
* choose, surviving redeploys and container restarts. One service can have
|
|
644
|
+
* multiple volumes; each one is identified by a short `name` and a
|
|
645
|
+
* `mountPath`.
|
|
646
|
+
*
|
|
647
|
+
* Renderers porting from render.yaml: a volume here is the same concept as
|
|
648
|
+
* Render's `disk:` block. Use {@link create} to attach one programmatically,
|
|
649
|
+
* or declare it in `hoststack.yaml` for IaC workflows.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* ```ts
|
|
653
|
+
* await client.volumes.create(team, service, {
|
|
654
|
+
* name: 'data',
|
|
655
|
+
* mountPath: '/var/data',
|
|
656
|
+
* sizeGb: 10,
|
|
657
|
+
* });
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
declare class VolumesResource {
|
|
661
|
+
private client;
|
|
662
|
+
constructor(client: HostStack);
|
|
663
|
+
/** List volumes attached to a service. */
|
|
664
|
+
list(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
665
|
+
volumes: Volume[];
|
|
666
|
+
}>;
|
|
667
|
+
/** Attach a new volume to a service. Triggers provisioning on the host. */
|
|
668
|
+
create(teamId: IdInput, serviceId: IdInput, data: CreateVolumeInput): Promise<{
|
|
669
|
+
volume: Volume;
|
|
670
|
+
}>;
|
|
671
|
+
/**
|
|
672
|
+
* Update a volume's mountPath or sizeGb. Resizes that take effect on the
|
|
673
|
+
* next deploy; mountPath changes require a redeploy to remount.
|
|
674
|
+
*/
|
|
675
|
+
update(teamId: IdInput, serviceId: IdInput, volumeId: IdInput, data: UpdateVolumeInput): Promise<{
|
|
676
|
+
volume: Volume;
|
|
677
|
+
}>;
|
|
678
|
+
/**
|
|
679
|
+
* Detach and deprovision a volume. The underlying disk is destroyed —
|
|
680
|
+
* back up any data first. Async: the row is marked `deleting` and the
|
|
681
|
+
* agent finalises the removal once it acks.
|
|
682
|
+
*/
|
|
683
|
+
delete(teamId: IdInput, serviceId: IdInput, volumeId: IdInput): Promise<void>;
|
|
684
|
+
}
|
|
685
|
+
|
|
501
686
|
/** A numeric id or a publicId string (e.g. 42, "42", "svc_abc…"). */
|
|
502
687
|
type IdInput = number | string;
|
|
503
688
|
interface HostStackOptions {
|
|
@@ -524,10 +709,17 @@ type ResolveScope = {
|
|
|
524
709
|
} | {
|
|
525
710
|
kind: 'domain';
|
|
526
711
|
teamId: number;
|
|
712
|
+
} | {
|
|
713
|
+
kind: 'volume';
|
|
714
|
+
teamId: number;
|
|
715
|
+
serviceId: number;
|
|
527
716
|
} | {
|
|
528
717
|
kind: 'envVar';
|
|
529
718
|
teamId: number;
|
|
530
719
|
serviceId: number;
|
|
720
|
+
} | {
|
|
721
|
+
kind: 'environment';
|
|
722
|
+
teamId: number;
|
|
531
723
|
} | {
|
|
532
724
|
kind: 'cronExecution';
|
|
533
725
|
teamId: number;
|
|
@@ -549,8 +741,12 @@ declare class HostStack {
|
|
|
549
741
|
readonly domains: DomainsResource;
|
|
550
742
|
/** Manage service environment variables. */
|
|
551
743
|
readonly envVars: EnvVarsResource;
|
|
744
|
+
/** v66: manage environments (production/staging/development/preview) per project. */
|
|
745
|
+
readonly environments: EnvironmentsResource;
|
|
552
746
|
/** Manage cron job executions. */
|
|
553
747
|
readonly cron: CronResource;
|
|
748
|
+
/** Manage persistent disks attached to services. */
|
|
749
|
+
readonly volumes: VolumesResource;
|
|
554
750
|
constructor(options: HostStackOptions);
|
|
555
751
|
/**
|
|
556
752
|
* Make an authenticated request to the HostStack API.
|
|
@@ -614,4 +810,4 @@ declare function buildPaginationQuery(params?: PaginationParams): string;
|
|
|
614
810
|
*/
|
|
615
811
|
declare function wrapArray<T>(items: T[], params?: PaginationParams): PaginatedResponse<T>;
|
|
616
812
|
|
|
617
|
-
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, type CreateDatabaseInput, type CreateEnvVarInput, type CreateProjectInput, type CreateServiceInput, type CronExecution, type Database, type DatabaseCredentials, type Deploy, type Domain, type EnvVar, HostStack, HostStackError, type HostStackOptions, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type Service, type ServiceConfig, type ServiceMetrics, type StreamLogsOptions, type Team, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type User, buildPaginationQuery, wrapArray };
|
|
813
|
+
export { type ActivityLogEntry, type AddDomainInput, AuthenticationError, type BulkSetEnvVarsInput, type CreateDatabaseInput, type CreateEnvVarInput, type CreateEnvironmentInput, type CreateProjectInput, type CreateServiceInput, type CronExecution, type Database, type DatabaseCredentials, type Deploy, type Domain, type EnvVar, type Environment, HostStack, HostStackError, type HostStackOptions, type LogEntry$1 as LogEntry, type MeResponse, NotFoundError, type PaginatedResponse, type PaginationParams, type Project, RateLimitError, type Service, type ServiceConfig, type ServiceMetrics, type StreamLogsOptions, type Team, type TriggerDeployInput, type UpdateDatabaseInput, type UpdateDomainInput, type UpdateEnvVarInput, type UpdateEnvironmentInput, type UpdateProjectInput, type UpdateServiceConfigInput, type UpdateServiceInput, type User, buildPaginationQuery, wrapArray };
|