@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
@@ -2569,6 +2569,39 @@ class LambdaClient {
2569
2569
  body: JSON.stringify({ ProvisionedConcurrentExecutions })
2570
2570
  });
2571
2571
  }
2572
+ async getFunctionConcurrency(functionName) {
2573
+ try {
2574
+ const result = await this.client.request({
2575
+ service: "lambda",
2576
+ region: this.region,
2577
+ method: "GET",
2578
+ path: `/2019-10-31/functions/${encodeURIComponent(functionName)}/concurrency`
2579
+ });
2580
+ return result?.ReservedConcurrentExecutions ?? null;
2581
+ } catch (err) {
2582
+ if (/ResourceNotFound|ProvisionedConcurrencyConfigNotFound/i.test(String(err?.message)))
2583
+ return null;
2584
+ throw err;
2585
+ }
2586
+ }
2587
+ async putFunctionConcurrency(functionName, reservedConcurrentExecutions) {
2588
+ await this.client.request({
2589
+ service: "lambda",
2590
+ region: this.region,
2591
+ method: "PUT",
2592
+ path: `/2019-10-31/functions/${encodeURIComponent(functionName)}/concurrency`,
2593
+ headers: { "Content-Type": "application/json" },
2594
+ body: JSON.stringify({ ReservedConcurrentExecutions: reservedConcurrentExecutions })
2595
+ });
2596
+ }
2597
+ async deleteFunctionConcurrency(functionName) {
2598
+ await this.client.request({
2599
+ service: "lambda",
2600
+ region: this.region,
2601
+ method: "DELETE",
2602
+ path: `/2019-10-31/functions/${encodeURIComponent(functionName)}/concurrency`
2603
+ });
2604
+ }
2572
2605
  async deleteProvisionedConcurrencyConfig(functionName, qualifier) {
2573
2606
  await this.client.request({
2574
2607
  service: "lambda",
@@ -9,7 +9,7 @@ export type OrganizationRoleTemplate = 'owner' | 'admin' | 'deployer' | 'operato
9
9
  export type AuthorizationScopeType = 'organization' | 'project' | 'environment' | 'resource';
10
10
  export type AuthorizationEffect = 'allow' | 'deny';
11
11
  export type AuthorizationRecordSource = 'manual' | 'legacy' | 'invitation';
12
- export type AuthorizationCapability = 'project:read' | 'config:read' | 'config:write' | 'deployments:read' | 'deployments:create' | 'deployments:cancel' | 'deployments:rollback' | 'runtime:read' | 'runtime:restart' | 'runtime:logs' | 'runtime:terminal' | 'data:read' | 'data:write' | 'data:admin' | 'backups:read' | 'backups:create' | 'backups:restore' | 'secrets:read' | 'secrets:write' | 'fleet:read' | 'fleet:manage' | 'users:read' | 'users:manage' | 'users:transfer-ownership' | 'audit:read' | 'security:read' | 'security:manage' | 'security:waive' | 'sources:read' | 'sources:manage' | 'applications:read' | 'applications:manage' | 'automation:read' | 'automation:manage' | 'tags:manage';
12
+ export type AuthorizationCapability = 'project:read' | 'config:read' | 'config:write' | 'deployments:read' | 'deployments:create' | 'deployments:cancel' | 'deployments:rollback' | 'runtime:read' | 'runtime:restart' | 'runtime:logs' | 'runtime:terminal' | 'data:read' | 'data:write' | 'data:admin' | 'backups:read' | 'backups:create' | 'backups:restore' | 'secrets:read' | 'secrets:write' | 'fleet:read' | 'fleet:manage' | 'users:read' | 'users:manage' | 'users:transfer-ownership' | 'audit:read' | 'billing:read' | 'billing:manage' | 'security:read' | 'security:manage' | 'security:waive' | 'sources:read' | 'sources:manage' | 'applications:read' | 'applications:manage' | 'automation:read' | 'automation:manage' | 'tags:manage';
13
13
  export interface AuthorizationScope {
14
14
  type: AuthorizationScopeType;
15
15
  id?: ControlPlaneId;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -36,7 +36,7 @@ import {
36
36
  synchronizeDashboardUsers,
37
37
  trackDashboardOperation,
38
38
  verifyStaticApiOrigin
39
- } from "../chunk-eg8ck25v.js";
39
+ } from "../chunk-wmz8x3cy.js";
40
40
  import {
41
41
  deleteStaticSite,
42
42
  deployStaticSite,
@@ -47,15 +47,17 @@ import {
47
47
  generateStaticSiteTemplate,
48
48
  invalidateCache,
49
49
  uploadStaticFiles
50
- } from "../chunk-ef2dwfrg.js";
50
+ } from "../chunk-8kh577qh.js";
51
51
  import {
52
52
  buildAndPushServerlessImage
53
- } from "../chunk-3g4r09dd.js";
54
- import"../chunk-ybcz6sxc.js";
53
+ } from "../chunk-wmbep3b5.js";
54
+ import"../chunk-x6yzgv7y.js";
55
+ import"../chunk-hpv68b4a.js";
55
56
  import"../chunk-01d86gt1.js";
56
57
  import"../chunk-50jpda9q.js";
57
58
  import"../chunk-he9a874b.js";
58
59
  import"../chunk-gttvakpv.js";
60
+ import"../chunk-32e7ya18.js";
59
61
  import {
60
62
  IPV6_EXCLUDED_HOST_LABELS,
61
63
  MANAGEMENT_DASHBOARD_SITE,
@@ -76,14 +78,15 @@ import {
76
78
  siteInstallBase,
77
79
  validateDeploymentConfig,
78
80
  verifyAddressRecord
79
- } from "../chunk-33sy72r8.js";
80
- import"../chunk-c6db5m63.js";
81
+ } from "../chunk-d3vx2ekv.js";
81
82
  import"../chunk-7m60qnc8.js";
82
83
  import"../chunk-4cjrg98a.js";
83
- import"../chunk-hpv68b4a.js";
84
- import"../chunk-32e7ya18.js";
85
84
  import"../chunk-wj3s95p9.js";
86
85
  import"../chunk-zqtpg06c.js";
86
+ import"../chunk-19bs955w.js";
87
+ import"../chunk-va2yd85b.js";
88
+ import"../chunk-aa2dkn7b.js";
89
+ import"../chunk-t2s3gdq6.js";
87
90
  import"../chunk-v0bahtg2.js";
88
91
  export {
89
92
  verifyStaticApiOrigin,
@@ -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-33sy72r8.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';