Skip to content

Commit

Permalink
Add getSmithyContext() helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Yuan authored and syall committed Sep 14, 2023
1 parent c0b17a1 commit 5b6fa53
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-vans-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/util-middleware": patch
---

Add `getSmithyContext()` helper function
7 changes: 7 additions & 0 deletions packages/util-middleware/src/getSmithyContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { HandlerExecutionContext, SMITHY_CONTEXT_KEY } from "@smithy/types";

/**
* @internal
*/
export const getSmithyContext = (context: HandlerExecutionContext): Record<string, unknown> =>
context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
4 changes: 4 additions & 0 deletions packages/util-middleware/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @internal
*/
export * from "./getSmithyContext";
/**
* @internal
*/
Expand Down

0 comments on commit 5b6fa53

Please sign in to comment.