@intelligems/sst 2.49.6-ig.9 → 2.49.8-ig.2

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 (44) hide show
  1. package/cli/commands/dev.js +10 -6
  2. package/constructs/AstroSite.d.ts +1 -1
  3. package/constructs/EdgeFunction.d.ts +1 -1
  4. package/constructs/EdgeFunction.js +8 -6
  5. package/constructs/Function.d.ts +3 -2
  6. package/constructs/Function.js +2 -1
  7. package/constructs/Job.d.ts +2 -2
  8. package/constructs/Job.js +4 -2
  9. package/constructs/NextjsSite.d.ts +1 -1
  10. package/constructs/NextjsSite.js +2 -2
  11. package/constructs/RemixSite.d.ts +1 -1
  12. package/constructs/SolidStartSite.d.ts +1 -1
  13. package/constructs/SsrFunction.d.ts +2 -2
  14. package/constructs/SsrFunction.js +7 -5
  15. package/constructs/SsrSite.d.ts +2 -2
  16. package/constructs/SsrSite.js +1 -1
  17. package/constructs/Stack.d.ts +1 -1
  18. package/constructs/Stack.js +1 -1
  19. package/constructs/SvelteKitSite.d.ts +1 -1
  20. package/constructs/deprecated/NextjsSite.d.ts +3 -3
  21. package/constructs/deprecated/NextjsSite.js +4 -1
  22. package/constructs/deprecated/cross-region-helper.js +3 -3
  23. package/package.json +3 -3
  24. package/runtime/handlers/node.js +24 -2
  25. package/runtime/handlers.d.ts +4 -0
  26. package/runtime/memory-logging.d.ts +26 -0
  27. package/runtime/memory-logging.js +112 -0
  28. package/runtime/mono-build-config.d.ts +6 -3
  29. package/runtime/mono-build-config.js +34 -10
  30. package/runtime/server.js +35 -44
  31. package/runtime/stdout-attribution.d.ts +18 -0
  32. package/runtime/stdout-attribution.js +43 -0
  33. package/runtime/worker-config.d.ts +19 -0
  34. package/runtime/worker-config.js +26 -0
  35. package/runtime/worker-pool-logging.d.ts +2 -2
  36. package/runtime/worker-pool-logging.js +5 -5
  37. package/runtime/worker-pool.d.ts +77 -0
  38. package/runtime/worker-pool.js +162 -0
  39. package/runtime/workers.d.ts +33 -11
  40. package/runtime/workers.js +405 -513
  41. package/support/nodejs-runtime/index.mjs +214 -100
  42. package/watcher.js +2 -0
  43. package/README.md +0 -43
  44. package/package.json.bak +0 -156
@@ -1,3 +1,4 @@
1
+ import { EventPayload } from "../bus.js";
1
2
  declare module "../bus.js" {
2
3
  interface Events {
3
4
  "worker.started": {
@@ -11,6 +12,8 @@ declare module "../bus.js" {
11
12
  "worker.exited": {
12
13
  workerID: string;
13
14
  functionID: string;
15
+ /** Set for pooled workers: the id the runtime server keys on. */
16
+ pooledWorkerID?: string;
14
17
  };
15
18
  "worker.stdout": {
16
19
  workerID: string;
@@ -39,27 +42,45 @@ declare module "../bus.js" {
39
42
  };
40
43
  }
41
44
  }
45
+ interface Worker {
46
+ workerID: string;
47
+ functionID: string;
48
+ }
42
49
  export declare const useRuntimeWorkers: () => Promise<{
43
- fromID(workerID: string): {
44
- workerID: string;
45
- functionID: string;
46
- };
50
+ fromID(workerID: string): Worker;
47
51
  getCurrentRequestID(workerID: string): string | undefined;
52
+ /**
53
+ * Who a response belongs to. Pooled workers may hold several requests,
54
+ * so the request id decides; non-pooled workers are their own AWS worker.
55
+ */
56
+ resolveRequest(workerID: string, requestID?: string): {
57
+ awsWorkerID: string;
58
+ functionID: string;
59
+ } | undefined;
48
60
  stdout(workerID: string, message: string): void;
49
61
  exited(workerID: string): void;
50
- onResponse(pooledWorkerID: string): void;
51
- getAwsWorkerID(pooledWorkerID: string): string | undefined;
62
+ onResponse(pooledWorkerID: string, requestID?: string): void;
52
63
  isPooled(workerID: string): boolean;
53
- subscribe: <Type extends "worker.started" | "worker.stopped" | "worker.exited" | "worker.stdout" | "worker.reused">(type: Type, cb: (payload: import("../bus.js").EventPayload<Type>) => void) => {
64
+ stats: () => {
65
+ workers: number;
66
+ inFlight: number;
67
+ queued: number;
68
+ };
69
+ subscribe: <Type extends "worker.started" | "worker.stopped" | "worker.exited" | "worker.stdout" | "worker.reused">(type: Type, cb: (payload: EventPayload<Type>) => void) => {
54
70
  type: keyof import("../bus.js").Events;
55
71
  cb: (payload: any) => void;
56
72
  };
57
73
  /**
58
- * Trigger warmup by invoking Lambda functions with warmup payloads.
59
- * This sends real requests through the IoT bridge, which naturally creates workers.
60
- * @param count Number of workers to warm up (default: 15)
74
+ * Warm the pool by invoking a Node function with warm pings.
75
+ *
76
+ * Each ping is marked as a fan-out *child* (`__WARMER_INVOCATION__ > 1`)
77
+ * so the app's lambda-warmer preloads its handlers and returns instead of
78
+ * fanning out to `concurrency` more Lambdas, which is what turned the old
79
+ * 30 pings into ~900 worker creations. The count is capped at the pool
80
+ * size, and pings go through the normal pool path, so warmup can never
81
+ * hold more isolates than steady state.
61
82
  */
62
- triggerWarmup(count?: number): Promise<{
83
+ triggerWarmup(count: number): Promise<{
63
84
  warmed: number;
64
85
  elapsed?: undefined;
65
86
  } | {
@@ -67,3 +88,4 @@ export declare const useRuntimeWorkers: () => Promise<{
67
88
  elapsed: number;
68
89
  }>;
69
90
  }>;
91
+ export {};