@middy/service-discovery 3.1.1 → 3.2.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 (2) hide show
  1. package/index.d.ts +23 -5
  2. package/package.json +5 -4
package/index.d.ts CHANGED
@@ -1,13 +1,31 @@
1
- import ServiceDiscovery from 'aws-sdk/clients/servicediscovery'
2
1
  import middy from '@middy/core'
3
2
  import { Options as MiddyOptions } from '@middy/util'
3
+ import { Context as LambdaContext } from 'aws-lambda'
4
+ import ServiceDiscovery, {
5
+ HttpInstanceSummaryList
6
+ } from 'aws-sdk/clients/servicediscovery'
4
7
 
5
8
  interface Options<S = ServiceDiscovery>
6
- extends Pick<MiddyOptions<S, ServiceDiscovery.Types.ClientConfiguration>,
7
- 'AwsClient' | 'awsClientOptions' | 'awsClientCapture' |
8
- 'fetchData' | 'disablePrefetch' | 'cacheKey' | 'cacheExpiry' | 'setToContext'> {
9
+ extends Pick<
10
+ MiddyOptions<S, ServiceDiscovery.Types.ClientConfiguration>,
11
+ | 'AwsClient'
12
+ | 'awsClientOptions'
13
+ | 'awsClientCapture'
14
+ | 'fetchData'
15
+ | 'disablePrefetch'
16
+ | 'cacheKey'
17
+ | 'cacheExpiry'
18
+ | 'setToContext'
19
+ > {}
20
+
21
+ export type Context<TOptions extends Options | undefined> = TOptions extends {
22
+ setToContext: true
9
23
  }
24
+ ? LambdaContext & Record<keyof TOptions['fetchData'], HttpInstanceSummaryList>
25
+ : LambdaContext
10
26
 
11
- declare function serviceDiscovery (options?: Options): middy.MiddlewareObj
27
+ declare function serviceDiscovery<TOptions extends Options | undefined> (
28
+ options?: TOptions
29
+ ): middy.MiddlewareObj<unknown, any, Error, Context<TOptions>>
12
30
 
13
31
  export default serviceDiscovery
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/service-discovery",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Service Discovery (Cloud Map) instances middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -61,12 +61,13 @@
61
61
  },
62
62
  "homepage": "https://middy.js.org",
63
63
  "dependencies": {
64
- "@middy/util": "3.1.1"
64
+ "@middy/util": "3.2.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@middy/core": "3.1.1",
67
+ "@middy/core": "3.2.0",
68
+ "@types/aws-lambda": "^8.10.101",
68
69
  "aws-sdk": "^2.939.0",
69
70
  "aws-xray-sdk": "^3.3.3"
70
71
  },
71
- "gitHead": "d53fc91d035b01d3fd296cb6c7d0acd8305e9f76"
72
+ "gitHead": "ac46270daa388b52a81472ae8f9b8808a0136940"
72
73
  }