@middy/util 5.2.3 → 5.2.6
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/index.d.ts +21 -10
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import middy from '@middy/core'
|
|
2
2
|
import { Context as LambdaContext } from 'aws-lambda'
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
|
+
ArrayValues,
|
|
5
|
+
Choose,
|
|
6
|
+
DeepAwaited,
|
|
7
|
+
IsUnknown,
|
|
8
|
+
SanitizeKey,
|
|
9
|
+
SanitizeKeys
|
|
10
|
+
} from './type-utils.d.ts'
|
|
4
11
|
|
|
5
12
|
interface Options<Client, ClientOptions> {
|
|
6
13
|
AwsClient?: new (...[config]: [any] | any) => Client
|
|
@@ -17,7 +24,7 @@ interface Options<Client, ClientOptions> {
|
|
|
17
24
|
declare class HttpError extends Error {
|
|
18
25
|
status: number
|
|
19
26
|
statusCode: number
|
|
20
|
-
expose: boolean
|
|
27
|
+
expose: boolean;
|
|
21
28
|
[key: string]: any
|
|
22
29
|
[key: number]: any
|
|
23
30
|
}
|
|
@@ -35,7 +42,9 @@ declare function canPrefetch<Client, ClientOptions> (
|
|
|
35
42
|
options: Options<Client, ClientOptions>
|
|
36
43
|
): boolean
|
|
37
44
|
|
|
38
|
-
type InternalOutput<TVariables> = TVariables extends string[]
|
|
45
|
+
type InternalOutput<TVariables> = TVariables extends string[]
|
|
46
|
+
? { [key in TVariables[number]]: unknown }
|
|
47
|
+
: never
|
|
39
48
|
|
|
40
49
|
// get an empty object if false is passed
|
|
41
50
|
declare function getInternal<
|
|
@@ -68,7 +77,9 @@ declare function getInternal<
|
|
|
68
77
|
: TVars extends string
|
|
69
78
|
? IsUnknown<Choose<DeepAwaited<TInternal>, TVars>> extends true
|
|
70
79
|
? unknown // could not find the path
|
|
71
|
-
: Promise<{
|
|
80
|
+
: Promise<{
|
|
81
|
+
[_ in SanitizeKey<TVars>]: Choose<DeepAwaited<TInternal>, TVars>
|
|
82
|
+
}>
|
|
72
83
|
: unknown // path is not a string or a keyof TInternal
|
|
73
84
|
|
|
74
85
|
// get multiple values
|
|
@@ -79,14 +90,15 @@ declare function getInternal<
|
|
|
79
90
|
> (
|
|
80
91
|
variables: TVars,
|
|
81
92
|
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
|
|
82
|
-
): Promise<
|
|
83
|
-
|
|
84
|
-
TVar extends keyof TInternal
|
|
93
|
+
): Promise<
|
|
94
|
+
SanitizeKeys<{
|
|
95
|
+
[TVar in ArrayValues<TVars>]: TVar extends keyof TInternal
|
|
85
96
|
? DeepAwaited<TInternal[TVar]>
|
|
86
97
|
: TVar extends string
|
|
87
98
|
? Choose<DeepAwaited<TInternal>, TVar>
|
|
88
99
|
: unknown // path is not a string or a keyof TInternal
|
|
89
|
-
}
|
|
100
|
+
}>
|
|
101
|
+
>
|
|
90
102
|
|
|
91
103
|
// remap object
|
|
92
104
|
declare function getInternal<
|
|
@@ -97,8 +109,7 @@ declare function getInternal<
|
|
|
97
109
|
variables: TMap,
|
|
98
110
|
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
|
|
99
111
|
): Promise<{
|
|
100
|
-
[P in keyof TMap]:
|
|
101
|
-
TMap[P] extends keyof TInternal
|
|
112
|
+
[P in keyof TMap]: TMap[P] extends keyof TInternal
|
|
102
113
|
? DeepAwaited<TInternal[TMap[P]]>
|
|
103
114
|
: TMap[P] extends string
|
|
104
115
|
? Choose<DeepAwaited<TInternal>, TMap[P]>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/util",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.6",
|
|
4
4
|
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@aws-sdk/client-ssm": "^3.0.0",
|
|
58
|
-
"@middy/core": "5.2.
|
|
58
|
+
"@middy/core": "5.2.6",
|
|
59
59
|
"@types/aws-lambda": "^8.10.76",
|
|
60
60
|
"@types/node": "^20.0.0",
|
|
61
61
|
"aws-xray-sdk": "^3.3.3"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"type": "github",
|
|
66
66
|
"url": "https://github.com/sponsors/willfarrell"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "02424c3740b6a4386dba4fb713ac290bedadb649"
|
|
69
69
|
}
|