@stacksjs/ts-cloud 0.7.105 → 0.7.109

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 (149) 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 +1677 -1370
  9. package/dist/bin/dashboard-server.js +926 -620
  10. package/dist/{chunk-fmt40tpw.js → chunk-53jatzaw.js} +2 -2
  11. package/dist/{chunk-ef2dwfrg.js → chunk-8kh577qh.js} +5 -5
  12. package/dist/{chunk-s9c2x5jv.js → chunk-9v2pwxv9.js} +2 -2
  13. package/dist/chunk-aa2dkn7b.js +205 -0
  14. package/dist/{chunk-vkd2y0fs.js → chunk-cktwk9hy.js} +7169 -14800
  15. package/dist/{chunk-dmzez5f8.js → chunk-d3vx2ekv.js} +123 -28
  16. package/dist/chunk-grx1rp09.js +12163 -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-ybcz6sxc.js → chunk-x6yzgv7y.js} +33 -0
  21. package/dist/chunk-xrtwv3v2.js +420 -0
  22. package/dist/control-plane/types.d.ts +1 -1
  23. package/dist/deploy/dashboard-bundle-encoding.test.d.ts +1 -0
  24. package/dist/deploy/dashboard-payload.d.ts +20 -0
  25. package/dist/deploy/dashboard-payload.test.d.ts +1 -0
  26. package/dist/deploy/dashboard-protection.test.d.ts +1 -0
  27. package/dist/deploy/dashboard-spend.test.d.ts +1 -0
  28. package/dist/deploy/dashboard-topology.d.ts +85 -0
  29. package/dist/deploy/dashboard-topology.test.d.ts +1 -0
  30. package/dist/deploy/egress-collection.d.ts +60 -0
  31. package/dist/deploy/index.d.ts +2 -0
  32. package/dist/deploy/index.js +23 -8
  33. package/dist/deploy/local-dashboard-server.d.ts +2 -0
  34. package/dist/drivers/index.js +4 -2
  35. package/dist/drivers/shared/protection.d.ts +43 -0
  36. package/dist/drivers/shared/protection.test.d.ts +1 -0
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.js +364 -102
  39. package/dist/protection/controls.d.ts +113 -0
  40. package/dist/protection/controls.test.d.ts +1 -0
  41. package/dist/protection/ddos.d.ts +130 -0
  42. package/dist/protection/ddos.test.d.ts +1 -0
  43. package/dist/protection/index.d.ts +11 -0
  44. package/dist/protection/index.js +87 -0
  45. package/dist/protection/ratelimit.d.ts +154 -0
  46. package/dist/protection/ratelimit.test.d.ts +1 -0
  47. package/dist/protection/waf.d.ts +143 -0
  48. package/dist/protection/waf.test.d.ts +1 -0
  49. package/dist/spend/anomaly-config.d.ts +130 -0
  50. package/dist/spend/anomaly-config.test.d.ts +1 -0
  51. package/dist/spend/anomaly.d.ts +114 -0
  52. package/dist/spend/anomaly.test.d.ts +1 -0
  53. package/dist/spend/api.d.ts +42 -0
  54. package/dist/spend/api.test.d.ts +1 -0
  55. package/dist/spend/appliers.d.ts +126 -0
  56. package/dist/spend/docs.test.d.ts +1 -0
  57. package/dist/spend/enforcement.d.ts +111 -0
  58. package/dist/spend/enforcement.integration.test.d.ts +1 -0
  59. package/dist/spend/evaluator.d.ts +70 -0
  60. package/dist/spend/evaluator.test.d.ts +1 -0
  61. package/dist/spend/focus.d.ts +93 -0
  62. package/dist/spend/focus.test.d.ts +1 -0
  63. package/dist/spend/gate.d.ts +96 -0
  64. package/dist/spend/index.d.ts +20 -0
  65. package/dist/spend/index.js +173 -0
  66. package/dist/spend/lease.d.ts +54 -0
  67. package/dist/spend/lease.test.d.ts +1 -0
  68. package/dist/spend/meter.d.ts +70 -0
  69. package/dist/spend/meter.test.d.ts +1 -0
  70. package/dist/spend/model.d.ts +228 -0
  71. package/dist/spend/notifications.d.ts +58 -0
  72. package/dist/spend/pricing.d.ts +109 -0
  73. package/dist/spend/pricing.test.d.ts +1 -0
  74. package/dist/spend/projection.d.ts +36 -0
  75. package/dist/spend/runner.d.ts +130 -0
  76. package/dist/spend/service.d.ts +129 -0
  77. package/dist/spend/signals.d.ts +110 -0
  78. package/dist/spend/signals.test.d.ts +1 -0
  79. package/dist/spend/sms-sdk.test.d.ts +1 -0
  80. package/dist/spend/spend.integration.test.d.ts +1 -0
  81. package/dist/spend/store.d.ts +166 -0
  82. package/dist/spend/transports.d.ts +169 -0
  83. package/dist/spend/transports.test.d.ts +1 -0
  84. package/dist/spend/window.d.ts +52 -0
  85. package/dist/spend/window.test.d.ts +1 -0
  86. package/dist/ui/404.html +2 -0
  87. package/dist/ui/access-denied.html +2 -2
  88. package/dist/ui/account/automation.html +4 -4
  89. package/dist/ui/account/security.html +2 -2
  90. package/dist/ui/applications/compose.html +4 -4
  91. package/dist/ui/applications/new.html +2 -2
  92. package/dist/ui/data/backups.html +22 -9
  93. package/dist/ui/data/services.html +22 -9
  94. package/dist/ui/data/volumes.html +22 -9
  95. package/dist/ui/index.html +22 -9
  96. package/dist/ui/infrastructure/topology.html +2223 -0
  97. package/dist/ui/integrations.html +2 -2
  98. package/dist/ui/operations/alerts.html +22 -9
  99. package/dist/ui/operations/configuration.html +4 -4
  100. package/dist/ui/operations/jobs.html +22 -9
  101. package/dist/ui/operations/maintenance.html +4 -4
  102. package/dist/ui/operations/observability.html +22 -9
  103. package/dist/ui/operations/previews.html +4 -4
  104. package/dist/ui/operations/queue.html +4 -4
  105. package/dist/ui/operations/regions.html +3 -3
  106. package/dist/ui/operations/releases.html +3 -3
  107. package/dist/ui/operations/spend.html +1634 -0
  108. package/dist/ui/operations/workloads.html +22 -9
  109. package/dist/ui/security.html +2 -2
  110. package/dist/ui/server/actions.html +4 -4
  111. package/dist/ui/server/activity.html +2 -2
  112. package/dist/ui/server/capacity.html +4 -4
  113. package/dist/ui/server/database.html +4 -4
  114. package/dist/ui/server/deployments.html +4 -4
  115. package/dist/ui/server/diagnostics.html +2 -2
  116. package/dist/ui/server/firewall.html +100 -161
  117. package/dist/ui/server/fleet.html +22 -9
  118. package/dist/ui/server/logs.html +22 -9
  119. package/dist/ui/server/metrics.html +130 -14
  120. package/dist/ui/server/security.html +2 -2
  121. package/dist/ui/server/services.html +1 -1
  122. package/dist/ui/server/sites.html +22 -9
  123. package/dist/ui/server/ssh-keys.html +3 -3
  124. package/dist/ui/server/team.html +4 -4
  125. package/dist/ui/server/terminal.html +2 -2
  126. package/dist/ui/serverless/alarms.html +4 -4
  127. package/dist/ui/serverless/assets.html +2 -2
  128. package/dist/ui/serverless/cost.html +2 -2
  129. package/dist/ui/serverless/data.html +4 -4
  130. package/dist/ui/serverless/deployments.html +2 -2
  131. package/dist/ui/serverless/firewall.html +2 -2
  132. package/dist/ui/serverless/functions.html +4 -4
  133. package/dist/ui/serverless/logs.html +22 -9
  134. package/dist/ui/serverless/metrics.html +2 -2
  135. package/dist/ui/serverless/queues.html +4 -4
  136. package/dist/ui/serverless/secrets.html +4 -4
  137. package/dist/ui/serverless/traces.html +4 -4
  138. package/dist/ui/serverless.html +4 -4
  139. package/dist/ui-src/functions/requestJson.ts +41 -0
  140. package/dist/ui-src/functions/useOpConfirm.ts +132 -0
  141. package/dist/ui-src/functions/usePolling.ts +98 -0
  142. package/dist/ui-src/functions/useTerminal.ts +79 -0
  143. package/dist/ui-src/pages/infrastructure/topology.stx +517 -0
  144. package/dist/ui-src/pages/operations/spend.stx +225 -0
  145. package/dist/ui-src/pages/partials/nav.stx +4 -0
  146. package/dist/ui-src/pages/server/firewall.stx +89 -0
  147. package/dist/ui-src/pages/server/metrics.stx +140 -6
  148. package/dist/ui-src/src/topology.ts +485 -0
  149. package/package.json +11 -3
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  buildAndPushContainerImage,
3
3
  buildFunctionEnv,
4
+ buildServerTopology,
5
+ buildServerlessTopology,
6
+ buildTopology,
7
+ collectEgressMetrics,
4
8
  createContainerImageDependencies,
5
9
  createExistingStaticFullStackDependencies,
6
10
  createStaticApiOriginDependencies,
@@ -10,9 +14,11 @@ import {
10
14
  deployServerlessApp,
11
15
  deploySite,
12
16
  deployStaticApiOrigin,
17
+ egressReportMetrics,
13
18
  ensureDashboardActor,
14
19
  estimateExistingStaticFullStackMonthlyCost,
15
20
  estimateStaticApiOriginMonthlyCost,
21
+ fetchEgressReport,
16
22
  generateExistingStaticFullStackTemplate,
17
23
  hashContainerContext,
18
24
  infraEnvFromOutputs,
@@ -30,7 +36,7 @@ import {
30
36
  synchronizeDashboardUsers,
31
37
  trackDashboardOperation,
32
38
  verifyStaticApiOrigin
33
- } from "../chunk-vkd2y0fs.js";
39
+ } from "../chunk-cktwk9hy.js";
34
40
  import {
35
41
  deleteStaticSite,
36
42
  deployStaticSite,
@@ -41,15 +47,17 @@ import {
41
47
  generateStaticSiteTemplate,
42
48
  invalidateCache,
43
49
  uploadStaticFiles
44
- } from "../chunk-ef2dwfrg.js";
50
+ } from "../chunk-8kh577qh.js";
45
51
  import {
46
52
  buildAndPushServerlessImage
47
- } from "../chunk-3g4r09dd.js";
48
- import"../chunk-ybcz6sxc.js";
53
+ } from "../chunk-wmbep3b5.js";
54
+ import"../chunk-x6yzgv7y.js";
55
+ import"../chunk-hpv68b4a.js";
49
56
  import"../chunk-01d86gt1.js";
50
57
  import"../chunk-50jpda9q.js";
51
58
  import"../chunk-he9a874b.js";
52
59
  import"../chunk-gttvakpv.js";
60
+ import"../chunk-32e7ya18.js";
53
61
  import {
54
62
  IPV6_EXCLUDED_HOST_LABELS,
55
63
  MANAGEMENT_DASHBOARD_SITE,
@@ -70,14 +78,15 @@ import {
70
78
  siteInstallBase,
71
79
  validateDeploymentConfig,
72
80
  verifyAddressRecord
73
- } from "../chunk-dmzez5f8.js";
74
- import"../chunk-c6db5m63.js";
81
+ } from "../chunk-d3vx2ekv.js";
75
82
  import"../chunk-7m60qnc8.js";
76
83
  import"../chunk-4cjrg98a.js";
77
- import"../chunk-hpv68b4a.js";
78
- import"../chunk-32e7ya18.js";
79
84
  import"../chunk-wj3s95p9.js";
80
85
  import"../chunk-zqtpg06c.js";
86
+ import"../chunk-grx1rp09.js";
87
+ import"../chunk-va2yd85b.js";
88
+ import"../chunk-aa2dkn7b.js";
89
+ import"../chunk-t2s3gdq6.js";
81
90
  import"../chunk-v0bahtg2.js";
82
91
  export {
83
92
  verifyStaticApiOrigin,
@@ -114,10 +123,12 @@ export {
114
123
  generateStaticSiteTemplate,
115
124
  generateExternalDnsStaticSiteTemplate,
116
125
  generateExistingStaticFullStackTemplate,
126
+ fetchEgressReport,
117
127
  estimateStaticApiOriginMonthlyCost,
118
128
  estimateExistingStaticFullStackMonthlyCost,
119
129
  ensureManagementDashboard,
120
130
  ensureDashboardActor,
131
+ egressReportMetrics,
121
132
  deployStaticSiteWithExternalDnsFull,
122
133
  deployStaticSiteWithExternalDns,
123
134
  deployStaticSiteFull,
@@ -134,6 +145,10 @@ export {
134
145
  createExistingStaticFullStackDependencies,
135
146
  createContainerImageDependencies,
136
147
  collectServerDnsDomains,
148
+ collectEgressMetrics,
149
+ buildTopology,
150
+ buildServerlessTopology,
151
+ buildServerTopology,
137
152
  buildManagementDashboardArtifact,
138
153
  buildFunctionEnv,
139
154
  buildAndPushServerlessImage,
@@ -22,6 +22,8 @@ export interface LocalDashboardServerOptions {
22
22
  oidcFetch?: OidcFetch;
23
23
  /** Run the persistent deployment worker in this process. Defaults off in tests. */
24
24
  queueWorker?: boolean;
25
+ /** Evaluate spend budgets on a timer. Off in tests, like the queue worker. */
26
+ spendLoop?: boolean;
25
27
  /** Maximum number of operations this process may execute in parallel. */
26
28
  queueParallelism?: number;
27
29
  /** Resolve the provider-specific immutable activation primitive for release jobs. */
@@ -68,12 +68,14 @@ import {
68
68
  waitForSsh,
69
69
  wrapCloudInitUserData,
70
70
  writeResizeCheckpoint
71
- } from "../chunk-dmzez5f8.js";
72
- import"../chunk-c6db5m63.js";
71
+ } from "../chunk-d3vx2ekv.js";
73
72
  import"../chunk-7m60qnc8.js";
74
73
  import"../chunk-4cjrg98a.js";
75
74
  import"../chunk-wj3s95p9.js";
76
75
  import"../chunk-zqtpg06c.js";
76
+ import"../chunk-va2yd85b.js";
77
+ import"../chunk-aa2dkn7b.js";
78
+ import"../chunk-t2s3gdq6.js";
77
79
  import"../chunk-v0bahtg2.js";
78
80
  export {
79
81
  writeResizeCheckpoint,
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Edge protection at provision time.
3
+ *
4
+ * UFW (see `ufw.ts`) decides which ports are open. This decides what happens to
5
+ * the traffic that arrives on them: kernel-level flood mitigation, and the WAF.
6
+ *
7
+ * Both are **on by default**. A protection that has to be switched on protects
8
+ * only the people who already knew they needed it, which is never the box that
9
+ * gets hit. The escape hatches are explicit (`ddos: false`, `waf: false`) and
10
+ * the WAF starts in detection-only, so the default posture is "see everything,
11
+ * block only floods".
12
+ */
13
+ import type { DdosConfig } from '../../protection/ddos';
14
+ import type { WafConfig } from '../../protection/waf';
15
+ /** `true` for defaults, `false` to skip, or an object to tune. */
16
+ export type ProtectionSetting<T> = boolean | T | undefined;
17
+ /** L3/L4 defaults: protect the web ports, count-and-drop, ten-minute bans. */
18
+ export declare const DEFAULT_COMPUTE_DDOS: DdosConfig;
19
+ /**
20
+ * WAF defaults: paranoia 1, detection only.
21
+ *
22
+ * Detection rather than blocking because zig-waf is pre-alpha and because a
23
+ * ruleset nobody has read their own logs against will block real traffic. The
24
+ * operator promotes it once they have looked.
25
+ */
26
+ export declare const DEFAULT_COMPUTE_WAF: WafConfig;
27
+ /** Kernel-level flood mitigation. Returns no lines when disabled. */
28
+ export declare function buildDdosScript(setting?: ProtectionSetting<DdosConfig>, extraPorts?: number[]): string[];
29
+ /** WAF configuration. Returns no lines when disabled or when the binary is absent. */
30
+ export declare function buildWafScript(setting?: ProtectionSetting<WafConfig>): string[];
31
+ export interface ComputeProtectionConfig {
32
+ ddos?: ProtectionSetting<DdosConfig>;
33
+ waf?: ProtectionSetting<WafConfig>;
34
+ }
35
+ /**
36
+ * Both layers, in order: kernel first, then application.
37
+ *
38
+ * Order matters on a box that is already being hit. The packet filter costs
39
+ * nothing per request and starts dropping immediately; the WAF has to parse
40
+ * every request it inspects, so bringing it up first would spend CPU on
41
+ * traffic the kernel was about to discard anyway.
42
+ */
43
+ export declare function buildProtectionScript(protection?: ComputeProtectionConfig, extraPorts?: number[]): string[];
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -9,6 +9,9 @@ export * from './compose';
9
9
  export * from './release';
10
10
  export * from './runtime';
11
11
  export * from './telemetry';
12
+ export * from './spend';
13
+ export { applyControlsToDdos, applyControlsToRateLimits, applyMitigationFactor, DEFAULT_ATTACK_MODE_HOURS, defaultRateLimitRules, describePosture, MAX_CONTROL_HOURS, ProtectionControlStore, DEFAULT_DDOS_THRESHOLDS, DEFAULT_RECURSION_LIMITS, escapeSecLang, functionFingerprint, globMatches, globToRegex, inspectInvocation, isSafePattern, isValidCidr, parseChain, planMitigation, propagationHeaders, rateLimitHeaders, rateLimitKey, RateLimiter as EdgeRateLimiter, RATE_LIMIT_KEY_SEPARATOR, RecursionGuard, recursionBlockedResponse, renderDdosInstallScript, renderNftablesRuleset, renderSysctlFile, renderWafConfig, renderWafInstallScript, ruleMatches, sysctlHardening, wafEventTelemetry, CHAIN_HEADER, DEPTH_HEADER, TRACE_HEADER, } from './protection';
14
+ export type { DdosConfig, DdosThresholds, IpRules, ProtectionControls, ProtectionPosture, TimeBoxedControl, InvocationContext, MitigationLevel, MitigationPlan, ParanoiaLevel, RateLimitAction, RateLimitAlgorithm, RateLimitDecision, RateLimitKeySource, RateLimitKeySpec, RateLimitRule as EdgeRateLimitRule, RecursionLimits, RecursionReason, RecursionVerdict, RequestDescriptor, TrafficSignals, WafConfig as EdgeWafConfig, WafEvent, WafGenerationResult, WafMode, WafRuleExclusion, } from './protection';
12
15
  export { AlertEvaluator, AlertStore, HealthCheckRunner, NotificationRouter, evaluateTelemetryAlertRules, isQuietHours, } from './alerts';
13
16
  export type { Alert, AlertEvaluation, AlertRule, AlertSample, AlertSeverity, AlertState, HealthCheck as AlertHealthCheck, HealthResult as AlertHealthResult, HealthStatus as AlertHealthStatus, NotificationChannel as AlertNotificationChannel, NotificationDelivery as AlertNotificationDelivery, NotificationRoute as AlertNotificationRoute, } from './alerts';
14
17
  export * from './jobs';