@aws-blocks/core 0.3.0 → 0.5.0

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 (147) hide show
  1. package/README.md +25 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +32 -0
  4. package/dist/api.test.js +22 -0
  5. package/dist/bb-utils.d.ts +1 -0
  6. package/dist/bb-utils.d.ts.map +1 -1
  7. package/dist/bb-utils.js +3 -0
  8. package/dist/cdk/apigateway-account.d.ts +33 -0
  9. package/dist/cdk/apigateway-account.d.ts.map +1 -0
  10. package/dist/cdk/apigateway-account.js +60 -0
  11. package/dist/cdk/blocks-backend.d.ts +11 -0
  12. package/dist/cdk/blocks-backend.d.ts.map +1 -1
  13. package/dist/cdk/blocks-backend.js +72 -13
  14. package/dist/cdk/blocks-backend.test.js +88 -1
  15. package/dist/cdk/blocks-defaults.d.ts +76 -1
  16. package/dist/cdk/blocks-defaults.d.ts.map +1 -1
  17. package/dist/cdk/blocks-defaults.js +17 -1
  18. package/dist/cdk/blocks-defaults.test.js +17 -0
  19. package/dist/cdk/blocks-stack.test.js +44 -3
  20. package/dist/cdk/compute/compute-registry.d.ts +19 -0
  21. package/dist/cdk/compute/compute-registry.d.ts.map +1 -0
  22. package/dist/cdk/compute/compute-registry.js +38 -0
  23. package/dist/cdk/compute/compute.d.ts +82 -2
  24. package/dist/cdk/compute/compute.d.ts.map +1 -1
  25. package/dist/cdk/compute/compute.js +64 -2
  26. package/dist/cdk/compute/default-compute-factory.d.ts +1 -0
  27. package/dist/cdk/compute/default-compute-factory.d.ts.map +1 -1
  28. package/dist/cdk/config-registry.d.ts +34 -4
  29. package/dist/cdk/config-registry.d.ts.map +1 -1
  30. package/dist/cdk/config-registry.js +83 -25
  31. package/dist/cdk/config-registry.test.d.ts +2 -0
  32. package/dist/cdk/config-registry.test.d.ts.map +1 -0
  33. package/dist/cdk/config-registry.test.js +127 -0
  34. package/dist/cdk/dashboard-registry.d.ts +41 -0
  35. package/dist/cdk/dashboard-registry.d.ts.map +1 -0
  36. package/dist/cdk/dashboard-registry.js +61 -0
  37. package/dist/cdk/index.d.ts +90 -6
  38. package/dist/cdk/index.d.ts.map +1 -1
  39. package/dist/cdk/index.js +135 -13
  40. package/dist/cdk/internal.d.ts +3 -1
  41. package/dist/cdk/internal.d.ts.map +1 -1
  42. package/dist/cdk/internal.js +4 -1
  43. package/dist/cdk/tracer-registry.d.ts +31 -0
  44. package/dist/cdk/tracer-registry.d.ts.map +1 -0
  45. package/dist/cdk/tracer-registry.js +49 -0
  46. package/dist/cdk/vpc-requirements-registry.d.ts +33 -0
  47. package/dist/cdk/vpc-requirements-registry.d.ts.map +1 -0
  48. package/dist/cdk/vpc-requirements-registry.js +46 -0
  49. package/dist/cdk/vpc-types.d.ts +151 -0
  50. package/dist/cdk/vpc-types.d.ts.map +1 -0
  51. package/dist/cdk/vpc-types.js +3 -0
  52. package/dist/cdk/vpc.d.ts +59 -0
  53. package/dist/cdk/vpc.d.ts.map +1 -0
  54. package/dist/cdk/vpc.js +298 -0
  55. package/dist/cdk/vpc.test.d.ts +2 -0
  56. package/dist/cdk/vpc.test.d.ts.map +1 -0
  57. package/dist/cdk/vpc.test.js +285 -0
  58. package/dist/client/index.d.ts +1 -1
  59. package/dist/client/index.d.ts.map +1 -1
  60. package/dist/client/index.js +1 -1
  61. package/dist/common/config.d.ts +34 -0
  62. package/dist/common/config.d.ts.map +1 -1
  63. package/dist/common/config.js +45 -3
  64. package/dist/common/config.test.js +19 -0
  65. package/dist/common/index.d.ts +8 -0
  66. package/dist/common/index.d.ts.map +1 -1
  67. package/dist/errors.d.ts +21 -0
  68. package/dist/errors.d.ts.map +1 -1
  69. package/dist/errors.js +25 -0
  70. package/dist/hosting.d.ts +9 -0
  71. package/dist/hosting.d.ts.map +1 -1
  72. package/dist/hosting.js +12 -1
  73. package/dist/hosting.test.js +63 -1
  74. package/dist/index.cdk.d.ts +3 -2
  75. package/dist/index.cdk.d.ts.map +1 -1
  76. package/dist/index.cdk.js +2 -2
  77. package/dist/index.d.ts +1 -1
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/lambda-handler.d.ts +17 -0
  81. package/dist/lambda-handler.d.ts.map +1 -1
  82. package/dist/lambda-handler.js +61 -5
  83. package/dist/lambda-handler.test.js +191 -2
  84. package/dist/raw-route.d.ts +15 -1
  85. package/dist/raw-route.d.ts.map +1 -1
  86. package/dist/raw-route.js +96 -12
  87. package/dist/raw-route.test.js +332 -1
  88. package/dist/scripts/dev-server.d.ts.map +1 -1
  89. package/dist/scripts/dev-server.js +11 -0
  90. package/dist/scripts/extract-ts-types.d.ts.map +1 -1
  91. package/dist/scripts/extract-ts-types.js +107 -23
  92. package/dist/scripts/extract-ts-types.test.js +225 -26
  93. package/dist/scripts/generate-spec.d.ts.map +1 -1
  94. package/dist/scripts/generate-spec.js +14 -5
  95. package/dist/scripts/generate-spec.test.js +93 -0
  96. package/dist/scripts/sandbox-empty-buckets.test.d.ts +2 -0
  97. package/dist/scripts/sandbox-empty-buckets.test.d.ts.map +1 -0
  98. package/dist/scripts/sandbox-empty-buckets.test.js +171 -0
  99. package/dist/scripts/sandbox.d.ts +54 -0
  100. package/dist/scripts/sandbox.d.ts.map +1 -1
  101. package/dist/scripts/sandbox.js +163 -25
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +1 -1
  104. package/package.json +10 -1
  105. package/src/api.test.ts +25 -0
  106. package/src/api.ts +39 -0
  107. package/src/bb-utils.ts +3 -0
  108. package/src/cdk/apigateway-account.ts +66 -0
  109. package/src/cdk/blocks-backend.test.ts +168 -60
  110. package/src/cdk/blocks-backend.ts +299 -227
  111. package/src/cdk/blocks-defaults.test.ts +21 -0
  112. package/src/cdk/blocks-defaults.ts +79 -1
  113. package/src/cdk/blocks-stack.test.ts +57 -13
  114. package/src/cdk/compute/compute-registry.ts +45 -0
  115. package/src/cdk/compute/compute.ts +114 -2
  116. package/src/cdk/compute/default-compute-factory.ts +1 -0
  117. package/src/cdk/config-registry.test.ts +149 -0
  118. package/src/cdk/config-registry.ts +92 -34
  119. package/src/cdk/dashboard-registry.ts +68 -0
  120. package/src/cdk/index.ts +427 -256
  121. package/src/cdk/internal.ts +6 -2
  122. package/src/cdk/tracer-registry.ts +54 -0
  123. package/src/cdk/vpc-requirements-registry.ts +63 -0
  124. package/src/cdk/vpc-types.ts +158 -0
  125. package/src/cdk/vpc.test.ts +348 -0
  126. package/src/cdk/vpc.ts +336 -0
  127. package/src/client/index.ts +1 -1
  128. package/src/common/config.test.ts +21 -0
  129. package/src/common/config.ts +47 -3
  130. package/src/common/index.ts +8 -0
  131. package/src/errors.ts +26 -0
  132. package/src/hosting.test.ts +87 -1
  133. package/src/hosting.ts +24 -1
  134. package/src/index.cdk.ts +11 -1
  135. package/src/index.ts +1 -1
  136. package/src/lambda-handler.test.ts +220 -2
  137. package/src/lambda-handler.ts +65 -4
  138. package/src/raw-route.test.ts +427 -1
  139. package/src/raw-route.ts +125 -12
  140. package/src/scripts/dev-server.ts +12 -1
  141. package/src/scripts/extract-ts-types.test.ts +228 -26
  142. package/src/scripts/extract-ts-types.ts +104 -20
  143. package/src/scripts/generate-spec.test.ts +101 -0
  144. package/src/scripts/generate-spec.ts +15 -5
  145. package/src/scripts/sandbox-empty-buckets.test.ts +191 -0
  146. package/src/scripts/sandbox.ts +185 -24
  147. package/src/version.ts +1 -1
@@ -1,4 +1,18 @@
1
1
  import { RemovalPolicy } from 'aws-cdk-lib';
2
+ import { RetentionDays } from 'aws-cdk-lib/aws-logs';
3
+ import type { BlocksVpcOptions } from './vpc-types.js';
4
+ /**
5
+ * Request-rate limits applied to an API Gateway stage. On a REST API these are
6
+ * requests/second; on a WebSocket API the unit is messages/second across the
7
+ * connection. `rateLimit` is the steady-state ceiling and `burstLimit` the
8
+ * token-bucket size for short spikes.
9
+ */
10
+ export interface BlocksThrottling {
11
+ /** Steady-state request (or WebSocket message) rate ceiling, per second. */
12
+ rateLimit: number;
13
+ /** Token-bucket burst size for short spikes above `rateLimit`. */
14
+ burstLimit: number;
15
+ }
2
16
  /**
3
17
  * Default values for every Amazon-authored Building Block created within a
4
18
  * `BlocksStack` or `BlocksBackend`. A per-block option always overrides the
@@ -42,6 +56,50 @@ export interface BlocksDefaults {
42
56
  pointInTimeRecovery: boolean | {
43
57
  retentionDays: number;
44
58
  };
59
+ /**
60
+ * How long CloudWatch Logs keeps log events written by Blocks-managed log
61
+ * groups (the core handler Lambda, migration/GSI Lambdas, hosting compute,
62
+ * `bb-logger`, and API Gateway access logs) before expiring them. Without a
63
+ * retention set, AWS keeps log events forever, which grows cost unbounded —
64
+ * every Blocks-managed log group reads this default so retention is applied
65
+ * consistently.
66
+ */
67
+ logRetention: RetentionDays;
68
+ /**
69
+ * Request-rate limits applied to every Blocks-managed API Gateway stage: the
70
+ * core REST API, the SSR/hosting REST API, and the `bb-realtime` WebSocket
71
+ * stage. Protects the backend from runaway clients and caps blast radius.
72
+ * The sandbox preset caps tighter (200/400) than production (1000/2000) so a
73
+ * disposable stack is well-protected without throttling real production
74
+ * traffic. See {@link BlocksThrottling}.
75
+ */
76
+ throttling: BlocksThrottling;
77
+ /**
78
+ * Whether to emit structured JSON access logs from every Blocks-managed API
79
+ * Gateway stage to a dedicated CloudWatch log group (retention follows
80
+ * {@link logRetention}).
81
+ *
82
+ * **Off by default in both presets** — opt in with a per-stack override
83
+ * (`defaults: { ...BlocksPresets.production, accessLogging: true }`). It is
84
+ * off by default (rather than on for production) because enabling it
85
+ * provisions the account-level API Gateway CloudWatch Logs role, which is an
86
+ * account/region-level singleton: a second Blocks stack in the same
87
+ * account+region that also enables access logging can repoint that role on
88
+ * deploy or, on teardown, leave the survivor's access logging broken.
89
+ * Enabling it is therefore safe for **one Blocks stack per region** — see
90
+ * `ensureApiGatewayAccount` for the full multi-stack teardown caveat.
91
+ */
92
+ accessLogging: boolean;
93
+ /**
94
+ * Place the app's compute and VPC-resident resources in a VPC. Pass a
95
+ * standard CDK VPC — Blocks handles Lambda placement, endpoint provisioning
96
+ * (based on which Building Blocks are in scope), and security-group wiring.
97
+ *
98
+ * Omit for no VPC (the preset default — Lambda runs in the AWS-managed
99
+ * network). A Building Block that can't function without a VPC causes Blocks
100
+ * to derive one on demand even when this is unset.
101
+ */
102
+ vpc?: BlocksVpcOptions;
45
103
  }
46
104
  /**
47
105
  * Prepared starting points for {@link BlocksDefaults}. Pick one and override
@@ -58,13 +116,30 @@ export declare const BlocksPresets: {
58
116
  deletionProtection: false;
59
117
  allowedOrigins: string[];
60
118
  pointInTimeRecovery: false;
119
+ logRetention: RetentionDays.ONE_WEEK;
120
+ throttling: {
121
+ rateLimit: number;
122
+ burstLimit: number;
123
+ };
124
+ accessLogging: false;
61
125
  };
62
- /** Durable, protected posture for permanent deployments. */
126
+ /**
127
+ * Durable, protected posture for permanent deployments. A higher throttle
128
+ * ceiling (1000/2000) than sandbox so the default doesn't 429 real
129
+ * production traffic — raise it via a per-stack `throttling` override for
130
+ * higher-volume APIs.
131
+ */
63
132
  production: {
64
133
  removalPolicy: RemovalPolicy.RETAIN;
65
134
  deletionProtection: true;
66
135
  allowedOrigins: never[];
67
136
  pointInTimeRecovery: true;
137
+ logRetention: RetentionDays.ONE_YEAR;
138
+ throttling: {
139
+ rateLimit: number;
140
+ burstLimit: number;
141
+ };
142
+ accessLogging: false;
68
143
  };
69
144
  };
70
145
  //# sourceMappingURL=blocks-defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks-defaults.d.ts","sourceRoot":"","sources":["../../src/cdk/blocks-defaults.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;OAKG;IACH,aAAa,EAAE,aAAa,CAAC;IAE7B;;;;OAIG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,OAAO,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;IACzB,qFAAqF;;;;;;;IAOrF,4DAA4D;;;;;;;CAOnB,CAAC"}
1
+ {"version":3,"file":"blocks-defaults.d.ts","sourceRoot":"","sources":["../../src/cdk/blocks-defaults.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;OAKG;IACH,aAAa,EAAE,aAAa,CAAC;IAE7B;;;;OAIG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,OAAO,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAEzD;;;;;;;OAOG;IACH,YAAY,EAAE,aAAa,CAAC;IAE5B;;;;;;;OAOG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAE7B;;;;;;;;;;;;;;OAcG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,gBAAgB,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;IACzB,qFAAqF;;;;;;;;;;;;;IAUrF;;;;;OAKG;;;;;;;;;;;;;CAcsC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { RemovalPolicy } from 'aws-cdk-lib';
4
+ import { RetentionDays } from 'aws-cdk-lib/aws-logs';
4
5
  /**
5
6
  * Prepared starting points for {@link BlocksDefaults}. Pick one and override
6
7
  * individual fields with a spread:
@@ -16,12 +17,27 @@ export const BlocksPresets = {
16
17
  deletionProtection: false,
17
18
  allowedOrigins: ['^https?://(localhost|127\\.0\\.0\\.1)(:\\d+)?$'],
18
19
  pointInTimeRecovery: false,
20
+ logRetention: RetentionDays.ONE_WEEK,
21
+ throttling: { rateLimit: 200, burstLimit: 400 },
22
+ accessLogging: false,
19
23
  },
20
- /** Durable, protected posture for permanent deployments. */
24
+ /**
25
+ * Durable, protected posture for permanent deployments. A higher throttle
26
+ * ceiling (1000/2000) than sandbox so the default doesn't 429 real
27
+ * production traffic — raise it via a per-stack `throttling` override for
28
+ * higher-volume APIs.
29
+ */
21
30
  production: {
22
31
  removalPolicy: RemovalPolicy.RETAIN,
23
32
  deletionProtection: true,
24
33
  allowedOrigins: [],
25
34
  pointInTimeRecovery: true,
35
+ logRetention: RetentionDays.ONE_YEAR,
36
+ throttling: { rateLimit: 1000, burstLimit: 2000 },
37
+ // Off by default even in production: enabling access logging mutates the
38
+ // account/region-level API Gateway CloudWatch role (a singleton). Opt in
39
+ // per stack once you've confirmed a single Blocks stack owns it in the
40
+ // region — see the `accessLogging` field doc.
41
+ accessLogging: false,
26
42
  },
27
43
  };
@@ -9,6 +9,7 @@
9
9
  import { test, describe } from 'node:test';
10
10
  import assert from 'node:assert';
11
11
  import { RemovalPolicy } from 'aws-cdk-lib';
12
+ import { RetentionDays } from 'aws-cdk-lib/aws-logs';
12
13
  import { BlocksPresets } from './blocks-defaults.js';
13
14
  describe('BlocksPresets', () => {
14
15
  test('sandbox is disposable: DESTROY + deletion protection off + no PITR', () => {
@@ -21,4 +22,20 @@ describe('BlocksPresets', () => {
21
22
  assert.strictEqual(BlocksPresets.production.deletionProtection, true);
22
23
  assert.strictEqual(BlocksPresets.production.pointInTimeRecovery, true);
23
24
  });
25
+ test('sandbox keeps logs briefly', () => {
26
+ assert.strictEqual(BlocksPresets.sandbox.logRetention, RetentionDays.ONE_WEEK);
27
+ });
28
+ test('production keeps logs a year', () => {
29
+ assert.strictEqual(BlocksPresets.production.logRetention, RetentionDays.ONE_YEAR);
30
+ });
31
+ test('access logging is off by default in BOTH presets (opt-in; mutates an account singleton)', () => {
32
+ assert.strictEqual(BlocksPresets.sandbox.accessLogging, false);
33
+ assert.strictEqual(BlocksPresets.production.accessLogging, false);
34
+ });
35
+ test('sandbox caps tighter (200/400) than production (1000/2000)', () => {
36
+ assert.strictEqual(BlocksPresets.sandbox.throttling.rateLimit, 200);
37
+ assert.strictEqual(BlocksPresets.sandbox.throttling.burstLimit, 400);
38
+ assert.strictEqual(BlocksPresets.production.throttling.rateLimit, 1000);
39
+ assert.strictEqual(BlocksPresets.production.throttling.burstLimit, 2000);
40
+ });
24
41
  });
@@ -10,7 +10,8 @@ import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs';
10
10
  import { BLOCKS_RPC_PREFIX } from '../constants.js';
11
11
  import { BlocksBackend } from './blocks-backend.js';
12
12
  import { Compute } from './compute/compute.js';
13
- import { BlocksStack, BlocksPresets, Scope } from './index.js';
13
+ import { getComputes } from './compute/compute-registry.js';
14
+ import { BlocksPresets, BlocksStack, Scope } from './index.js';
14
15
  // A real app gets its default compute from @aws-blocks/bb-lambda-compute (via
15
16
  // @aws-blocks/blocks), which core's own tests can't depend on. Use an
16
17
  // equivalent inline stub: a Compute that owns a NodejsFunction + API Gateway,
@@ -22,13 +23,18 @@ class StubLambdaCompute extends Compute {
22
23
  fn;
23
24
  apiGateway;
24
25
  apiUrl;
26
+ logGroup;
25
27
  constructor(scope, id) {
26
28
  super(id, { parent: scope });
29
+ this.logGroup = new cdk.aws_logs.LogGroup(this, 'HandlerLogGroup', {
30
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
31
+ });
27
32
  this.fn = new lambda.NodejsFunction(this, 'Handler', {
28
33
  entry: this.backendHandlerPath,
29
34
  runtime: cdk.aws_lambda.Runtime.NODEJS_22_X,
30
35
  handler: 'handler',
31
36
  role: this.executionRole,
37
+ logGroup: this.logGroup,
32
38
  environment: { BLOCKS_STACK_NAME: this.backendStackName },
33
39
  bundling: { minify: true, esbuildArgs: { '--conditions': 'aws-runtime' } },
34
40
  });
@@ -42,6 +48,16 @@ class StubLambdaCompute extends Compute {
42
48
  setEnv(key, value) {
43
49
  this.fn.addEnvironment(key, value);
44
50
  }
51
+ applyTracing() { }
52
+ healthWidgets(_region) {
53
+ return [];
54
+ }
55
+ loggingWidgets(_region) {
56
+ return [];
57
+ }
58
+ tracingWidgets(_region) {
59
+ return [];
60
+ }
45
61
  }
46
62
  const stubComputeFactory = (root) => new StubLambdaCompute(root, 'DefaultCompute');
47
63
  // Simulate the CDK condition being active (tests import CDK files directly)
@@ -54,8 +70,18 @@ const sideEffectBackendPath = join(__dirname, '__fixtures__', 'side-effect-backe
54
70
  const factoryBackendPath = join(__dirname, '__fixtures__', 'factory-backend.js');
55
71
  // Wrap create(), injecting the stub default-compute factory the way
56
72
  // @aws-blocks/blocks injects LambdaCompute — so tests don't repeat it.
57
- const makeStack = (scope, id, backendCDKPath) => BlocksStack.create(scope, id, { backendHandlerPath: handlerPath, backendCDKPath, defaults: BlocksPresets.production, defaultComputeFactory: stubComputeFactory });
58
- const makeBackend = (scope, id, backendCDKPath) => BlocksBackend.create(scope, id, { backendHandlerPath: handlerPath, backendCDKPath, defaults: BlocksPresets.production, defaultComputeFactory: stubComputeFactory });
73
+ const makeStack = (scope, id, backendCDKPath) => BlocksStack.create(scope, id, {
74
+ backendHandlerPath: handlerPath,
75
+ backendCDKPath,
76
+ defaults: BlocksPresets.production,
77
+ defaultComputeFactory: stubComputeFactory,
78
+ });
79
+ const makeBackend = (scope, id, backendCDKPath) => BlocksBackend.create(scope, id, {
80
+ backendHandlerPath: handlerPath,
81
+ backendCDKPath,
82
+ defaults: BlocksPresets.production,
83
+ defaultComputeFactory: stubComputeFactory,
84
+ });
59
85
  describe('ESM cache-busting (multi-stage)', () => {
60
86
  test('BlocksStack.create() with same backendCDKPath but different IDs produces constructs in each', async () => {
61
87
  const app = new cdk.App();
@@ -130,6 +156,21 @@ describe('root is bound to the owning stack (multi-stack synth)', () => {
130
156
  assert.strictEqual(blockA.backendStackName, 'RootBindingA', 'blockA derives its own stack name');
131
157
  assert.strictEqual(blockB.backendStackName, 'RootBindingB', 'blockB derives its own stack name');
132
158
  });
159
+ test('each stack owns an isolated compute registry (no cross-stack bleed)', async () => {
160
+ // Computes self-register on their owning stack (keyed per stack, not a
161
+ // process-global list), so a multi-stack synth keeps each stack's computes
162
+ // separate — finalize steps for one stack never see another's compute.
163
+ const app = new cdk.App();
164
+ const stackA = await makeStack(app, 'ComputeRegistryA', sideEffectBackendPath);
165
+ const stackB = await makeStack(app, 'ComputeRegistryB', sideEffectBackendPath);
166
+ const computesA = getComputes(stackA);
167
+ const computesB = getComputes(stackB);
168
+ assert.strictEqual(computesA.length, 1, 'stackA registered exactly its default compute');
169
+ assert.strictEqual(computesB.length, 1, 'stackB registered exactly its default compute');
170
+ assert.strictEqual(computesA[0], stackA._defaultCompute, 'stackA lists its own default');
171
+ assert.strictEqual(computesB[0], stackB._defaultCompute, 'stackB lists its own default');
172
+ assert.notStrictEqual(computesA[0], computesB[0], 'the two stacks hold distinct computes');
173
+ });
133
174
  });
134
175
  describe('assertCdkConditionActive', () => {
135
176
  test('BlocksStack.create() throws when --conditions=cdk is missing', async () => {
@@ -0,0 +1,19 @@
1
+ import type { Construct } from 'constructs';
2
+ import type { Compute } from './compute.js';
3
+ /**
4
+ * Register a compute on its owning stack. Called from the {@link Compute} base
5
+ * constructor, so every compute self-registers the moment it is constructed —
6
+ * the finalize steps then enumerate them without a separate discovery pass
7
+ * (mirrors how `registerConfig` accumulates config during the backend import).
8
+ *
9
+ * @param compute - The compute to register (used to locate its stack).
10
+ */
11
+ export declare function registerCompute(compute: Compute): void;
12
+ /**
13
+ * The computes registered on the stack that owns `scope`, in construction
14
+ * order. Returns an empty array before any compute is constructed.
15
+ *
16
+ * @param scope - Any construct in the stack (used to locate the stack).
17
+ */
18
+ export declare function getComputes(scope: Construct): readonly Compute[];
19
+ //# sourceMappingURL=compute-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-registry.d.ts","sourceRoot":"","sources":["../../../src/cdk/compute/compute-registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAmB5C;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,OAAO,EAAE,CAEhE"}
@@ -0,0 +1,38 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import * as cdk from 'aws-cdk-lib';
4
+ const REGISTRY_KEY = Symbol.for('BLOCKS_COMPUTE_REGISTRY');
5
+ /**
6
+ * Get or create the compute list for a given stack. The list is stored on the
7
+ * stack object (keyed by a Symbol), so each stack in a multi-stack synth gets
8
+ * its own — a compute never leaks into another stack's list. Mirrors the config
9
+ * registry (`config-registry.ts`), which scopes its state the same way.
10
+ */
11
+ function getRegistry(stack) {
12
+ let list = stack[REGISTRY_KEY];
13
+ if (!list) {
14
+ list = [];
15
+ stack[REGISTRY_KEY] = list;
16
+ }
17
+ return list;
18
+ }
19
+ /**
20
+ * Register a compute on its owning stack. Called from the {@link Compute} base
21
+ * constructor, so every compute self-registers the moment it is constructed —
22
+ * the finalize steps then enumerate them without a separate discovery pass
23
+ * (mirrors how `registerConfig` accumulates config during the backend import).
24
+ *
25
+ * @param compute - The compute to register (used to locate its stack).
26
+ */
27
+ export function registerCompute(compute) {
28
+ getRegistry(cdk.Stack.of(compute)).push(compute);
29
+ }
30
+ /**
31
+ * The computes registered on the stack that owns `scope`, in construction
32
+ * order. Returns an empty array before any compute is constructed.
33
+ *
34
+ * @param scope - Any construct in the stack (used to locate the stack).
35
+ */
36
+ export function getComputes(scope) {
37
+ return getRegistry(cdk.Stack.of(scope));
38
+ }
@@ -1,3 +1,5 @@
1
+ import type { IWidget } from 'aws-cdk-lib/aws-cloudwatch';
2
+ import type { ScopeOptions } from '../../common/index.js';
1
3
  import { Scope } from '../index.js';
2
4
  /**
3
5
  * Base class for a Blocks *compute* — a runtime that executes handler code
@@ -10,11 +12,17 @@ import { Scope } from '../index.js';
10
12
  * compute in an app runs the same backend and agrees on the resource-name
11
13
  * namespace.
12
14
  *
15
+ * **Observability is compute-owned at deploy time.** Logging is always on (a
16
+ * compute owns its log group and captures stdout; retention is a compute-level
17
+ * setting), so there is no "enable logging" — logs always exist. Tracing, by
18
+ * contrast, provisions real infrastructure (X-Ray) and has cost, so it is
19
+ * enabled explicitly via {@link enableTracing} — which the framework calls on
20
+ * every compute when the app contains a `Tracer` (presence-gated).
21
+ *
13
22
  * The abstract base lives in core (a framework primitive); concrete computes
14
23
  * live in their own packages (e.g. `LambdaCompute` in `@aws-blocks/bb-lambda-compute`).
15
24
  *
16
- * @internal Not exported from the package's public entry points. Customers
17
- * cannot instantiate a compute until the customer-facing surface exists.
25
+ * @internal Not exported from the package's public entry points.
18
26
  */
19
27
  export declare abstract class Compute extends Scope {
20
28
  /**
@@ -23,11 +31,83 @@ export declare abstract class Compute extends Scope {
23
31
  * unpopulated (no compute assignment surface yet).
24
32
  */
25
33
  readonly namespaces: string[];
34
+ /**
35
+ * Whether tracing has been enabled on this compute — flipped by
36
+ * {@link enableTracing}. Private so it can't be set independently of the
37
+ * infra; read internally by {@link dashboardSection} to decide whether to
38
+ * render the traces section.
39
+ */
40
+ private tracerEnabled;
41
+ /** Read-only view of {@link tracerEnabled} for subclasses (e.g. to guard
42
+ * their `tracingWidgets` builder). Subclasses can read but not set it. */
43
+ protected get isTracerEnabled(): boolean;
44
+ constructor(id: string, options?: ScopeOptions);
26
45
  /**
27
46
  * Inject a runtime configuration value (an environment variable) into this
28
47
  * compute. The framework calls this instead of `handler.addEnvironment()`
29
48
  * directly so config targets the right compute.
30
49
  */
31
50
  abstract setEnv(key: string, value: string): void;
51
+ /**
52
+ * Enable distributed tracing on this compute: mark it traced (so the Dashboard
53
+ * renders its traces section) and turn on the compute's active tracing via
54
+ * {@link applyTracing}. Idempotent — the framework calls this on **every**
55
+ * compute when the app contains a `Tracer` (tracing is presence-gated, not
56
+ * per-compute), so calling it more than once is a no-op.
57
+ */
58
+ enableTracing(): void;
59
+ /**
60
+ * Turn on this compute's active tracing (e.g. X-Ray) and grant its role the
61
+ * permission to publish trace segments. Called by {@link enableTracing};
62
+ * `protected` so tracing can't be turned on without marking the compute
63
+ * traced.
64
+ */
65
+ protected abstract applyTracing(): void;
66
+ /**
67
+ * Build this compute's CloudWatch Dashboard section: health widgets and log
68
+ * widgets **always** (logs are always captured for a compute), plus trace
69
+ * widgets **only when** tracing is enabled on this compute (via
70
+ * {@link enableTracing}).
71
+ *
72
+ * This is the single public entry the Dashboard Building Block uses; the
73
+ * per-kind builders below are `protected`. Whether the logs / traces sections
74
+ * are actually shown is a display choice the Dashboard makes on top (its
75
+ * `logs` / `traces` options) — this returns what the compute *has*.
76
+ *
77
+ * @param region - AWS region the widgets query metrics in.
78
+ */
79
+ dashboardSection(region: string): ComputeDashboardSection;
80
+ /**
81
+ * Build this compute's health widget rows. Implemented by a concrete compute;
82
+ * obtained only via {@link dashboardSection}.
83
+ */
84
+ protected abstract healthWidgets(region: string): IWidget[][];
85
+ /**
86
+ * Build this compute's **log** widget rows for its own log group. Logs always
87
+ * exist, so this is always available; the Dashboard's `logs` option decides
88
+ * whether to render it.
89
+ */
90
+ protected abstract loggingWidgets(region: string): IWidget[][];
91
+ /**
92
+ * Build this compute's **trace** widget rows. Gated behind
93
+ * {@link dashboardSection} so it is only used when tracing is enabled.
94
+ */
95
+ protected abstract tracingWidgets(region: string): IWidget[][];
96
+ }
97
+ /**
98
+ * A compute's self-reported CloudWatch Dashboard section. `health` and `logging`
99
+ * are always present; `tracing` is populated only when tracing is enabled on the
100
+ * compute. (The Dashboard may still hide `logging` / `tracing` via its display
101
+ * options.)
102
+ */
103
+ export interface ComputeDashboardSection {
104
+ /** Display label used as the compute's group header. */
105
+ label: string;
106
+ /** Health widget rows — always present. */
107
+ health: IWidget[][];
108
+ /** Log widget rows — always present (logs are always captured). */
109
+ logging?: IWidget[][];
110
+ /** Trace widget rows — present only when tracing is enabled. */
111
+ tracing?: IWidget[][];
32
112
  }
33
113
  //# sourceMappingURL=compute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../../src/cdk/compute/compute.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,8BAAsB,OAAQ,SAAQ,KAAK;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CACjD"}
1
+ {"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../../src/cdk/compute/compute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,OAAQ,SAAQ,KAAK;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IAEnC;;;;;OAKG;IACH,OAAO,CAAC,aAAa,CAAS;IAE9B;8EAC0E;IAC1E,SAAS,KAAK,eAAe,IAAI,OAAO,CAEvC;gBAEW,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAQ9C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAEjD;;;;;;OAMG;IACH,aAAa,IAAI,IAAI;IAMrB;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI;IAEvC;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB;IAWzD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE;IAE7D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE;IAE9D;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE;CAC9D;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACvC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;IACpB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;IACtB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;CACtB"}
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { Scope } from '../index.js';
4
+ import { registerCompute } from './compute-registry.js';
4
5
  /**
5
6
  * Base class for a Blocks *compute* — a runtime that executes handler code
6
7
  * (Lambda today; containers later). A compute owns the physical function/service
@@ -12,11 +13,17 @@ import { Scope } from '../index.js';
12
13
  * compute in an app runs the same backend and agrees on the resource-name
13
14
  * namespace.
14
15
  *
16
+ * **Observability is compute-owned at deploy time.** Logging is always on (a
17
+ * compute owns its log group and captures stdout; retention is a compute-level
18
+ * setting), so there is no "enable logging" — logs always exist. Tracing, by
19
+ * contrast, provisions real infrastructure (X-Ray) and has cost, so it is
20
+ * enabled explicitly via {@link enableTracing} — which the framework calls on
21
+ * every compute when the app contains a `Tracer` (presence-gated).
22
+ *
15
23
  * The abstract base lives in core (a framework primitive); concrete computes
16
24
  * live in their own packages (e.g. `LambdaCompute` in `@aws-blocks/bb-lambda-compute`).
17
25
  *
18
- * @internal Not exported from the package's public entry points. Customers
19
- * cannot instantiate a compute until the customer-facing surface exists.
26
+ * @internal Not exported from the package's public entry points.
20
27
  */
21
28
  export class Compute extends Scope {
22
29
  /**
@@ -25,4 +32,59 @@ export class Compute extends Scope {
25
32
  * unpopulated (no compute assignment surface yet).
26
33
  */
27
34
  namespaces = [];
35
+ /**
36
+ * Whether tracing has been enabled on this compute — flipped by
37
+ * {@link enableTracing}. Private so it can't be set independently of the
38
+ * infra; read internally by {@link dashboardSection} to decide whether to
39
+ * render the traces section.
40
+ */
41
+ tracerEnabled = false;
42
+ /** Read-only view of {@link tracerEnabled} for subclasses (e.g. to guard
43
+ * their `tracingWidgets` builder). Subclasses can read but not set it. */
44
+ get isTracerEnabled() {
45
+ return this.tracerEnabled;
46
+ }
47
+ constructor(id, options) {
48
+ super(id, options);
49
+ // Self-register on the owning stack so finalize steps (tracing, routing,
50
+ // dashboards) can enumerate every compute without a separate discovery
51
+ // pass. Scoped per stack, so a multi-stack synth keeps lists isolated.
52
+ registerCompute(this);
53
+ }
54
+ /**
55
+ * Enable distributed tracing on this compute: mark it traced (so the Dashboard
56
+ * renders its traces section) and turn on the compute's active tracing via
57
+ * {@link applyTracing}. Idempotent — the framework calls this on **every**
58
+ * compute when the app contains a `Tracer` (tracing is presence-gated, not
59
+ * per-compute), so calling it more than once is a no-op.
60
+ */
61
+ enableTracing() {
62
+ if (this.tracerEnabled)
63
+ return;
64
+ this.tracerEnabled = true;
65
+ this.applyTracing();
66
+ }
67
+ /**
68
+ * Build this compute's CloudWatch Dashboard section: health widgets and log
69
+ * widgets **always** (logs are always captured for a compute), plus trace
70
+ * widgets **only when** tracing is enabled on this compute (via
71
+ * {@link enableTracing}).
72
+ *
73
+ * This is the single public entry the Dashboard Building Block uses; the
74
+ * per-kind builders below are `protected`. Whether the logs / traces sections
75
+ * are actually shown is a display choice the Dashboard makes on top (its
76
+ * `logs` / `traces` options) — this returns what the compute *has*.
77
+ *
78
+ * @param region - AWS region the widgets query metrics in.
79
+ */
80
+ dashboardSection(region) {
81
+ return {
82
+ // The scope id (e.g. 'DefaultCompute', 'api') — short and readable for a
83
+ // section header, and distinct per compute within a stack.
84
+ label: this.id,
85
+ health: this.healthWidgets(region),
86
+ logging: this.loggingWidgets(region),
87
+ tracing: this.tracerEnabled ? this.tracingWidgets(region) : undefined,
88
+ };
89
+ }
28
90
  }
@@ -16,6 +16,7 @@ export interface LambdaShapedCompute extends Compute {
16
16
  readonly fn: cdk.aws_lambda_nodejs.NodejsFunction;
17
17
  readonly apiGateway: cdk.aws_apigateway.RestApi;
18
18
  readonly apiUrl: string;
19
+ readonly logGroup: cdk.aws_logs.ILogGroup;
19
20
  }
20
21
  /**
21
22
  * Builds the default {@link Compute} for a stack/backend. `create()` reads it
@@ -1 +1 @@
1
- {"version":3,"file":"default-compute-factory.d.ts","sourceRoot":"","sources":["../../../src/cdk/compute/default-compute-factory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO;IACnD,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,KAAK,OAAO,CAAC"}
1
+ {"version":3,"file":"default-compute-factory.d.ts","sourceRoot":"","sources":["../../../src/cdk/compute/default-compute-factory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO;IACnD,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;CAC1C;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,KAAK,OAAO,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as cdk from 'aws-cdk-lib';
2
2
  import type { Construct } from 'constructs';
3
+ import type { Compute } from './compute/compute.js';
3
4
  /**
4
5
  * Register a config entry for a Building Block. This replaces
5
6
  * `handler.addEnvironment(key, value)` for BB resource mappings.
@@ -12,15 +13,44 @@ import type { Construct } from 'constructs';
12
13
  * @param value - The config value (can be a CDK token that resolves at deploy time)
13
14
  */
14
15
  export declare function registerConfig(scope: Construct, key: string, value: unknown): void;
16
+ /**
17
+ * Ensure the shared config bucket exists and return where the config JSON lives
18
+ * (`{ bucketName, key }`). The bucket is created **once per stack** (memoized on
19
+ * the registry) and this is idempotent — the first caller creates it, later
20
+ * callers get the same bucket regardless of order.
21
+ *
22
+ * Any compute that loads config at runtime (`loadConfigToProcessEnv()`) injects
23
+ * these two values as `BLOCKS_CONFIG_BUCKET` / `BLOCKS_CONFIG_KEY`. The Lambda
24
+ * handler gets them from {@link finalizeConfigRegistry}; other compute that runs
25
+ * as the shared execution role (e.g. the Agent BB's AgentCore Runtime) calls this
26
+ * at construction to inject them too, so it loads the same app config the handler
27
+ * does. IAM is not granted here — `finalizeConfigRegistry` grants read on the config
28
+ * object to the shared execution role, which such compute inherits.
29
+ *
30
+ * @param scope - Any construct in the stack; the bucket is created under the stack.
31
+ */
32
+ export declare function getConfigLocation(scope: Construct): {
33
+ bucketName: string;
34
+ key: string;
35
+ };
15
36
  /**
16
37
  * Finalize the config registry: create an S3 bucket, upload the config JSON,
17
- * set env vars on the handler, and grant read access.
38
+ * grant read to the shared execution role, and stamp the config coordinates
39
+ * (`BLOCKS_CONFIG_BUCKET` / `BLOCKS_CONFIG_KEY`) onto every compute.
40
+ *
41
+ * Read access is granted once to the shared role (`root.executionRole`) rather
42
+ * than to a single function, so every compute that assumes the role can read
43
+ * the object. The bucket/key coordinates can't live on a role (env vars are
44
+ * per-compute), so they are set on each compute via `setEnv`.
18
45
  *
19
46
  * Must be called after all BBs are constructed (i.e., after the backendCDKPath
20
47
  * import completes in BlocksStack.create() / BlocksBackend.create()).
21
48
  *
22
- * @param scope - The CDK construct to create resources under
23
- * @param handler - The Lambda function that needs to read the config
49
+ * @param root - The construct to create the config resources under (also used
50
+ * to locate the owning stack).
51
+ * @param executionRole - The shared role every compute assumes; config read is
52
+ * granted to it once.
53
+ * @param computes - The computes to stamp `BLOCKS_CONFIG_BUCKET` / `BLOCKS_CONFIG_KEY` on.
24
54
  */
25
- export declare function finalizeConfigRegistry(scope: Construct, handler: cdk.aws_lambda.IFunction): void;
55
+ export declare function finalizeConfigRegistry(root: Construct, executionRole: cdk.aws_iam.IRole, computes: readonly Compute[]): void;
26
56
  //# sourceMappingURL=config-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-registry.d.ts","sourceRoot":"","sources":["../../src/cdk/config-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAInC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAuB5C;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAIlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,SAAS,GAC/B,IAAI,CA6CN"}
1
+ {"version":3,"file":"config-registry.d.ts","sourceRoot":"","sources":["../../src/cdk/config-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AA4BpD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAIlF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAEvF;AA6BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAChC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC1B,IAAI,CAyCN"}