@hoststack.dev/sdk 0.11.0 → 0.11.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 +21 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -39,6 +39,8 @@ interface Service {
|
|
|
39
39
|
status: ServiceStatus;
|
|
40
40
|
internalUrl?: string | null;
|
|
41
41
|
projectId: number;
|
|
42
|
+
/** Size tier (memory/CPU/disk bracket), e.g. "standard" / "large". Change via `services.resize`. */
|
|
43
|
+
plan?: string;
|
|
42
44
|
createdAt: string;
|
|
43
45
|
updatedAt: string;
|
|
44
46
|
}
|
|
@@ -109,6 +111,19 @@ interface DevEnvironment extends Service {
|
|
|
109
111
|
devUrl?: string | null;
|
|
110
112
|
/** Companion engines attached to the box (e.g. `['postgres','redis']`). */
|
|
111
113
|
databases?: string[];
|
|
114
|
+
/**
|
|
115
|
+
* Why the box's container last exited recently, if at all. `'oom_killed'`
|
|
116
|
+
* means it ran out of memory (the DB status stays `active` because the
|
|
117
|
+
* health monitor auto-restarts it) — pair with `recommendedSize` to offer
|
|
118
|
+
* a rescale. `null` when it exited cleanly / hasn't exited.
|
|
119
|
+
*/
|
|
120
|
+
exitReason?: 'oom_killed' | 'crashed' | null;
|
|
121
|
+
/**
|
|
122
|
+
* Suggested next size tier to rescale to, set when the box recently
|
|
123
|
+
* OOM-killed. `null` when no rescale is recommended (or already at the
|
|
124
|
+
* largest tier).
|
|
125
|
+
*/
|
|
126
|
+
recommendedSize?: string | null;
|
|
112
127
|
}
|
|
113
128
|
/**
|
|
114
129
|
* Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
|
|
@@ -127,6 +142,14 @@ interface UpdateServiceInput {
|
|
|
127
142
|
cronSchedule?: string | null;
|
|
128
143
|
publishPath?: string | null;
|
|
129
144
|
runtime?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Resize the service's size tier (memory/CPU/disk bracket). The supported
|
|
147
|
+
* way to scale a box past its current tier's resource ceiling — per-config
|
|
148
|
+
* overrides are clamped to the tier, so growing beyond it needs a tier move.
|
|
149
|
+
* Dev boxes are floored to the OOM-safe minimum. Applies live to the running
|
|
150
|
+
* container (memory/CPU) where possible; disk grows on the next recreate.
|
|
151
|
+
*/
|
|
152
|
+
plan?: string;
|
|
130
153
|
}
|
|
131
154
|
interface ServiceConfig {
|
|
132
155
|
memoryMb?: number;
|
|
@@ -930,6 +953,17 @@ declare class ServicesResource {
|
|
|
930
953
|
}>;
|
|
931
954
|
/** Delete a service. */
|
|
932
955
|
delete(teamId: IdInput, serviceId: IdInput): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Resize a service (incl. dev boxes) to a different size tier. This is the
|
|
958
|
+
* supported way to scale past the current tier's memory/CPU/disk ceiling —
|
|
959
|
+
* per-config overrides are clamped to the tier, so growing beyond it
|
|
960
|
+
* requires moving the tier. The new tier's memory/CPU apply LIVE to the
|
|
961
|
+
* running container (no recreate); disk grows on the next recreate. Dev
|
|
962
|
+
* boxes are floored to the OOM-safe minimum size server-side.
|
|
963
|
+
*/
|
|
964
|
+
resize(teamId: IdInput, serviceId: IdInput, plan: string): Promise<{
|
|
965
|
+
service: Service;
|
|
966
|
+
}>;
|
|
933
967
|
/**
|
|
934
968
|
* List the team's dev environments (the Development section), each annotated
|
|
935
969
|
* with the companion services attached to it (`databases`).
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ interface Service {
|
|
|
39
39
|
status: ServiceStatus;
|
|
40
40
|
internalUrl?: string | null;
|
|
41
41
|
projectId: number;
|
|
42
|
+
/** Size tier (memory/CPU/disk bracket), e.g. "standard" / "large". Change via `services.resize`. */
|
|
43
|
+
plan?: string;
|
|
42
44
|
createdAt: string;
|
|
43
45
|
updatedAt: string;
|
|
44
46
|
}
|
|
@@ -109,6 +111,19 @@ interface DevEnvironment extends Service {
|
|
|
109
111
|
devUrl?: string | null;
|
|
110
112
|
/** Companion engines attached to the box (e.g. `['postgres','redis']`). */
|
|
111
113
|
databases?: string[];
|
|
114
|
+
/**
|
|
115
|
+
* Why the box's container last exited recently, if at all. `'oom_killed'`
|
|
116
|
+
* means it ran out of memory (the DB status stays `active` because the
|
|
117
|
+
* health monitor auto-restarts it) — pair with `recommendedSize` to offer
|
|
118
|
+
* a rescale. `null` when it exited cleanly / hasn't exited.
|
|
119
|
+
*/
|
|
120
|
+
exitReason?: 'oom_killed' | 'crashed' | null;
|
|
121
|
+
/**
|
|
122
|
+
* Suggested next size tier to rescale to, set when the box recently
|
|
123
|
+
* OOM-killed. `null` when no rescale is recommended (or already at the
|
|
124
|
+
* largest tier).
|
|
125
|
+
*/
|
|
126
|
+
recommendedSize?: string | null;
|
|
112
127
|
}
|
|
113
128
|
/**
|
|
114
129
|
* Fields that live on the `services` row — write via PATCH /services/:tid/:sid.
|
|
@@ -127,6 +142,14 @@ interface UpdateServiceInput {
|
|
|
127
142
|
cronSchedule?: string | null;
|
|
128
143
|
publishPath?: string | null;
|
|
129
144
|
runtime?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Resize the service's size tier (memory/CPU/disk bracket). The supported
|
|
147
|
+
* way to scale a box past its current tier's resource ceiling — per-config
|
|
148
|
+
* overrides are clamped to the tier, so growing beyond it needs a tier move.
|
|
149
|
+
* Dev boxes are floored to the OOM-safe minimum. Applies live to the running
|
|
150
|
+
* container (memory/CPU) where possible; disk grows on the next recreate.
|
|
151
|
+
*/
|
|
152
|
+
plan?: string;
|
|
130
153
|
}
|
|
131
154
|
interface ServiceConfig {
|
|
132
155
|
memoryMb?: number;
|
|
@@ -930,6 +953,17 @@ declare class ServicesResource {
|
|
|
930
953
|
}>;
|
|
931
954
|
/** Delete a service. */
|
|
932
955
|
delete(teamId: IdInput, serviceId: IdInput): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Resize a service (incl. dev boxes) to a different size tier. This is the
|
|
958
|
+
* supported way to scale past the current tier's memory/CPU/disk ceiling —
|
|
959
|
+
* per-config overrides are clamped to the tier, so growing beyond it
|
|
960
|
+
* requires moving the tier. The new tier's memory/CPU apply LIVE to the
|
|
961
|
+
* running container (no recreate); disk grows on the next recreate. Dev
|
|
962
|
+
* boxes are floored to the OOM-safe minimum size server-side.
|
|
963
|
+
*/
|
|
964
|
+
resize(teamId: IdInput, serviceId: IdInput, plan: string): Promise<{
|
|
965
|
+
service: Service;
|
|
966
|
+
}>;
|
|
933
967
|
/**
|
|
934
968
|
* List the team's dev environments (the Development section), each annotated
|
|
935
969
|
* with the companion services attached to it (`databases`).
|
package/dist/index.js
CHANGED
|
@@ -641,6 +641,19 @@ var ServicesResource = class {
|
|
|
641
641
|
const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
|
|
642
642
|
return this.client.request("DELETE", `/api/services/${tid}/${sid}`);
|
|
643
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Resize a service (incl. dev boxes) to a different size tier. This is the
|
|
646
|
+
* supported way to scale past the current tier's memory/CPU/disk ceiling —
|
|
647
|
+
* per-config overrides are clamped to the tier, so growing beyond it
|
|
648
|
+
* requires moving the tier. The new tier's memory/CPU apply LIVE to the
|
|
649
|
+
* running container (no recreate); disk grows on the next recreate. Dev
|
|
650
|
+
* boxes are floored to the OOM-safe minimum size server-side.
|
|
651
|
+
*/
|
|
652
|
+
async resize(teamId, serviceId, plan) {
|
|
653
|
+
const tid = await this.client.resolveId(teamId, { kind: "team" });
|
|
654
|
+
const sid = await this.client.resolveId(serviceId, { kind: "service", teamId: tid });
|
|
655
|
+
return this.client.request("PATCH", `/api/services/${tid}/${sid}`, { plan });
|
|
656
|
+
}
|
|
644
657
|
/**
|
|
645
658
|
* List the team's dev environments (the Development section), each annotated
|
|
646
659
|
* with the companion services attached to it (`databases`).
|
|
@@ -991,7 +1004,14 @@ var HostStack = class {
|
|
|
991
1004
|
const cached = this.idCache.get(cacheKey);
|
|
992
1005
|
if (cached !== void 0) return cached;
|
|
993
1006
|
const items = await this.fetchForResolution(scope);
|
|
994
|
-
|
|
1007
|
+
let match = items.find((it) => it.publicId === input);
|
|
1008
|
+
if (!match && scope.kind === "service") {
|
|
1009
|
+
try {
|
|
1010
|
+
const d = await this.request("GET", `/api/dev-environments/${scope.teamId}`);
|
|
1011
|
+
match = (d.environments ?? []).find((it) => it.publicId === input);
|
|
1012
|
+
} catch {
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
995
1015
|
if (!match) {
|
|
996
1016
|
throw new NotFoundError(`${scope.kind} ${input} not found`);
|
|
997
1017
|
}
|