@stacksjs/ts-cloud 0.7.89 → 0.7.90

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 (51) hide show
  1. package/dist/bin/cli.js +241 -241
  2. package/dist/bin/dashboard-server.js +377 -377
  3. package/dist/{chunk-bg8gr1n1.js → chunk-hcdewpt6.js} +39 -19
  4. package/dist/deploy/index.js +1 -1
  5. package/dist/deploy/telemetry-collection.d.ts +6 -0
  6. package/dist/index.js +1 -1
  7. package/dist/ui/account/automation.html +4 -4
  8. package/dist/ui/account/security.html +2 -2
  9. package/dist/ui/applications/compose.html +4 -4
  10. package/dist/ui/applications/new.html +2 -2
  11. package/dist/ui/data/backups.html +3 -3
  12. package/dist/ui/data/services.html +4 -4
  13. package/dist/ui/data/volumes.html +3 -3
  14. package/dist/ui/index.html +4 -4
  15. package/dist/ui/operations/alerts.html +4 -4
  16. package/dist/ui/operations/configuration.html +4 -4
  17. package/dist/ui/operations/jobs.html +4 -4
  18. package/dist/ui/operations/maintenance.html +3 -3
  19. package/dist/ui/operations/observability.html +3 -3
  20. package/dist/ui/operations/previews.html +3 -3
  21. package/dist/ui/operations/queue.html +4 -4
  22. package/dist/ui/operations/regions.html +3 -3
  23. package/dist/ui/operations/releases.html +4 -4
  24. package/dist/ui/operations/workloads.html +3 -3
  25. package/dist/ui/server/actions.html +3 -3
  26. package/dist/ui/server/activity.html +2 -2
  27. package/dist/ui/server/capacity.html +4 -4
  28. package/dist/ui/server/database.html +4 -4
  29. package/dist/ui/server/deployments.html +4 -4
  30. package/dist/ui/server/diagnostics.html +2 -2
  31. package/dist/ui/server/firewall.html +4 -4
  32. package/dist/ui/server/fleet.html +4 -4
  33. package/dist/ui/server/logs.html +4 -4
  34. package/dist/ui/server/metrics.html +4 -4
  35. package/dist/ui/server/services.html +2 -2
  36. package/dist/ui/server/sites.html +4 -4
  37. package/dist/ui/server/ssh-keys.html +4 -4
  38. package/dist/ui/server/team.html +4 -4
  39. package/dist/ui/server/terminal.html +2 -2
  40. package/dist/ui/serverless/alarms.html +4 -4
  41. package/dist/ui/serverless/cost.html +2 -2
  42. package/dist/ui/serverless/data.html +4 -4
  43. package/dist/ui/serverless/firewall.html +2 -2
  44. package/dist/ui/serverless/functions.html +4 -4
  45. package/dist/ui/serverless/logs.html +4 -4
  46. package/dist/ui/serverless/metrics.html +2 -2
  47. package/dist/ui/serverless/queues.html +4 -4
  48. package/dist/ui/serverless/secrets.html +4 -4
  49. package/dist/ui/serverless/traces.html +4 -4
  50. package/dist/ui/serverless.html +3 -3
  51. package/package.json +3 -3
@@ -42151,8 +42151,26 @@ class TelemetryCollectionCache {
42151
42151
  this.entries.delete(key2);
42152
42152
  }
42153
42153
  }
42154
+
42155
+ class TelemetryMaintenanceGate {
42156
+ now;
42157
+ lastRun = new Map;
42158
+ constructor(now = Date.now) {
42159
+ this.now = now;
42160
+ }
42161
+ shouldRun(key2, intervalMs, force = false) {
42162
+ const now = this.now();
42163
+ const lastRun = this.lastRun.get(key2);
42164
+ if (!force && lastRun != null && now - lastRun < intervalMs)
42165
+ return false;
42166
+ this.lastRun.set(key2, now);
42167
+ return true;
42168
+ }
42169
+ }
42154
42170
  var collectionCache = new TelemetryCollectionCache;
42171
+ var maintenanceGate = new TelemetryMaintenanceGate;
42155
42172
  var MAX_COLLECTED_LOGS = 2000;
42173
+ var RETENTION_MAINTENANCE_INTERVAL_MS = 60 * 60000;
42156
42174
  function retainedByPolicy(record3, policy3) {
42157
42175
  if (record3.kind === "log" && !policy3.collectLogs)
42158
42176
  return false;
@@ -42602,30 +42620,32 @@ async function collectNow(context) {
42602
42620
  } catch (error2) {
42603
42621
  errors.push({ source: "runtime", message: error2 instanceof Error ? error2.message : String(error2) });
42604
42622
  }
42605
- for (const event of context.controlPlane.listEvents({ projectId: context.projectId, limit: 1000 })) {
42606
- const payload2 = event.payload;
42607
- records.push({
42608
- ...scope2,
42609
- id: `telemetry:event:${event.id}`,
42610
- resourceId: event.resourceId,
42611
- kind: "event",
42612
- source: "control-plane",
42613
- name: event.type,
42614
- timestamp: event.createdAt,
42615
- level: event.level,
42616
- message: event.type,
42617
- deploymentId: event.operationId,
42618
- releaseId: typeof payload2.releaseId === "string" ? payload2.releaseId : undefined,
42619
- traceId: event.correlationId,
42620
- attributes: payload2
42621
- });
42622
- }
42623
+ if (!context.lightweight)
42624
+ for (const event of context.controlPlane.listEvents({ projectId: context.projectId, limit: 1000 })) {
42625
+ const payload2 = event.payload;
42626
+ records.push({
42627
+ ...scope2,
42628
+ id: `telemetry:event:${event.id}`,
42629
+ resourceId: event.resourceId,
42630
+ kind: "event",
42631
+ source: "control-plane",
42632
+ name: event.type,
42633
+ timestamp: event.createdAt,
42634
+ level: event.level,
42635
+ message: event.type,
42636
+ deploymentId: event.operationId,
42637
+ releaseId: typeof payload2.releaseId === "string" ? payload2.releaseId : undefined,
42638
+ traceId: event.correlationId,
42639
+ attributes: payload2
42640
+ });
42641
+ }
42623
42642
  const retained = records.filter((record3) => retainedByPolicy(record3, policy3)).map((record3) => ({
42624
42643
  ...record3,
42625
42644
  sampled: policy3.samplingRate < 1 && (record3.kind === "log" || record3.kind === "trace" || record3.kind === "request" || record3.name.startsWith("request."))
42626
42645
  }));
42627
42646
  const inserted = telemetry2.appendMany(retained).length;
42628
- telemetry2.enforceRetention(policy3, context.projectId);
42647
+ if (maintenanceGate.shouldRun(context.projectId, RETENTION_MAINTENANCE_INTERVAL_MS, !context.lightweight))
42648
+ telemetry2.enforceRetention(policy3, context.projectId);
42629
42649
  const statuses = telemetry2.status(context.projectId, context.environmentId, policy3.rawDays, policy3.samplingRate);
42630
42650
  for (const error2 of errors)
42631
42651
  if (!statuses.some((status) => status.source === error2.source))
@@ -30,7 +30,7 @@ import {
30
30
  synchronizeDashboardUsers,
31
31
  trackDashboardOperation,
32
32
  verifyStaticApiOrigin
33
- } from "../chunk-bg8gr1n1.js";
33
+ } from "../chunk-hcdewpt6.js";
34
34
  import {
35
35
  deleteStaticSite,
36
36
  deployStaticSite,
@@ -11,6 +11,12 @@ export declare class TelemetryCollectionCache<T> {
11
11
  }>;
12
12
  invalidate(prefix: string): void;
13
13
  }
14
+ export declare class TelemetryMaintenanceGate {
15
+ private readonly now;
16
+ private readonly lastRun;
17
+ constructor(now?: () => number);
18
+ shouldRun(key: string, intervalMs: number, force?: boolean): boolean;
19
+ }
14
20
  export interface TelemetryCollectionResult {
15
21
  collected: number;
16
22
  cached: boolean;
package/dist/index.js CHANGED
@@ -283,7 +283,7 @@ import {
283
283
  volumeCapabilities,
284
284
  webhookEndpoint,
285
285
  zeroCapacity
286
- } from "./chunk-bg8gr1n1.js";
286
+ } from "./chunk-hcdewpt6.js";
287
287
  import {
288
288
  deleteStaticSite,
289
289
  deployStaticSite,