@hoststack.dev/sdk 0.4.0 → 0.5.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 +17 -14
- package/dist/index.cjs +107 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +174 -9
- package/dist/index.d.ts +174 -9
- package/dist/index.js +107 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -81,6 +81,15 @@ interface ServiceConfig {
|
|
|
81
81
|
dockerImage?: string | null;
|
|
82
82
|
registryUsername?: string | null;
|
|
83
83
|
registryPassword?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* v72.2: applied to runtime logs at query time. Reflects what the
|
|
86
|
+
* service is currently configured to filter; null/absent means no
|
|
87
|
+
* filtering. See UpdateServiceConfigInput for the write side.
|
|
88
|
+
*/
|
|
89
|
+
logFilterRules?: Array<{
|
|
90
|
+
pattern: string;
|
|
91
|
+
action: 'drop' | 'downgrade';
|
|
92
|
+
}> | null;
|
|
84
93
|
}
|
|
85
94
|
/**
|
|
86
95
|
* Fields that live on the `service_config` row — write via PATCH
|
|
@@ -107,6 +116,18 @@ interface UpdateServiceConfigInput {
|
|
|
107
116
|
dockerImage?: string | null;
|
|
108
117
|
registryUsername?: string | null;
|
|
109
118
|
registryPassword?: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* v72.2: per-service runtime-log filter rules applied at query
|
|
121
|
+
* time. Each rule matches the message by case-insensitive
|
|
122
|
+
* substring; matching rows are either dropped or have their
|
|
123
|
+
* stream flipped from stderr → stdout. Pass an empty array to
|
|
124
|
+
* clear all rules; null/omitted leaves the existing rules in
|
|
125
|
+
* place. Capped at 50 rules.
|
|
126
|
+
*/
|
|
127
|
+
logFilterRules?: Array<{
|
|
128
|
+
pattern: string;
|
|
129
|
+
action: 'drop' | 'downgrade';
|
|
130
|
+
}> | null;
|
|
110
131
|
}
|
|
111
132
|
interface Deploy {
|
|
112
133
|
id: number;
|
|
@@ -118,6 +139,19 @@ interface Deploy {
|
|
|
118
139
|
createdAt: string;
|
|
119
140
|
startedAt?: string | null;
|
|
120
141
|
finishedAt?: string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Wall-clock for the docker build / image-pull step only.
|
|
144
|
+
* Null when the deploy didn't reach the build phase (cancelled
|
|
145
|
+
* pre-pickup) or used a pre-built image with no measured pull.
|
|
146
|
+
*/
|
|
147
|
+
buildDurationMs?: number | null;
|
|
148
|
+
/**
|
|
149
|
+
* Wall-clock for the full deploy pipeline (build + container
|
|
150
|
+
* start + health-check + traffic switch + cleanup), computed at
|
|
151
|
+
* serialize time from finishedAt − startedAt. Absent for deploys
|
|
152
|
+
* still in-flight or that never reached `startedAt`.
|
|
153
|
+
*/
|
|
154
|
+
totalDurationMs?: number;
|
|
121
155
|
}
|
|
122
156
|
interface TriggerDeployInput {
|
|
123
157
|
clearCache?: boolean;
|
|
@@ -136,6 +170,8 @@ interface Database {
|
|
|
136
170
|
plan?: string | null;
|
|
137
171
|
region?: string | null;
|
|
138
172
|
projectId: number;
|
|
173
|
+
diskSizeGb?: number;
|
|
174
|
+
memoryMb?: number;
|
|
139
175
|
createdAt: string;
|
|
140
176
|
updatedAt: string;
|
|
141
177
|
}
|
|
@@ -154,6 +190,9 @@ interface CreateDatabaseInput {
|
|
|
154
190
|
}
|
|
155
191
|
interface UpdateDatabaseInput {
|
|
156
192
|
name?: string;
|
|
193
|
+
plan?: 'free' | 'starter' | 'standard' | 'pro';
|
|
194
|
+
/** Grow the database disk in GB. Cannot shrink. */
|
|
195
|
+
diskSizeGb?: number;
|
|
157
196
|
}
|
|
158
197
|
interface DatabaseCredentials {
|
|
159
198
|
host: string;
|
|
@@ -216,20 +255,24 @@ interface EnvVar {
|
|
|
216
255
|
value: string;
|
|
217
256
|
isSecret: boolean;
|
|
218
257
|
}
|
|
258
|
+
type EnvVarTarget = 'build' | 'runtime' | 'both';
|
|
219
259
|
interface CreateEnvVarInput {
|
|
220
260
|
key: string;
|
|
221
261
|
value: string;
|
|
262
|
+
target?: EnvVarTarget;
|
|
222
263
|
isSecret?: boolean;
|
|
223
264
|
}
|
|
224
265
|
interface UpdateEnvVarInput {
|
|
225
266
|
key?: string;
|
|
226
267
|
value?: string;
|
|
268
|
+
target?: EnvVarTarget;
|
|
227
269
|
isSecret?: boolean;
|
|
228
270
|
}
|
|
229
271
|
interface BulkSetEnvVarsInput {
|
|
230
|
-
|
|
272
|
+
vars: Array<{
|
|
231
273
|
key: string;
|
|
232
274
|
value: string;
|
|
275
|
+
target?: EnvVarTarget;
|
|
233
276
|
isSecret?: boolean;
|
|
234
277
|
}>;
|
|
235
278
|
}
|
|
@@ -512,6 +555,81 @@ declare class EnvVarsResource {
|
|
|
512
555
|
bulkSet(teamId: IdInput, serviceId: IdInput, data: BulkSetEnvVarsInput): Promise<void>;
|
|
513
556
|
}
|
|
514
557
|
|
|
558
|
+
type NotificationChannelType = 'slack' | 'discord' | 'email';
|
|
559
|
+
/**
|
|
560
|
+
* Events a notification channel can subscribe to. Source of truth is
|
|
561
|
+
* `packages/shared/src/schemas/notification-channel.ts:NOTIFICATION_CHANNEL_EVENTS`.
|
|
562
|
+
*/
|
|
563
|
+
type NotificationChannelEvent = 'deploy.started' | 'deploy.succeeded' | 'deploy.failed' | 'deploy.failed_consecutive' | 'service.created' | 'service.deleted' | 'service.suspended' | 'service.resumed' | 'service.restart_failed' | 'service.auto_suspended' | 'service.acme_cert_failed' | 'git.auth_failed';
|
|
564
|
+
interface NotificationChannel {
|
|
565
|
+
id: number;
|
|
566
|
+
teamId: number;
|
|
567
|
+
type: NotificationChannelType;
|
|
568
|
+
name: string;
|
|
569
|
+
/**
|
|
570
|
+
* Webhook URL (Slack/Discord) or email address. The list API masks
|
|
571
|
+
* the value for security — only the create/update calls round-trip
|
|
572
|
+
* the real URL.
|
|
573
|
+
*/
|
|
574
|
+
webhookUrl: string;
|
|
575
|
+
active: boolean;
|
|
576
|
+
events: NotificationChannelEvent[];
|
|
577
|
+
createdAt: string;
|
|
578
|
+
updatedAt: string;
|
|
579
|
+
}
|
|
580
|
+
declare class NotificationsResource {
|
|
581
|
+
private client;
|
|
582
|
+
constructor(client: HostStack);
|
|
583
|
+
/**
|
|
584
|
+
* List notification channels for the team. Webhook URLs are
|
|
585
|
+
* server-side masked in the response so this is safe to log.
|
|
586
|
+
*/
|
|
587
|
+
listChannels(teamId: IdInput): Promise<{
|
|
588
|
+
channels: NotificationChannel[];
|
|
589
|
+
}>;
|
|
590
|
+
/**
|
|
591
|
+
* Create a Slack/Discord/email notification channel.
|
|
592
|
+
*
|
|
593
|
+
* For type=email, `webhookUrl` is the recipient email address; for
|
|
594
|
+
* type=slack/discord it's the incoming webhook URL.
|
|
595
|
+
*
|
|
596
|
+
* `events` is the explicit subscription list — an empty array means
|
|
597
|
+
* "receive nothing". The platform pre-selects the critical-event
|
|
598
|
+
* set on the dashboard, but SDK callers must pass the list
|
|
599
|
+
* explicitly so behaviour is deterministic.
|
|
600
|
+
*/
|
|
601
|
+
createChannel(teamId: IdInput, data: {
|
|
602
|
+
type: NotificationChannelType;
|
|
603
|
+
name: string;
|
|
604
|
+
webhookUrl: string;
|
|
605
|
+
events: NotificationChannelEvent[];
|
|
606
|
+
}): Promise<{
|
|
607
|
+
channel: NotificationChannel;
|
|
608
|
+
}>;
|
|
609
|
+
/**
|
|
610
|
+
* Update a channel's name / active state / event subscriptions. The
|
|
611
|
+
* webhook URL and type are immutable — create a new channel if
|
|
612
|
+
* those need to change.
|
|
613
|
+
*/
|
|
614
|
+
updateChannel(teamId: IdInput, channelId: number, data: {
|
|
615
|
+
name?: string;
|
|
616
|
+
active?: boolean;
|
|
617
|
+
events?: NotificationChannelEvent[];
|
|
618
|
+
}): Promise<{
|
|
619
|
+
channel: NotificationChannel;
|
|
620
|
+
}>;
|
|
621
|
+
/** Delete a notification channel. */
|
|
622
|
+
deleteChannel(teamId: IdInput, channelId: number): Promise<void>;
|
|
623
|
+
/**
|
|
624
|
+
* Fire a test event to the channel so the user can confirm the
|
|
625
|
+
* webhook is wired correctly. Returns the dispatch outcome.
|
|
626
|
+
*/
|
|
627
|
+
testChannel(teamId: IdInput, channelId: number): Promise<{
|
|
628
|
+
success: boolean;
|
|
629
|
+
error?: string;
|
|
630
|
+
}>;
|
|
631
|
+
}
|
|
632
|
+
|
|
515
633
|
declare class ProjectsResource {
|
|
516
634
|
private client;
|
|
517
635
|
constructor(client: HostStack);
|
|
@@ -537,8 +655,13 @@ declare class ProjectsResource {
|
|
|
537
655
|
|
|
538
656
|
interface LogEntry$1 {
|
|
539
657
|
timestamp: string;
|
|
540
|
-
|
|
541
|
-
|
|
658
|
+
/**
|
|
659
|
+
* Parsed log level if the message is a structured JSON envelope
|
|
660
|
+
* (pino numeric, `{"level":"info"}`, or `{"severity":"WARNING"}`).
|
|
661
|
+
* `undefined` for plain-text logs.
|
|
662
|
+
*/
|
|
663
|
+
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | null;
|
|
664
|
+
stream?: 'stdout' | 'stderr' | null;
|
|
542
665
|
message: string;
|
|
543
666
|
}
|
|
544
667
|
interface StreamLogsOptions {
|
|
@@ -554,15 +677,30 @@ interface StreamLogsOptions {
|
|
|
554
677
|
|
|
555
678
|
interface LogEntry {
|
|
556
679
|
timestamp: string;
|
|
557
|
-
|
|
558
|
-
|
|
680
|
+
/**
|
|
681
|
+
* Parsed structured log level (pino numeric or string envelopes).
|
|
682
|
+
* `undefined` for plain-text logs.
|
|
683
|
+
*/
|
|
684
|
+
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | null;
|
|
685
|
+
stream?: 'stdout' | 'stderr' | null;
|
|
559
686
|
message: string;
|
|
560
687
|
}
|
|
561
688
|
declare class ServicesResource {
|
|
562
689
|
private client;
|
|
563
690
|
constructor(client: HostStack);
|
|
564
|
-
/**
|
|
565
|
-
|
|
691
|
+
/**
|
|
692
|
+
* List services for the active team.
|
|
693
|
+
*
|
|
694
|
+
* Optional filters narrow by project, environment, status, or type.
|
|
695
|
+
* The server treats unknown enum values as no match (returns empty)
|
|
696
|
+
* rather than 400-ing.
|
|
697
|
+
*/
|
|
698
|
+
list(teamId: IdInput, filters?: {
|
|
699
|
+
projectId?: number | string;
|
|
700
|
+
environmentId?: number | string;
|
|
701
|
+
status?: 'active' | 'deploying' | 'suspended' | 'failed' | 'not_deployed';
|
|
702
|
+
type?: 'web_service' | 'private_service' | 'worker' | 'cron_job' | 'static_site';
|
|
703
|
+
}): Promise<{
|
|
566
704
|
services: Service[];
|
|
567
705
|
}>;
|
|
568
706
|
/** Get a single service by ID. */
|
|
@@ -587,6 +725,27 @@ declare class ServicesResource {
|
|
|
587
725
|
getMetrics(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
588
726
|
metrics: ServiceMetrics;
|
|
589
727
|
}>;
|
|
728
|
+
/**
|
|
729
|
+
* Get a metrics time series for a service.
|
|
730
|
+
*
|
|
731
|
+
* `from`/`to` accept ISO-8601 timestamps. Omit both for the trailing
|
|
732
|
+
* hour. Server picks the resolution: raw samples ≤7d, hourly pre-
|
|
733
|
+
* aggregates ≤30d, daily beyond that. Up to ~500 points returned.
|
|
734
|
+
*/
|
|
735
|
+
getMetricsHistory(teamId: IdInput, serviceId: IdInput, options?: {
|
|
736
|
+
from?: string;
|
|
737
|
+
to?: string;
|
|
738
|
+
}): Promise<{
|
|
739
|
+
history: Array<{
|
|
740
|
+
timestamp: string;
|
|
741
|
+
cpuPercent: number;
|
|
742
|
+
memoryUsedMb: number;
|
|
743
|
+
memoryLimitMb: number;
|
|
744
|
+
networkRxBytes: number;
|
|
745
|
+
networkTxBytes: number;
|
|
746
|
+
diskUsedMb: number;
|
|
747
|
+
}>;
|
|
748
|
+
}>;
|
|
590
749
|
/** Get service configuration. */
|
|
591
750
|
getConfig(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
592
751
|
config: ServiceConfig;
|
|
@@ -612,7 +771,7 @@ declare class ServicesResource {
|
|
|
612
771
|
since?: string;
|
|
613
772
|
until?: string;
|
|
614
773
|
stream?: 'stdout' | 'stderr';
|
|
615
|
-
level?: 'stdout' | 'stderr' | 'info' | 'warn' | 'error' | '
|
|
774
|
+
level?: 'stdout' | 'stderr' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
616
775
|
search?: string;
|
|
617
776
|
grep?: string;
|
|
618
777
|
countOnly?: boolean;
|
|
@@ -747,6 +906,12 @@ declare class HostStack {
|
|
|
747
906
|
readonly cron: CronResource;
|
|
748
907
|
/** Manage persistent disks attached to services. */
|
|
749
908
|
readonly volumes: VolumesResource;
|
|
909
|
+
/**
|
|
910
|
+
* Manage notification channels — Slack/Discord webhooks + email
|
|
911
|
+
* recipients with per-channel event filters. Used for deploy
|
|
912
|
+
* failures, restart loops, ACME failures, git auth losses, etc.
|
|
913
|
+
*/
|
|
914
|
+
readonly notifications: NotificationsResource;
|
|
750
915
|
constructor(options: HostStackOptions);
|
|
751
916
|
/**
|
|
752
917
|
* Make an authenticated request to the HostStack API.
|
|
@@ -810,4 +975,4 @@ declare function buildPaginationQuery(params?: PaginationParams): string;
|
|
|
810
975
|
*/
|
|
811
976
|
declare function wrapArray<T>(items: T[], params?: PaginationParams): PaginatedResponse<T>;
|
|
812
977
|
|
|
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 };
|
|
978
|
+
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 DeployListResponse, type DeployLogEntry, type Domain, type EnvVar, type Environment, HostStack, HostStackError, type HostStackOptions, 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 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
|
@@ -81,6 +81,15 @@ interface ServiceConfig {
|
|
|
81
81
|
dockerImage?: string | null;
|
|
82
82
|
registryUsername?: string | null;
|
|
83
83
|
registryPassword?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* v72.2: applied to runtime logs at query time. Reflects what the
|
|
86
|
+
* service is currently configured to filter; null/absent means no
|
|
87
|
+
* filtering. See UpdateServiceConfigInput for the write side.
|
|
88
|
+
*/
|
|
89
|
+
logFilterRules?: Array<{
|
|
90
|
+
pattern: string;
|
|
91
|
+
action: 'drop' | 'downgrade';
|
|
92
|
+
}> | null;
|
|
84
93
|
}
|
|
85
94
|
/**
|
|
86
95
|
* Fields that live on the `service_config` row — write via PATCH
|
|
@@ -107,6 +116,18 @@ interface UpdateServiceConfigInput {
|
|
|
107
116
|
dockerImage?: string | null;
|
|
108
117
|
registryUsername?: string | null;
|
|
109
118
|
registryPassword?: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* v72.2: per-service runtime-log filter rules applied at query
|
|
121
|
+
* time. Each rule matches the message by case-insensitive
|
|
122
|
+
* substring; matching rows are either dropped or have their
|
|
123
|
+
* stream flipped from stderr → stdout. Pass an empty array to
|
|
124
|
+
* clear all rules; null/omitted leaves the existing rules in
|
|
125
|
+
* place. Capped at 50 rules.
|
|
126
|
+
*/
|
|
127
|
+
logFilterRules?: Array<{
|
|
128
|
+
pattern: string;
|
|
129
|
+
action: 'drop' | 'downgrade';
|
|
130
|
+
}> | null;
|
|
110
131
|
}
|
|
111
132
|
interface Deploy {
|
|
112
133
|
id: number;
|
|
@@ -118,6 +139,19 @@ interface Deploy {
|
|
|
118
139
|
createdAt: string;
|
|
119
140
|
startedAt?: string | null;
|
|
120
141
|
finishedAt?: string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Wall-clock for the docker build / image-pull step only.
|
|
144
|
+
* Null when the deploy didn't reach the build phase (cancelled
|
|
145
|
+
* pre-pickup) or used a pre-built image with no measured pull.
|
|
146
|
+
*/
|
|
147
|
+
buildDurationMs?: number | null;
|
|
148
|
+
/**
|
|
149
|
+
* Wall-clock for the full deploy pipeline (build + container
|
|
150
|
+
* start + health-check + traffic switch + cleanup), computed at
|
|
151
|
+
* serialize time from finishedAt − startedAt. Absent for deploys
|
|
152
|
+
* still in-flight or that never reached `startedAt`.
|
|
153
|
+
*/
|
|
154
|
+
totalDurationMs?: number;
|
|
121
155
|
}
|
|
122
156
|
interface TriggerDeployInput {
|
|
123
157
|
clearCache?: boolean;
|
|
@@ -136,6 +170,8 @@ interface Database {
|
|
|
136
170
|
plan?: string | null;
|
|
137
171
|
region?: string | null;
|
|
138
172
|
projectId: number;
|
|
173
|
+
diskSizeGb?: number;
|
|
174
|
+
memoryMb?: number;
|
|
139
175
|
createdAt: string;
|
|
140
176
|
updatedAt: string;
|
|
141
177
|
}
|
|
@@ -154,6 +190,9 @@ interface CreateDatabaseInput {
|
|
|
154
190
|
}
|
|
155
191
|
interface UpdateDatabaseInput {
|
|
156
192
|
name?: string;
|
|
193
|
+
plan?: 'free' | 'starter' | 'standard' | 'pro';
|
|
194
|
+
/** Grow the database disk in GB. Cannot shrink. */
|
|
195
|
+
diskSizeGb?: number;
|
|
157
196
|
}
|
|
158
197
|
interface DatabaseCredentials {
|
|
159
198
|
host: string;
|
|
@@ -216,20 +255,24 @@ interface EnvVar {
|
|
|
216
255
|
value: string;
|
|
217
256
|
isSecret: boolean;
|
|
218
257
|
}
|
|
258
|
+
type EnvVarTarget = 'build' | 'runtime' | 'both';
|
|
219
259
|
interface CreateEnvVarInput {
|
|
220
260
|
key: string;
|
|
221
261
|
value: string;
|
|
262
|
+
target?: EnvVarTarget;
|
|
222
263
|
isSecret?: boolean;
|
|
223
264
|
}
|
|
224
265
|
interface UpdateEnvVarInput {
|
|
225
266
|
key?: string;
|
|
226
267
|
value?: string;
|
|
268
|
+
target?: EnvVarTarget;
|
|
227
269
|
isSecret?: boolean;
|
|
228
270
|
}
|
|
229
271
|
interface BulkSetEnvVarsInput {
|
|
230
|
-
|
|
272
|
+
vars: Array<{
|
|
231
273
|
key: string;
|
|
232
274
|
value: string;
|
|
275
|
+
target?: EnvVarTarget;
|
|
233
276
|
isSecret?: boolean;
|
|
234
277
|
}>;
|
|
235
278
|
}
|
|
@@ -512,6 +555,81 @@ declare class EnvVarsResource {
|
|
|
512
555
|
bulkSet(teamId: IdInput, serviceId: IdInput, data: BulkSetEnvVarsInput): Promise<void>;
|
|
513
556
|
}
|
|
514
557
|
|
|
558
|
+
type NotificationChannelType = 'slack' | 'discord' | 'email';
|
|
559
|
+
/**
|
|
560
|
+
* Events a notification channel can subscribe to. Source of truth is
|
|
561
|
+
* `packages/shared/src/schemas/notification-channel.ts:NOTIFICATION_CHANNEL_EVENTS`.
|
|
562
|
+
*/
|
|
563
|
+
type NotificationChannelEvent = 'deploy.started' | 'deploy.succeeded' | 'deploy.failed' | 'deploy.failed_consecutive' | 'service.created' | 'service.deleted' | 'service.suspended' | 'service.resumed' | 'service.restart_failed' | 'service.auto_suspended' | 'service.acme_cert_failed' | 'git.auth_failed';
|
|
564
|
+
interface NotificationChannel {
|
|
565
|
+
id: number;
|
|
566
|
+
teamId: number;
|
|
567
|
+
type: NotificationChannelType;
|
|
568
|
+
name: string;
|
|
569
|
+
/**
|
|
570
|
+
* Webhook URL (Slack/Discord) or email address. The list API masks
|
|
571
|
+
* the value for security — only the create/update calls round-trip
|
|
572
|
+
* the real URL.
|
|
573
|
+
*/
|
|
574
|
+
webhookUrl: string;
|
|
575
|
+
active: boolean;
|
|
576
|
+
events: NotificationChannelEvent[];
|
|
577
|
+
createdAt: string;
|
|
578
|
+
updatedAt: string;
|
|
579
|
+
}
|
|
580
|
+
declare class NotificationsResource {
|
|
581
|
+
private client;
|
|
582
|
+
constructor(client: HostStack);
|
|
583
|
+
/**
|
|
584
|
+
* List notification channels for the team. Webhook URLs are
|
|
585
|
+
* server-side masked in the response so this is safe to log.
|
|
586
|
+
*/
|
|
587
|
+
listChannels(teamId: IdInput): Promise<{
|
|
588
|
+
channels: NotificationChannel[];
|
|
589
|
+
}>;
|
|
590
|
+
/**
|
|
591
|
+
* Create a Slack/Discord/email notification channel.
|
|
592
|
+
*
|
|
593
|
+
* For type=email, `webhookUrl` is the recipient email address; for
|
|
594
|
+
* type=slack/discord it's the incoming webhook URL.
|
|
595
|
+
*
|
|
596
|
+
* `events` is the explicit subscription list — an empty array means
|
|
597
|
+
* "receive nothing". The platform pre-selects the critical-event
|
|
598
|
+
* set on the dashboard, but SDK callers must pass the list
|
|
599
|
+
* explicitly so behaviour is deterministic.
|
|
600
|
+
*/
|
|
601
|
+
createChannel(teamId: IdInput, data: {
|
|
602
|
+
type: NotificationChannelType;
|
|
603
|
+
name: string;
|
|
604
|
+
webhookUrl: string;
|
|
605
|
+
events: NotificationChannelEvent[];
|
|
606
|
+
}): Promise<{
|
|
607
|
+
channel: NotificationChannel;
|
|
608
|
+
}>;
|
|
609
|
+
/**
|
|
610
|
+
* Update a channel's name / active state / event subscriptions. The
|
|
611
|
+
* webhook URL and type are immutable — create a new channel if
|
|
612
|
+
* those need to change.
|
|
613
|
+
*/
|
|
614
|
+
updateChannel(teamId: IdInput, channelId: number, data: {
|
|
615
|
+
name?: string;
|
|
616
|
+
active?: boolean;
|
|
617
|
+
events?: NotificationChannelEvent[];
|
|
618
|
+
}): Promise<{
|
|
619
|
+
channel: NotificationChannel;
|
|
620
|
+
}>;
|
|
621
|
+
/** Delete a notification channel. */
|
|
622
|
+
deleteChannel(teamId: IdInput, channelId: number): Promise<void>;
|
|
623
|
+
/**
|
|
624
|
+
* Fire a test event to the channel so the user can confirm the
|
|
625
|
+
* webhook is wired correctly. Returns the dispatch outcome.
|
|
626
|
+
*/
|
|
627
|
+
testChannel(teamId: IdInput, channelId: number): Promise<{
|
|
628
|
+
success: boolean;
|
|
629
|
+
error?: string;
|
|
630
|
+
}>;
|
|
631
|
+
}
|
|
632
|
+
|
|
515
633
|
declare class ProjectsResource {
|
|
516
634
|
private client;
|
|
517
635
|
constructor(client: HostStack);
|
|
@@ -537,8 +655,13 @@ declare class ProjectsResource {
|
|
|
537
655
|
|
|
538
656
|
interface LogEntry$1 {
|
|
539
657
|
timestamp: string;
|
|
540
|
-
|
|
541
|
-
|
|
658
|
+
/**
|
|
659
|
+
* Parsed log level if the message is a structured JSON envelope
|
|
660
|
+
* (pino numeric, `{"level":"info"}`, or `{"severity":"WARNING"}`).
|
|
661
|
+
* `undefined` for plain-text logs.
|
|
662
|
+
*/
|
|
663
|
+
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | null;
|
|
664
|
+
stream?: 'stdout' | 'stderr' | null;
|
|
542
665
|
message: string;
|
|
543
666
|
}
|
|
544
667
|
interface StreamLogsOptions {
|
|
@@ -554,15 +677,30 @@ interface StreamLogsOptions {
|
|
|
554
677
|
|
|
555
678
|
interface LogEntry {
|
|
556
679
|
timestamp: string;
|
|
557
|
-
|
|
558
|
-
|
|
680
|
+
/**
|
|
681
|
+
* Parsed structured log level (pino numeric or string envelopes).
|
|
682
|
+
* `undefined` for plain-text logs.
|
|
683
|
+
*/
|
|
684
|
+
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | null;
|
|
685
|
+
stream?: 'stdout' | 'stderr' | null;
|
|
559
686
|
message: string;
|
|
560
687
|
}
|
|
561
688
|
declare class ServicesResource {
|
|
562
689
|
private client;
|
|
563
690
|
constructor(client: HostStack);
|
|
564
|
-
/**
|
|
565
|
-
|
|
691
|
+
/**
|
|
692
|
+
* List services for the active team.
|
|
693
|
+
*
|
|
694
|
+
* Optional filters narrow by project, environment, status, or type.
|
|
695
|
+
* The server treats unknown enum values as no match (returns empty)
|
|
696
|
+
* rather than 400-ing.
|
|
697
|
+
*/
|
|
698
|
+
list(teamId: IdInput, filters?: {
|
|
699
|
+
projectId?: number | string;
|
|
700
|
+
environmentId?: number | string;
|
|
701
|
+
status?: 'active' | 'deploying' | 'suspended' | 'failed' | 'not_deployed';
|
|
702
|
+
type?: 'web_service' | 'private_service' | 'worker' | 'cron_job' | 'static_site';
|
|
703
|
+
}): Promise<{
|
|
566
704
|
services: Service[];
|
|
567
705
|
}>;
|
|
568
706
|
/** Get a single service by ID. */
|
|
@@ -587,6 +725,27 @@ declare class ServicesResource {
|
|
|
587
725
|
getMetrics(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
588
726
|
metrics: ServiceMetrics;
|
|
589
727
|
}>;
|
|
728
|
+
/**
|
|
729
|
+
* Get a metrics time series for a service.
|
|
730
|
+
*
|
|
731
|
+
* `from`/`to` accept ISO-8601 timestamps. Omit both for the trailing
|
|
732
|
+
* hour. Server picks the resolution: raw samples ≤7d, hourly pre-
|
|
733
|
+
* aggregates ≤30d, daily beyond that. Up to ~500 points returned.
|
|
734
|
+
*/
|
|
735
|
+
getMetricsHistory(teamId: IdInput, serviceId: IdInput, options?: {
|
|
736
|
+
from?: string;
|
|
737
|
+
to?: string;
|
|
738
|
+
}): Promise<{
|
|
739
|
+
history: Array<{
|
|
740
|
+
timestamp: string;
|
|
741
|
+
cpuPercent: number;
|
|
742
|
+
memoryUsedMb: number;
|
|
743
|
+
memoryLimitMb: number;
|
|
744
|
+
networkRxBytes: number;
|
|
745
|
+
networkTxBytes: number;
|
|
746
|
+
diskUsedMb: number;
|
|
747
|
+
}>;
|
|
748
|
+
}>;
|
|
590
749
|
/** Get service configuration. */
|
|
591
750
|
getConfig(teamId: IdInput, serviceId: IdInput): Promise<{
|
|
592
751
|
config: ServiceConfig;
|
|
@@ -612,7 +771,7 @@ declare class ServicesResource {
|
|
|
612
771
|
since?: string;
|
|
613
772
|
until?: string;
|
|
614
773
|
stream?: 'stdout' | 'stderr';
|
|
615
|
-
level?: 'stdout' | 'stderr' | 'info' | 'warn' | 'error' | '
|
|
774
|
+
level?: 'stdout' | 'stderr' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
616
775
|
search?: string;
|
|
617
776
|
grep?: string;
|
|
618
777
|
countOnly?: boolean;
|
|
@@ -747,6 +906,12 @@ declare class HostStack {
|
|
|
747
906
|
readonly cron: CronResource;
|
|
748
907
|
/** Manage persistent disks attached to services. */
|
|
749
908
|
readonly volumes: VolumesResource;
|
|
909
|
+
/**
|
|
910
|
+
* Manage notification channels — Slack/Discord webhooks + email
|
|
911
|
+
* recipients with per-channel event filters. Used for deploy
|
|
912
|
+
* failures, restart loops, ACME failures, git auth losses, etc.
|
|
913
|
+
*/
|
|
914
|
+
readonly notifications: NotificationsResource;
|
|
750
915
|
constructor(options: HostStackOptions);
|
|
751
916
|
/**
|
|
752
917
|
* Make an authenticated request to the HostStack API.
|
|
@@ -810,4 +975,4 @@ declare function buildPaginationQuery(params?: PaginationParams): string;
|
|
|
810
975
|
*/
|
|
811
976
|
declare function wrapArray<T>(items: T[], params?: PaginationParams): PaginatedResponse<T>;
|
|
812
977
|
|
|
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 };
|
|
978
|
+
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 DeployListResponse, type DeployLogEntry, type Domain, type EnvVar, type Environment, HostStack, HostStackError, type HostStackOptions, 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 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 };
|