@stacksjs/ts-cloud 0.7.108 → 0.7.110

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.
Files changed (135) hide show
  1. package/dist/alerts/delivery.d.ts +10 -0
  2. package/dist/alerts/model.d.ts +1 -1
  3. package/dist/api/client.d.ts +53 -0
  4. package/dist/api/handler.d.ts +10 -0
  5. package/dist/api/service.d.ts +1 -0
  6. package/dist/aws/index.js +10 -10
  7. package/dist/aws/lambda.d.ts +19 -0
  8. package/dist/bin/cli.js +1520 -1204
  9. package/dist/bin/dashboard-server.js +935 -621
  10. package/dist/chunk-19bs955w.js +12203 -0
  11. package/dist/{chunk-fmt40tpw.js → chunk-53jatzaw.js} +2 -2
  12. package/dist/{chunk-ef2dwfrg.js → chunk-8kh577qh.js} +5 -5
  13. package/dist/{chunk-s9c2x5jv.js → chunk-9v2pwxv9.js} +2 -2
  14. package/dist/chunk-aa2dkn7b.js +205 -0
  15. package/dist/{chunk-33sy72r8.js → chunk-d3vx2ekv.js} +71 -25
  16. package/dist/chunk-d48vtdj4.js +433 -0
  17. package/dist/{chunk-c6db5m63.js → chunk-t2s3gdq6.js} +253 -8
  18. package/dist/chunk-va2yd85b.js +200 -0
  19. package/dist/{chunk-3g4r09dd.js → chunk-wmbep3b5.js} +1 -1
  20. package/dist/{chunk-eg8ck25v.js → chunk-wmz8x3cy.js} +6935 -15274
  21. package/dist/{chunk-ybcz6sxc.js → chunk-x6yzgv7y.js} +33 -0
  22. package/dist/control-plane/types.d.ts +1 -1
  23. package/dist/deploy/dashboard-protection.test.d.ts +1 -0
  24. package/dist/deploy/dashboard-spend.test.d.ts +1 -0
  25. package/dist/deploy/index.js +11 -8
  26. package/dist/deploy/local-dashboard-server.d.ts +2 -0
  27. package/dist/drivers/index.js +4 -2
  28. package/dist/drivers/shared/protection.d.ts +43 -0
  29. package/dist/drivers/shared/protection.test.d.ts +1 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +364 -102
  32. package/dist/protection/controls.d.ts +127 -0
  33. package/dist/protection/controls.test.d.ts +1 -0
  34. package/dist/protection/ddos.d.ts +130 -0
  35. package/dist/protection/ddos.test.d.ts +1 -0
  36. package/dist/protection/index.d.ts +11 -0
  37. package/dist/protection/index.js +89 -0
  38. package/dist/protection/ratelimit.d.ts +154 -0
  39. package/dist/protection/ratelimit.test.d.ts +1 -0
  40. package/dist/protection/waf.d.ts +143 -0
  41. package/dist/protection/waf.test.d.ts +1 -0
  42. package/dist/spend/anomaly-config.d.ts +130 -0
  43. package/dist/spend/anomaly-config.test.d.ts +1 -0
  44. package/dist/spend/anomaly.d.ts +114 -0
  45. package/dist/spend/anomaly.test.d.ts +1 -0
  46. package/dist/spend/api.d.ts +42 -0
  47. package/dist/spend/api.test.d.ts +1 -0
  48. package/dist/spend/appliers.d.ts +126 -0
  49. package/dist/spend/docs.test.d.ts +1 -0
  50. package/dist/spend/enforcement.d.ts +111 -0
  51. package/dist/spend/enforcement.integration.test.d.ts +1 -0
  52. package/dist/spend/evaluator.d.ts +70 -0
  53. package/dist/spend/evaluator.test.d.ts +1 -0
  54. package/dist/spend/focus.d.ts +93 -0
  55. package/dist/spend/focus.test.d.ts +1 -0
  56. package/dist/spend/gate.d.ts +96 -0
  57. package/dist/spend/index.d.ts +20 -0
  58. package/dist/spend/index.js +173 -0
  59. package/dist/spend/lease.d.ts +54 -0
  60. package/dist/spend/lease.test.d.ts +1 -0
  61. package/dist/spend/meter.d.ts +70 -0
  62. package/dist/spend/meter.test.d.ts +1 -0
  63. package/dist/spend/model.d.ts +228 -0
  64. package/dist/spend/notifications.d.ts +58 -0
  65. package/dist/spend/pricing.d.ts +109 -0
  66. package/dist/spend/pricing.test.d.ts +1 -0
  67. package/dist/spend/projection.d.ts +36 -0
  68. package/dist/spend/runner.d.ts +130 -0
  69. package/dist/spend/service.d.ts +129 -0
  70. package/dist/spend/signals.d.ts +131 -0
  71. package/dist/spend/signals.test.d.ts +1 -0
  72. package/dist/spend/sms-sdk.test.d.ts +1 -0
  73. package/dist/spend/spend.integration.test.d.ts +1 -0
  74. package/dist/spend/store.d.ts +166 -0
  75. package/dist/spend/transports.d.ts +169 -0
  76. package/dist/spend/transports.test.d.ts +1 -0
  77. package/dist/spend/window.d.ts +52 -0
  78. package/dist/spend/window.test.d.ts +1 -0
  79. package/dist/ui/404.html +1 -0
  80. package/dist/ui/access-denied.html +1 -1
  81. package/dist/ui/account/automation.html +3 -3
  82. package/dist/ui/account/security.html +2 -2
  83. package/dist/ui/applications/compose.html +4 -4
  84. package/dist/ui/applications/new.html +2 -2
  85. package/dist/ui/data/backups.html +4 -4
  86. package/dist/ui/data/services.html +4 -4
  87. package/dist/ui/data/volumes.html +4 -4
  88. package/dist/ui/index.html +4 -4
  89. package/dist/ui/infrastructure/topology.html +4 -4
  90. package/dist/ui/integrations.html +2 -2
  91. package/dist/ui/operations/alerts.html +4 -4
  92. package/dist/ui/operations/configuration.html +4 -4
  93. package/dist/ui/operations/jobs.html +3 -3
  94. package/dist/ui/operations/maintenance.html +4 -4
  95. package/dist/ui/operations/observability.html +4 -4
  96. package/dist/ui/operations/previews.html +4 -4
  97. package/dist/ui/operations/queue.html +3 -3
  98. package/dist/ui/operations/regions.html +4 -4
  99. package/dist/ui/operations/releases.html +4 -4
  100. package/dist/ui/operations/spend.html +1634 -0
  101. package/dist/ui/operations/workloads.html +4 -4
  102. package/dist/ui/security.html +2 -2
  103. package/dist/ui/server/actions.html +4 -4
  104. package/dist/ui/server/activity.html +2 -2
  105. package/dist/ui/server/capacity.html +4 -4
  106. package/dist/ui/server/database.html +4 -4
  107. package/dist/ui/server/deployments.html +4 -4
  108. package/dist/ui/server/diagnostics.html +2 -2
  109. package/dist/ui/server/firewall.html +100 -161
  110. package/dist/ui/server/fleet.html +4 -4
  111. package/dist/ui/server/logs.html +4 -4
  112. package/dist/ui/server/metrics.html +4 -4
  113. package/dist/ui/server/security.html +2 -2
  114. package/dist/ui/server/services.html +2 -2
  115. package/dist/ui/server/sites.html +4 -4
  116. package/dist/ui/server/ssh-keys.html +4 -4
  117. package/dist/ui/server/team.html +4 -4
  118. package/dist/ui/server/terminal.html +2 -2
  119. package/dist/ui/serverless/alarms.html +4 -4
  120. package/dist/ui/serverless/assets.html +2 -2
  121. package/dist/ui/serverless/cost.html +2 -2
  122. package/dist/ui/serverless/data.html +4 -4
  123. package/dist/ui/serverless/deployments.html +1 -1
  124. package/dist/ui/serverless/firewall.html +2 -2
  125. package/dist/ui/serverless/functions.html +4 -4
  126. package/dist/ui/serverless/logs.html +4 -4
  127. package/dist/ui/serverless/metrics.html +2 -2
  128. package/dist/ui/serverless/queues.html +4 -4
  129. package/dist/ui/serverless/secrets.html +4 -4
  130. package/dist/ui/serverless/traces.html +4 -4
  131. package/dist/ui/serverless.html +3 -3
  132. package/dist/ui-src/pages/operations/spend.stx +225 -0
  133. package/dist/ui-src/pages/partials/nav.stx +2 -0
  134. package/dist/ui-src/pages/server/firewall.stx +89 -0
  135. package/package.json +11 -3
@@ -15,6 +15,15 @@ export type NotificationEmail = (input: {
15
15
  subject: string;
16
16
  text: string;
17
17
  }) => Promise<unknown>;
18
+ /**
19
+ * Send one SMS. Injected rather than imported so the router stays testable and
20
+ * so a deployment that does not use SMS pays nothing for it.
21
+ */
22
+ export type NotificationSms = (input: {
23
+ to: string;
24
+ from?: string;
25
+ text: string;
26
+ }) => Promise<unknown>;
18
27
  export declare function isQuietHours(route: NotificationRoute, at: Date): boolean;
19
28
  export declare class NotificationRouter {
20
29
  private readonly store;
@@ -23,6 +32,7 @@ export declare class NotificationRouter {
23
32
  constructor(store: AlertStore, options?: {
24
33
  fetchImpl?: NotificationFetch;
25
34
  emailImpl?: NotificationEmail;
35
+ smsImpl?: NotificationSms;
26
36
  now?: () => Date;
27
37
  });
28
38
  private now;
@@ -3,7 +3,7 @@ export type HealthCheckKind = 'http' | 'tcp' | 'command';
3
3
  export type HealthStatus = 'healthy' | 'unhealthy' | 'no_data';
4
4
  export type AlertState = 'pending' | 'firing' | 'resolved' | 'silenced';
5
5
  export type AlertSeverity = 'info' | 'warning' | 'critical';
6
- export type NotificationChannelKind = 'slack' | 'discord' | 'teams' | 'telegram' | 'email' | 'webhook';
6
+ export type NotificationChannelKind = 'slack' | 'discord' | 'teams' | 'telegram' | 'email' | 'webhook' | 'sms';
7
7
  export interface HealthCheck {
8
8
  id: string;
9
9
  projectId: string;
@@ -194,4 +194,57 @@ export declare class TsCloudClient {
194
194
  operation: ApiOperationResponse['operation'];
195
195
  requestId: string;
196
196
  }>;
197
+ /**
198
+ * Current usage, cost, and budget headroom.
199
+ *
200
+ * The call a pipeline makes before doing something expensive. Every budget
201
+ * carries `remainingCents`, `projectedCents`, and `projectionConfidence`, so
202
+ * the caller can decide rather than guess.
203
+ */
204
+ usage(options?: {
205
+ projectId?: string;
206
+ environmentId?: string;
207
+ period?: 'daily' | 'weekly' | 'monthly';
208
+ timezone?: string;
209
+ }): Promise<Record<string, unknown>>;
210
+ /** Itemized hourly usage rollups for a window. */
211
+ usageRollups(options: {
212
+ from: string;
213
+ to: string;
214
+ projectId?: string;
215
+ environmentId?: string;
216
+ meters?: string[];
217
+ limit?: number;
218
+ }): Promise<{
219
+ data: Array<Record<string, unknown>>;
220
+ }>;
221
+ /**
222
+ * Whether an operation is allowed under current spend enforcement.
223
+ *
224
+ * One boolean and a reason, deliberately - the caller is a script deciding
225
+ * whether to continue, not a dashboard rendering a page.
226
+ */
227
+ allowance(operation?: 'build' | 'deploy' | 'function_invoke' | 'request', options?: {
228
+ projectId?: string;
229
+ environmentId?: string;
230
+ }): Promise<{
231
+ allowed: boolean;
232
+ blockedBy: string | null;
233
+ reason: string | null;
234
+ }>;
235
+ /** Budgets governing a scope. */
236
+ budgets(options?: {
237
+ projectId?: string;
238
+ environmentId?: string;
239
+ }): Promise<{
240
+ data: Array<Record<string, unknown>>;
241
+ }>;
242
+ /** Detected spend anomalies. */
243
+ anomalies(options?: {
244
+ projectId?: string;
245
+ since?: string;
246
+ unacknowledged?: boolean;
247
+ }): Promise<{
248
+ data: Array<Record<string, unknown>>;
249
+ }>;
197
250
  }
@@ -2,6 +2,7 @@ import type { AutomationIdentityStore } from '../automation';
2
2
  import type { ControlPlaneStore } from '../control-plane';
3
3
  import type { ApplicationArtifactStore, ApplicationDraftStore, RegistryConnectionStore } from '../onboarding';
4
4
  import type { SourceConnectionStore } from '../source';
5
+ import { SpendService, SpendStore } from '../spend';
5
6
  interface ApiV1HandlerOptions {
6
7
  controlPlane: ControlPlaneStore;
7
8
  identities: AutomationIdentityStore;
@@ -13,6 +14,15 @@ interface ApiV1HandlerOptions {
13
14
  };
14
15
  now?: () => Date;
15
16
  rateLimit?: number;
17
+ /**
18
+ * Spend management. Supplied by default from the control plane, so the
19
+ * billing endpoints work without extra wiring; pass one to share a store
20
+ * (and therefore a counter tracker) with a running evaluation loop.
21
+ */
22
+ spend?: {
23
+ store: SpendStore;
24
+ service: SpendService;
25
+ };
16
26
  }
17
27
  export declare function createApiV1Handler(options: ApiV1HandlerOptions): (request: Request, networkHint?: string) => Promise<Response | undefined>;
18
28
  export {};
@@ -12,6 +12,7 @@ export declare class AutomationApiService {
12
12
  private readonly controlPlane;
13
13
  private readonly identities;
14
14
  private readonly queue;
15
+ private readonly spendGate;
15
16
  constructor(controlPlane: ControlPlaneStore, identities: AutomationIdentityStore);
16
17
  target(principal: ApiTokenPrincipal, requested: AuthorizationScope): AuthorizationTarget;
17
18
  authorize(principal: ApiTokenPrincipal, capability: AuthorizationCapability, requested: AuthorizationScope): AuthorizationTarget;
package/dist/aws/index.js CHANGED
@@ -86,7 +86,13 @@ import {
86
86
  trackEvent,
87
87
  translate,
88
88
  translateToMultiple
89
- } from "../chunk-ybcz6sxc.js";
89
+ } from "../chunk-x6yzgv7y.js";
90
+ import {
91
+ EmailClient,
92
+ IAMClient,
93
+ SESClient,
94
+ email
95
+ } from "../chunk-hpv68b4a.js";
90
96
  import {
91
97
  CloudFrontClient
92
98
  } from "../chunk-01d86gt1.js";
@@ -112,6 +118,9 @@ import {
112
118
  detectDnsProvider,
113
119
  dnsProviders
114
120
  } from "../chunk-gttvakpv.js";
121
+ import {
122
+ Route53Client
123
+ } from "../chunk-32e7ya18.js";
115
124
  import {
116
125
  EC2Client,
117
126
  SSMClient
@@ -119,15 +128,6 @@ import {
119
128
  import {
120
129
  CloudFormationClient
121
130
  } from "../chunk-4cjrg98a.js";
122
- import {
123
- EmailClient,
124
- IAMClient,
125
- SESClient,
126
- email
127
- } from "../chunk-hpv68b4a.js";
128
- import {
129
- Route53Client
130
- } from "../chunk-32e7ya18.js";
131
131
  import {
132
132
  S3Client
133
133
  } from "../chunk-wj3s95p9.js";
@@ -217,6 +217,25 @@ export declare class LambdaClient {
217
217
  Status?: string;
218
218
  RequestedProvisionedConcurrentExecutions?: number;
219
219
  }>;
220
+ /**
221
+ * Read the reserved-concurrency limit. Returns null when none is set.
222
+ *
223
+ * Reserved concurrency is not the same as provisioned concurrency above: it
224
+ * is a ceiling on how many executions may run at once, and setting it to 0 is
225
+ * the supported way to stop a function being invoked at all without deleting
226
+ * it or breaking its triggers.
227
+ */
228
+ getFunctionConcurrency(functionName: string): Promise<number | null>;
229
+ /**
230
+ * Set the reserved-concurrency ceiling.
231
+ *
232
+ * Zero throttles every invocation: the trigger still fires, Lambda rejects it,
233
+ * and nothing runs. That is reversible in one call, which is what makes it
234
+ * usable as a spend cap rather than a deletion.
235
+ */
236
+ putFunctionConcurrency(functionName: string, reservedConcurrentExecutions: number): Promise<void>;
237
+ /** Remove the reserved-concurrency ceiling, returning the function to the account pool. */
238
+ deleteFunctionConcurrency(functionName: string): Promise<void>;
220
239
  /** Remove a provisioned-concurrency config from a function version/alias. */
221
240
  deleteProvisionedConcurrencyConfig(functionName: string, qualifier: string): Promise<void>;
222
241
  /**