@cdk8s/awscdk-resolver 0.0.407 → 0.0.409

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.
package/.jsii CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://aws.amazon.com"
8
8
  },
9
9
  "bundled": {
10
- "@aws-sdk/client-cloudformation": "^3.932.0"
10
+ "@aws-sdk/client-cloudformation": "^3.933.0"
11
11
  },
12
12
  "dependencies": {
13
13
  "aws-cdk-lib": "^2.195.0",
@@ -3993,7 +3993,7 @@
3993
3993
  "stability": "stable"
3994
3994
  },
3995
3995
  "homepage": "https://github.com/cdk8s-team/cdk8s-awscdk-resolver.git",
3996
- "jsiiVersion": "5.9.13 (build cc3e9a8)",
3996
+ "jsiiVersion": "5.9.14 (build 9fc28bd)",
3997
3997
  "license": "Apache-2.0",
3998
3998
  "metadata": {
3999
3999
  "jsii": {
@@ -4082,6 +4082,6 @@
4082
4082
  "symbolId": "src/resolve:AwsCdkResolver"
4083
4083
  }
4084
4084
  },
4085
- "version": "0.0.407",
4086
- "fingerprint": "DdAbRVztBSgFgADbQae3iA/FZ9Jfk5XFiZrSqI0/lTs="
4085
+ "version": "0.0.409",
4086
+ "fingerprint": "gOVcknB0GwsQ2kIhDkRfgm/5bzMa7L8qgbj5Xr+JcAg="
4087
4087
  }
package/lib/resolve.js CHANGED
@@ -61,5 +61,5 @@ class AwsCdkResolver {
61
61
  }
62
62
  exports.AwsCdkResolver = AwsCdkResolver;
63
63
  _a = JSII_RTTI_SYMBOL_1;
64
- AwsCdkResolver[_a] = { fqn: "@cdk8s/awscdk-resolver.AwsCdkResolver", version: "0.0.407" };
64
+ AwsCdkResolver[_a] = { fqn: "@cdk8s/awscdk-resolver.AwsCdkResolver", version: "0.0.409" };
65
65
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzI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E91dHB1dCB3YXMgZGVmaW5lZCBpbiBhIGRpZmZlcmVudCBzdGFjayB0aGFuIHRoZSB0b2tlbnMgY29tcHJpc2luZyBpdHMgdmFsdWUuXG4gICAgLy8gIDMuIE5vbmUgb2YgdGhlIHRva2VucyBjb21wcmlzaW5nIHRoZSB2YWx1ZSBhcmUgYSBSZWZlcmVuY2UuXG4gICAgdGhyb3cgbmV3IEVycm9yKGBVbmFibGUgdG8gZmluZCBvdXRwdXQgZGVmaW5lZCBmb3IgJHt2YWx1ZX0gKEluc3BlY3RlZCBzdGFja3M6ICR7aW5zcGVjdGVkU3RhY2tzLm1hcChzID0+IHMuc3RhY2tOYW1lKS5qb2luKCcsJyl9KWApO1xuXG4gIH1cblxuICBwcml2YXRlIGZldGNoT3V0cHV0VmFsdWUob3V0cHV0OiBDZm5PdXRwdXQpIHtcblxuICAgIGNvbnN0IHNjcmlwdCA9IHBhdGguam9pbihfX2Rpcm5hbWUsICcuLicsICdsaWInLCAnZmV0Y2gtb3V0cHV0LXZhbHVlLmpzJyk7XG4gICAgcmV0dXJuIEpTT04ucGFyc2UoZXhlY0ZpbGVTeW5jKHByb2Nlc3MuZXhlY1BhdGgsIFtcbiAgICAgIHNjcmlwdCxcbiAgICAgIFN0YWNrLm9mKG91dHB1dCkuc3RhY2tOYW1lLFxuICAgICAgb3V0cHV0Lm5vZGUuaWQsXG4gICAgXSwgeyBlbmNvZGluZzogJ3V0Zi04Jywgc3RkaW86IFsncGlwZSddIH0pLnRvU3RyaW5nKCkudHJpbSgpKTtcblxuICB9XG5cbn1cbiJdfQ==
@@ -33,19 +33,20 @@ export const handler = async (event, context) => {
33
33
  // The RIC has already initialized the InvokeStore with requestId and X-Ray traceId
34
34
 
35
35
  // Access Lambda context data
36
- console.log(`Processing request: ${InvokeStore.getRequestId()}`);
36
+ const invokeStore = await InvokeStore.getInstanceAsync();
37
+ console.log(`Processing request: ${invokeStore.getRequestId()}`);
37
38
 
38
39
  // Store custom data
39
- InvokeStore.set("userId", event.userId);
40
+ invokeStore.set("userId", event.userId);
40
41
 
41
42
  // Data persists across async operations
42
43
  await processData(event);
43
44
 
44
45
  // Retrieve custom data
45
- const userId = InvokeStore.get("userId");
46
+ const userId = invokeStore.get("userId");
46
47
 
47
48
  return {
48
- requestId: InvokeStore.getRequestId(),
49
+ requestId: invokeStore.getRequestId(),
49
50
  userId,
50
51
  };
51
52
  };
@@ -53,89 +54,96 @@ export const handler = async (event, context) => {
53
54
  // Context is preserved in async operations
54
55
  async function processData(event) {
55
56
  // Still has access to the same invoke context
56
- console.log(`Processing in same context: ${InvokeStore.getRequestId()}`);
57
+ const invokeStore = await InvokeStore.getInstanceAsync();
58
+ console.log(`Processing in same context: ${invokeStore.getRequestId()}`);
57
59
 
58
60
  // Can set additional data
59
- InvokeStore.set("processedData", { result: "success" });
61
+ invokeStore.set("processedData", { result: "success" });
60
62
  }
61
63
  ```
62
64
 
63
65
  ## API Reference
64
66
 
65
- ### InvokeStore.getContext()
67
+ ### InvokeStore.getInstanceAsync()
68
+ First, get an instance of the InvokeStore:
69
+ ```typescript
70
+ const invokeStore = await InvokeStore.getInstanceAsync();
71
+ ```
72
+
73
+ ### invokeStore.getContext()
66
74
 
67
75
  Returns the complete current context or `undefined` if outside a context.
68
76
 
69
77
  ```typescript
70
- const context = InvokeStore.getContext();
78
+ const context = invokeStore.getContext();
71
79
  ```
72
80
 
73
- ### InvokeStore.get(key)
81
+ ### invokeStore.get(key)
74
82
 
75
83
  Gets a value from the current context.
76
84
 
77
85
  ```typescript
78
- const requestId = InvokeStore.get(InvokeStore.PROTECTED_KEYS.REQUEST_ID);
79
- const customValue = InvokeStore.get("customKey");
86
+ const requestId = invokeStore.get(InvokeStoreBase.PROTECTED_KEYS.REQUEST_ID);
87
+ const customValue = invokeStore.get("customKey");
80
88
  ```
81
89
 
82
- ### InvokeStore.set(key, value)
90
+ ### invokeStore.set(key, value)
83
91
 
84
92
  Sets a custom value in the current context. Protected Lambda fields cannot be modified.
85
93
 
86
94
  ```typescript
87
- InvokeStore.set("userId", "user-123");
88
- InvokeStore.set("timestamp", Date.now());
95
+ invokeStore.set("userId", "user-123");
96
+ invokeStore.set("timestamp", Date.now());
89
97
 
90
98
  // This will throw an error:
91
- // InvokeStore.set(InvokeStore.PROTECTED_KEYS.REQUEST_ID, 'new-id');
99
+ // invokeStore.set(InvokeStoreBase.PROTECTED_KEYS.REQUEST_ID, 'new-id');
92
100
  ```
93
101
 
94
- ### InvokeStore.getRequestId()
102
+ ### invokeStore.getRequestId()
95
103
 
96
104
  Convenience method to get the current request ID.
97
105
 
98
106
  ```typescript
99
- const requestId = InvokeStore.getRequestId(); // Returns '-' if outside context
107
+ const requestId = invokeStore.getRequestId(); // Returns '-' if outside context
100
108
  ```
101
109
 
102
- ### InvokeStore.getTenantId()
110
+ ### invokeStore.getTenantId()
103
111
 
104
112
  Convenience method to get the tenant ID.
105
113
 
106
114
  ```typescript
107
- const requestId = InvokeStore.getTenantId();
115
+ const requestId = invokeStore.getTenantId();
108
116
  ```
109
117
 
110
- ### InvokeStore.getXRayTraceId()
118
+ ### invokeStore.getXRayTraceId()
111
119
 
112
120
  Convenience method to get the current [X-Ray trace ID](https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-traces). This ID is used for distributed tracing across AWS services.
113
121
 
114
122
  ```typescript
115
- const traceId = InvokeStore.getXRayTraceId(); // Returns undefined if not set or outside context
123
+ const traceId = invokeStore.getXRayTraceId(); // Returns undefined if not set or outside context
116
124
  ```
117
125
 
118
- ### InvokeStore.hasContext()
126
+ ### invokeStore.hasContext()
119
127
 
120
128
  Checks if code is currently running within an invoke context.
121
129
 
122
130
  ```typescript
123
- if (InvokeStore.hasContext()) {
131
+ if (invokeStore.hasContext()) {
124
132
  // We're inside an invoke context
125
133
  }
126
134
  ```
127
135
 
128
- ### InvokeStore.run(context, fn)
136
+ ### invokeStore.run(context, fn)
129
137
 
130
138
  > **Note**: This method is primarily used by the Lambda Runtime Interface Client (RIC) to initialize the context for each invocation. Lambda function developers typically don't need to call this method directly.
131
139
 
132
140
  Runs a function within an invoke context.
133
141
 
134
142
  ```typescript
135
- InvokeStore.run(
143
+ invokeStore.run(
136
144
  {
137
- [InvokeStore.PROTECTED_KEYS.REQUEST_ID]: "request-123",
138
- [InvokeStore.PROTECTED_KEYS.X_RAY_TRACE_ID]: "trace-456", // Optional X-Ray trace ID
145
+ [InvokeStoreBase.PROTECTED_KEYS.REQUEST_ID]: "request-123",
146
+ [InvokeStoreBase.PROTECTED_KEYS.X_RAY_TRACE_ID]: "trace-456", // Optional X-Ray trace ID
139
147
  customField: "value", // Optional custom fields
140
148
  },
141
149
  () => {
@@ -1,66 +1,124 @@
1
1
  'use strict';
2
2
 
3
- var async_hooks = require('async_hooks');
4
-
5
- const noGlobalAwsLambda = process.env["AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA"] === "1" ||
6
- process.env["AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA"] === "true";
7
- if (!noGlobalAwsLambda) {
8
- globalThis.awslambda = globalThis.awslambda || {};
9
- }
10
3
  const PROTECTED_KEYS = {
11
- REQUEST_ID: Symbol("_AWS_LAMBDA_REQUEST_ID"),
12
- X_RAY_TRACE_ID: Symbol("_AWS_LAMBDA_X_RAY_TRACE_ID"),
13
- TENANT_ID: Symbol("_AWS_LAMBDA_TENANT_ID"),
4
+ REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
5
+ X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
6
+ TENANT_ID: Symbol.for("_AWS_LAMBDA_TENANT_ID"),
14
7
  };
15
- class InvokeStoreImpl {
16
- static storage = new async_hooks.AsyncLocalStorage();
8
+ const NO_GLOBAL_AWS_LAMBDA = ["true", "1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA ?? "");
9
+ if (!NO_GLOBAL_AWS_LAMBDA) {
10
+ globalThis.awslambda = globalThis.awslambda || {};
11
+ }
12
+ class InvokeStoreBase {
17
13
  static PROTECTED_KEYS = PROTECTED_KEYS;
18
- static run(context, fn) {
19
- return this.storage.run({ ...context }, fn);
14
+ isProtectedKey(key) {
15
+ return Object.values(PROTECTED_KEYS).includes(key);
16
+ }
17
+ getRequestId() {
18
+ return this.get(PROTECTED_KEYS.REQUEST_ID) ?? "-";
20
19
  }
21
- static getContext() {
22
- return this.storage.getStore();
20
+ getXRayTraceId() {
21
+ return this.get(PROTECTED_KEYS.X_RAY_TRACE_ID);
23
22
  }
24
- static get(key) {
25
- const context = this.storage.getStore();
26
- return context?.[key];
23
+ getTenantId() {
24
+ return this.get(PROTECTED_KEYS.TENANT_ID);
27
25
  }
28
- static set(key, value) {
26
+ }
27
+ class InvokeStoreSingle extends InvokeStoreBase {
28
+ currentContext;
29
+ getContext() {
30
+ return this.currentContext;
31
+ }
32
+ hasContext() {
33
+ return this.currentContext !== undefined;
34
+ }
35
+ get(key) {
36
+ return this.currentContext?.[key];
37
+ }
38
+ set(key, value) {
29
39
  if (this.isProtectedKey(key)) {
30
- throw new Error(`Cannot modify protected Lambda context field`);
40
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
31
41
  }
32
- const context = this.storage.getStore();
33
- if (context) {
34
- context[key] = value;
42
+ this.currentContext = this.currentContext || {};
43
+ this.currentContext[key] = value;
44
+ }
45
+ run(context, fn) {
46
+ this.currentContext = context;
47
+ try {
48
+ return fn();
35
49
  }
50
+ finally {
51
+ this.currentContext = undefined;
52
+ }
53
+ }
54
+ }
55
+ class InvokeStoreMulti extends InvokeStoreBase {
56
+ als;
57
+ static async create() {
58
+ const instance = new InvokeStoreMulti();
59
+ const asyncHooks = await import('node:async_hooks');
60
+ instance.als = new asyncHooks.AsyncLocalStorage();
61
+ return instance;
36
62
  }
37
- static getRequestId() {
38
- return this.get(this.PROTECTED_KEYS.REQUEST_ID) ?? "-";
63
+ getContext() {
64
+ return this.als.getStore();
39
65
  }
40
- static getXRayTraceId() {
41
- return this.get(this.PROTECTED_KEYS.X_RAY_TRACE_ID);
66
+ hasContext() {
67
+ return this.als.getStore() !== undefined;
42
68
  }
43
- static getTenantId() {
44
- return this.get(this.PROTECTED_KEYS.TENANT_ID);
69
+ get(key) {
70
+ return this.als.getStore()?.[key];
45
71
  }
46
- static hasContext() {
47
- return this.storage.getStore() !== undefined;
72
+ set(key, value) {
73
+ if (this.isProtectedKey(key)) {
74
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
75
+ }
76
+ const store = this.als.getStore();
77
+ if (!store) {
78
+ throw new Error("No context available");
79
+ }
80
+ store[key] = value;
48
81
  }
49
- static isProtectedKey(key) {
50
- return (key === this.PROTECTED_KEYS.REQUEST_ID ||
51
- key === this.PROTECTED_KEYS.X_RAY_TRACE_ID);
82
+ run(context, fn) {
83
+ return this.als.run(context, fn);
52
84
  }
53
85
  }
54
- let instance;
55
- if (!noGlobalAwsLambda && globalThis.awslambda?.InvokeStore) {
56
- instance = globalThis.awslambda.InvokeStore;
57
- }
58
- else {
59
- instance = InvokeStoreImpl;
60
- if (!noGlobalAwsLambda && globalThis.awslambda) {
61
- globalThis.awslambda.InvokeStore = instance;
86
+ exports.InvokeStore = void 0;
87
+ (function (InvokeStore) {
88
+ let instance = null;
89
+ async function getInstanceAsync() {
90
+ if (!instance) {
91
+ instance = (async () => {
92
+ const isMulti = "AWS_LAMBDA_MAX_CONCURRENCY" in process.env;
93
+ const newInstance = isMulti
94
+ ? await InvokeStoreMulti.create()
95
+ : new InvokeStoreSingle();
96
+ if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda?.InvokeStore) {
97
+ return globalThis.awslambda.InvokeStore;
98
+ }
99
+ else if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda) {
100
+ globalThis.awslambda.InvokeStore = newInstance;
101
+ return newInstance;
102
+ }
103
+ else {
104
+ return newInstance;
105
+ }
106
+ })();
107
+ }
108
+ return instance;
62
109
  }
63
- }
64
- const InvokeStore = instance;
110
+ InvokeStore.getInstanceAsync = getInstanceAsync;
111
+ InvokeStore._testing = process.env.AWS_LAMBDA_BENCHMARK_MODE === "1"
112
+ ? {
113
+ reset: () => {
114
+ instance = null;
115
+ if (globalThis.awslambda?.InvokeStore) {
116
+ delete globalThis.awslambda.InvokeStore;
117
+ }
118
+ globalThis.awslambda = {};
119
+ },
120
+ }
121
+ : undefined;
122
+ })(exports.InvokeStore || (exports.InvokeStore = {}));
65
123
 
66
- exports.InvokeStore = InvokeStore;
124
+ exports.InvokeStoreBase = InvokeStoreBase;
@@ -1,64 +1,122 @@
1
- import { AsyncLocalStorage } from 'async_hooks';
2
-
3
- const noGlobalAwsLambda = process.env["AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA"] === "1" ||
4
- process.env["AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA"] === "true";
5
- if (!noGlobalAwsLambda) {
6
- globalThis.awslambda = globalThis.awslambda || {};
7
- }
8
1
  const PROTECTED_KEYS = {
9
- REQUEST_ID: Symbol("_AWS_LAMBDA_REQUEST_ID"),
10
- X_RAY_TRACE_ID: Symbol("_AWS_LAMBDA_X_RAY_TRACE_ID"),
11
- TENANT_ID: Symbol("_AWS_LAMBDA_TENANT_ID"),
2
+ REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
3
+ X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
4
+ TENANT_ID: Symbol.for("_AWS_LAMBDA_TENANT_ID"),
12
5
  };
13
- class InvokeStoreImpl {
14
- static storage = new AsyncLocalStorage();
6
+ const NO_GLOBAL_AWS_LAMBDA = ["true", "1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA ?? "");
7
+ if (!NO_GLOBAL_AWS_LAMBDA) {
8
+ globalThis.awslambda = globalThis.awslambda || {};
9
+ }
10
+ class InvokeStoreBase {
15
11
  static PROTECTED_KEYS = PROTECTED_KEYS;
16
- static run(context, fn) {
17
- return this.storage.run({ ...context }, fn);
12
+ isProtectedKey(key) {
13
+ return Object.values(PROTECTED_KEYS).includes(key);
14
+ }
15
+ getRequestId() {
16
+ return this.get(PROTECTED_KEYS.REQUEST_ID) ?? "-";
18
17
  }
19
- static getContext() {
20
- return this.storage.getStore();
18
+ getXRayTraceId() {
19
+ return this.get(PROTECTED_KEYS.X_RAY_TRACE_ID);
21
20
  }
22
- static get(key) {
23
- const context = this.storage.getStore();
24
- return context?.[key];
21
+ getTenantId() {
22
+ return this.get(PROTECTED_KEYS.TENANT_ID);
25
23
  }
26
- static set(key, value) {
24
+ }
25
+ class InvokeStoreSingle extends InvokeStoreBase {
26
+ currentContext;
27
+ getContext() {
28
+ return this.currentContext;
29
+ }
30
+ hasContext() {
31
+ return this.currentContext !== undefined;
32
+ }
33
+ get(key) {
34
+ return this.currentContext?.[key];
35
+ }
36
+ set(key, value) {
27
37
  if (this.isProtectedKey(key)) {
28
- throw new Error(`Cannot modify protected Lambda context field`);
38
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
29
39
  }
30
- const context = this.storage.getStore();
31
- if (context) {
32
- context[key] = value;
40
+ this.currentContext = this.currentContext || {};
41
+ this.currentContext[key] = value;
42
+ }
43
+ run(context, fn) {
44
+ this.currentContext = context;
45
+ try {
46
+ return fn();
33
47
  }
48
+ finally {
49
+ this.currentContext = undefined;
50
+ }
51
+ }
52
+ }
53
+ class InvokeStoreMulti extends InvokeStoreBase {
54
+ als;
55
+ static async create() {
56
+ const instance = new InvokeStoreMulti();
57
+ const asyncHooks = await import('node:async_hooks');
58
+ instance.als = new asyncHooks.AsyncLocalStorage();
59
+ return instance;
34
60
  }
35
- static getRequestId() {
36
- return this.get(this.PROTECTED_KEYS.REQUEST_ID) ?? "-";
61
+ getContext() {
62
+ return this.als.getStore();
37
63
  }
38
- static getXRayTraceId() {
39
- return this.get(this.PROTECTED_KEYS.X_RAY_TRACE_ID);
64
+ hasContext() {
65
+ return this.als.getStore() !== undefined;
40
66
  }
41
- static getTenantId() {
42
- return this.get(this.PROTECTED_KEYS.TENANT_ID);
67
+ get(key) {
68
+ return this.als.getStore()?.[key];
43
69
  }
44
- static hasContext() {
45
- return this.storage.getStore() !== undefined;
70
+ set(key, value) {
71
+ if (this.isProtectedKey(key)) {
72
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
73
+ }
74
+ const store = this.als.getStore();
75
+ if (!store) {
76
+ throw new Error("No context available");
77
+ }
78
+ store[key] = value;
46
79
  }
47
- static isProtectedKey(key) {
48
- return (key === this.PROTECTED_KEYS.REQUEST_ID ||
49
- key === this.PROTECTED_KEYS.X_RAY_TRACE_ID);
80
+ run(context, fn) {
81
+ return this.als.run(context, fn);
50
82
  }
51
83
  }
52
- let instance;
53
- if (!noGlobalAwsLambda && globalThis.awslambda?.InvokeStore) {
54
- instance = globalThis.awslambda.InvokeStore;
55
- }
56
- else {
57
- instance = InvokeStoreImpl;
58
- if (!noGlobalAwsLambda && globalThis.awslambda) {
59
- globalThis.awslambda.InvokeStore = instance;
84
+ var InvokeStore;
85
+ (function (InvokeStore) {
86
+ let instance = null;
87
+ async function getInstanceAsync() {
88
+ if (!instance) {
89
+ instance = (async () => {
90
+ const isMulti = "AWS_LAMBDA_MAX_CONCURRENCY" in process.env;
91
+ const newInstance = isMulti
92
+ ? await InvokeStoreMulti.create()
93
+ : new InvokeStoreSingle();
94
+ if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda?.InvokeStore) {
95
+ return globalThis.awslambda.InvokeStore;
96
+ }
97
+ else if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda) {
98
+ globalThis.awslambda.InvokeStore = newInstance;
99
+ return newInstance;
100
+ }
101
+ else {
102
+ return newInstance;
103
+ }
104
+ })();
105
+ }
106
+ return instance;
60
107
  }
61
- }
62
- const InvokeStore = instance;
108
+ InvokeStore.getInstanceAsync = getInstanceAsync;
109
+ InvokeStore._testing = process.env.AWS_LAMBDA_BENCHMARK_MODE === "1"
110
+ ? {
111
+ reset: () => {
112
+ instance = null;
113
+ if (globalThis.awslambda?.InvokeStore) {
114
+ delete globalThis.awslambda.InvokeStore;
115
+ }
116
+ globalThis.awslambda = {};
117
+ },
118
+ }
119
+ : undefined;
120
+ })(InvokeStore || (InvokeStore = {}));
63
121
 
64
- export { InvokeStore };
122
+ export { InvokeStore, InvokeStoreBase };
@@ -1,57 +1,50 @@
1
- /**
2
- * Generic store context that uses protected keys for Lambda fields
3
- * and allows custom user properties
4
- */
5
- export interface InvokeStoreContext {
6
- [key: string | symbol]: unknown;
1
+ interface Context {
2
+ [key: string]: unknown;
3
+ [key: symbol]: unknown;
4
+ }
5
+ declare global {
6
+ var awslambda: {
7
+ InvokeStore?: InvokeStoreBase;
8
+ [key: string]: unknown;
9
+ };
7
10
  }
8
11
  /**
9
- * InvokeStore implementation class
12
+ * Base class for AWS Lambda context storage implementations.
13
+ * Provides core functionality for managing Lambda execution context.
14
+ *
15
+ * Implementations handle either single-context (InvokeStoreSingle) or
16
+ * multi-context (InvokeStoreMulti) scenarios based on Lambda's execution environment.
17
+ *
18
+ * @public
10
19
  */
11
- declare class InvokeStoreImpl {
12
- private static storage;
20
+ export declare abstract class InvokeStoreBase {
13
21
  static readonly PROTECTED_KEYS: {
14
22
  readonly REQUEST_ID: symbol;
15
23
  readonly X_RAY_TRACE_ID: symbol;
16
24
  readonly TENANT_ID: symbol;
17
25
  };
18
- /**
19
- * Initialize and run code within an invoke context
20
- */
21
- static run<T>(context: InvokeStoreContext, fn: () => T | Promise<T>): T | Promise<T>;
22
- /**
23
- * Get the complete current context
24
- */
25
- static getContext(): InvokeStoreContext | undefined;
26
- /**
27
- * Get a specific value from the context by key
28
- */
29
- static get<T = unknown>(key: string | symbol): T | undefined;
30
- /**
31
- * Set a custom value in the current context
32
- * Protected Lambda context fields cannot be overwritten
33
- */
34
- static set(key: string | symbol, value: unknown): void;
35
- /**
36
- * Get the current request ID
37
- */
38
- static getRequestId(): string;
39
- /**
40
- * Get the current X-ray trace ID
41
- */
42
- static getXRayTraceId(): string | undefined;
43
- /**
44
- * Get the current tenant ID
45
- */
46
- static getTenantId(): string | undefined;
47
- /**
48
- * Check if we're currently within an invoke context
49
- */
50
- static hasContext(): boolean;
51
- /**
52
- * Check if a key is protected (readonly Lambda context field)
53
- */
54
- private static isProtectedKey;
26
+ abstract getContext(): Context | undefined;
27
+ abstract hasContext(): boolean;
28
+ abstract get<T = unknown>(key: string | symbol): T | undefined;
29
+ abstract set<T = unknown>(key: string | symbol, value: T): void;
30
+ abstract run<T>(context: Context, fn: () => T): T;
31
+ protected isProtectedKey(key: string | symbol): boolean;
32
+ getRequestId(): string;
33
+ getXRayTraceId(): string | undefined;
34
+ getTenantId(): string | undefined;
35
+ }
36
+ /**
37
+ * Provides access to AWS Lambda execution context storage.
38
+ * Supports both single-context and multi-context environments through different implementations.
39
+ *
40
+ * The store manages protected Lambda context fields and allows storing/retrieving custom values
41
+ * within the execution context.
42
+ * @public
43
+ */
44
+ export declare namespace InvokeStore {
45
+ function getInstanceAsync(): Promise<InvokeStoreBase>;
46
+ const _testing: {
47
+ reset: () => void;
48
+ } | undefined;
55
49
  }
56
- export declare const InvokeStore: typeof InvokeStoreImpl;
57
50
  export {};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/lambda-invoke-store",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Invoke scoped data storage for AWS Lambda Node.js Runtime Environment",
5
5
  "homepage": "https://github.com/awslabs/aws-lambda-invoke-store",
6
6
  "main": "./dist-cjs/invoke-store.js",
@@ -32,7 +32,7 @@
32
32
  "build": "yarn clean && yarn build:types && node ./scripts/build-rollup.js",
33
33
  "build:types": "tsc -p tsconfig.types.json",
34
34
  "clean": "rm -rf dist-types dist-cjs dist-es",
35
- "test": "vitest run",
35
+ "test": "vitest run --reporter verbose",
36
36
  "test:watch": "vitest watch",
37
37
  "release": "yarn build && changeset publish"
38
38
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cloudformation",
3
3
  "description": "AWS SDK for JavaScript Cloudformation Client for Node.js, Browser and React Native",
4
- "version": "3.932.0",
4
+ "version": "3.933.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-cloudformation",
@@ -21,10 +21,10 @@
21
21
  "@aws-crypto/sha256-browser": "5.2.0",
22
22
  "@aws-crypto/sha256-js": "5.2.0",
23
23
  "@aws-sdk/core": "3.932.0",
24
- "@aws-sdk/credential-provider-node": "3.932.0",
24
+ "@aws-sdk/credential-provider-node": "3.933.0",
25
25
  "@aws-sdk/middleware-host-header": "3.930.0",
26
26
  "@aws-sdk/middleware-logger": "3.930.0",
27
- "@aws-sdk/middleware-recursion-detection": "3.930.0",
27
+ "@aws-sdk/middleware-recursion-detection": "3.933.0",
28
28
  "@aws-sdk/middleware-user-agent": "3.932.0",
29
29
  "@aws-sdk/region-config-resolver": "3.930.0",
30
30
  "@aws-sdk/types": "3.930.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sso",
3
3
  "description": "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
4
- "version": "3.932.0",
4
+ "version": "3.933.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -23,7 +23,7 @@
23
23
  "@aws-sdk/core": "3.932.0",
24
24
  "@aws-sdk/middleware-host-header": "3.930.0",
25
25
  "@aws-sdk/middleware-logger": "3.930.0",
26
- "@aws-sdk/middleware-recursion-detection": "3.930.0",
26
+ "@aws-sdk/middleware-recursion-detection": "3.933.0",
27
27
  "@aws-sdk/middleware-user-agent": "3.932.0",
28
28
  "@aws-sdk/region-config-resolver": "3.930.0",
29
29
  "@aws-sdk/types": "3.930.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-ini",
3
- "version": "3.932.0",
3
+ "version": "3.933.0",
4
4
  "description": "AWS credential provider that sources credentials from ~/.aws/credentials and ~/.aws/config",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -32,9 +32,9 @@
32
32
  "@aws-sdk/credential-provider-env": "3.932.0",
33
33
  "@aws-sdk/credential-provider-http": "3.932.0",
34
34
  "@aws-sdk/credential-provider-process": "3.932.0",
35
- "@aws-sdk/credential-provider-sso": "3.932.0",
36
- "@aws-sdk/credential-provider-web-identity": "3.932.0",
37
- "@aws-sdk/nested-clients": "3.932.0",
35
+ "@aws-sdk/credential-provider-sso": "3.933.0",
36
+ "@aws-sdk/credential-provider-web-identity": "3.933.0",
37
+ "@aws-sdk/nested-clients": "3.933.0",
38
38
  "@aws-sdk/types": "3.930.0",
39
39
  "@smithy/credential-provider-imds": "^4.2.5",
40
40
  "@smithy/property-provider": "^4.2.5",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-node",
3
- "version": "3.932.0",
3
+ "version": "3.933.0",
4
4
  "description": "AWS credential provider that sources credentials from a Node.JS environment. ",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -33,10 +33,10 @@
33
33
  "dependencies": {
34
34
  "@aws-sdk/credential-provider-env": "3.932.0",
35
35
  "@aws-sdk/credential-provider-http": "3.932.0",
36
- "@aws-sdk/credential-provider-ini": "3.932.0",
36
+ "@aws-sdk/credential-provider-ini": "3.933.0",
37
37
  "@aws-sdk/credential-provider-process": "3.932.0",
38
- "@aws-sdk/credential-provider-sso": "3.932.0",
39
- "@aws-sdk/credential-provider-web-identity": "3.932.0",
38
+ "@aws-sdk/credential-provider-sso": "3.933.0",
39
+ "@aws-sdk/credential-provider-web-identity": "3.933.0",
40
40
  "@aws-sdk/types": "3.930.0",
41
41
  "@smithy/credential-provider-imds": "^4.2.5",
42
42
  "@smithy/property-provider": "^4.2.5",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-sso",
3
- "version": "3.932.0",
3
+ "version": "3.933.0",
4
4
  "description": "AWS credential provider that exchanges a resolved SSO login token file for temporary AWS credentials",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@aws-sdk/client-sso": "3.932.0",
29
+ "@aws-sdk/client-sso": "3.933.0",
30
30
  "@aws-sdk/core": "3.932.0",
31
- "@aws-sdk/token-providers": "3.932.0",
31
+ "@aws-sdk/token-providers": "3.933.0",
32
32
  "@aws-sdk/types": "3.930.0",
33
33
  "@smithy/property-provider": "^4.2.5",
34
34
  "@smithy/shared-ini-file-loader": "^4.4.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-web-identity",
3
- "version": "3.932.0",
3
+ "version": "3.933.0",
4
4
  "description": "AWS credential provider that calls STS assumeRole for temporary AWS credentials",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -35,7 +35,7 @@
35
35
  "license": "Apache-2.0",
36
36
  "dependencies": {
37
37
  "@aws-sdk/core": "3.932.0",
38
- "@aws-sdk/nested-clients": "3.932.0",
38
+ "@aws-sdk/nested-clients": "3.933.0",
39
39
  "@aws-sdk/types": "3.930.0",
40
40
  "@smithy/property-provider": "^4.2.5",
41
41
  "@smithy/shared-ini-file-loader": "^4.4.0",
@@ -18,7 +18,8 @@ const recursionDetectionMiddleware = () => (next) => async (args) => {
18
18
  }
19
19
  const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
20
20
  const traceIdFromEnv = process.env[ENV_TRACE_ID];
21
- const traceIdFromInvokeStore = lambda_invoke_store_1.InvokeStore.getXRayTraceId();
21
+ const invokeStore = await lambda_invoke_store_1.InvokeStore.getInstanceAsync();
22
+ const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
22
23
  const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
23
24
  const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
24
25
  if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
@@ -15,7 +15,8 @@ export const recursionDetectionMiddleware = () => (next) => async (args) => {
15
15
  }
16
16
  const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
17
17
  const traceIdFromEnv = process.env[ENV_TRACE_ID];
18
- const traceIdFromInvokeStore = InvokeStore.getXRayTraceId();
18
+ const invokeStore = await InvokeStore.getInstanceAsync();
19
+ const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
19
20
  const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
20
21
  const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
21
22
  if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-recursion-detection",
3
- "version": "3.930.0",
3
+ "version": "3.933.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-recursion-detection",
@@ -25,7 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "@aws-sdk/types": "3.930.0",
28
- "@aws/lambda-invoke-store": "^0.1.1",
28
+ "@aws/lambda-invoke-store": "^0.2.0",
29
29
  "@smithy/protocol-http": "^5.3.5",
30
30
  "@smithy/types": "^4.9.0",
31
31
  "tslib": "^2.6.2"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/nested-clients",
3
- "version": "3.932.0",
3
+ "version": "3.933.0",
4
4
  "description": "Nested clients for AWS SDK packages.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -32,7 +32,7 @@
32
32
  "@aws-sdk/core": "3.932.0",
33
33
  "@aws-sdk/middleware-host-header": "3.930.0",
34
34
  "@aws-sdk/middleware-logger": "3.930.0",
35
- "@aws-sdk/middleware-recursion-detection": "3.930.0",
35
+ "@aws-sdk/middleware-recursion-detection": "3.933.0",
36
36
  "@aws-sdk/middleware-user-agent": "3.932.0",
37
37
  "@aws-sdk/region-config-resolver": "3.930.0",
38
38
  "@aws-sdk/types": "3.930.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/token-providers",
3
- "version": "3.932.0",
3
+ "version": "3.933.0",
4
4
  "description": "A collection of token providers",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -30,7 +30,7 @@
30
30
  "license": "Apache-2.0",
31
31
  "dependencies": {
32
32
  "@aws-sdk/core": "3.932.0",
33
- "@aws-sdk/nested-clients": "3.932.0",
33
+ "@aws-sdk/nested-clients": "3.933.0",
34
34
  "@aws-sdk/types": "3.930.0",
35
35
  "@smithy/property-provider": "^4.2.5",
36
36
  "@smithy/shared-ini-file-loader": "^4.4.0",
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "organization": false
43
43
  },
44
44
  "devDependencies": {
45
- "@cdk8s/projen-common": "0.0.640",
45
+ "@cdk8s/projen-common": "0.0.641",
46
46
  "@stylistic/eslint-plugin": "^2",
47
47
  "@types/fs-extra": "^11.0.4",
48
48
  "@types/jest": "^27",
@@ -66,7 +66,7 @@
66
66
  "jsii-docgen": "^10.5.0",
67
67
  "jsii-pacmak": "^1.119.0",
68
68
  "jsii-rosetta": "^5",
69
- "projen": "^0.98.10",
69
+ "projen": "^0.98.11",
70
70
  "ts-jest": "^27",
71
71
  "ts-node": "^10.9.2",
72
72
  "typescript": "^5.9.3"
@@ -77,7 +77,7 @@
77
77
  "constructs": "^10.3.0"
78
78
  },
79
79
  "dependencies": {
80
- "@aws-sdk/client-cloudformation": "^3.932.0"
80
+ "@aws-sdk/client-cloudformation": "^3.933.0"
81
81
  },
82
82
  "bundledDependencies": [
83
83
  "@aws-sdk/client-cloudformation"
@@ -93,7 +93,7 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "version": "0.0.407",
96
+ "version": "0.0.409",
97
97
  "jest": {
98
98
  "coverageProvider": "v8",
99
99
  "testMatch": [