Skip to content

Commit 2206a34

Browse files
committed
Merge branch 'master' into fix/no-usage/Props
2 parents 15e74d0 + 131bd0a commit 2206a34

267 files changed

Lines changed: 8100 additions & 8920 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
jobs:
33
- job: npmRunTest
44
pool:
5-
vmImage: 'Ubuntu 16.04'
5+
vmImage: ubuntu-latest
66
demands: npm
77

88
timeoutInMinutes: 360

notNeededPackages.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@
472472
"libraryName": "cbor",
473473
"asOfVersion": "6.0.0"
474474
},
475+
"cesium": {
476+
"libraryName": "cesium",
477+
"asOfVersion": "1.70.0"
478+
},
475479
"chai-http": {
476480
"libraryName": "chai-http",
477481
"asOfVersion": "4.2.0"
@@ -5334,6 +5338,10 @@
53345338
"libraryName": "webpack-merge",
53355339
"asOfVersion": "5.0.0"
53365340
},
5341+
"webpack-notifier": {
5342+
"libraryName": "webpack-notifier",
5343+
"asOfVersion": "1.14.0"
5344+
},
53375345
"webpack-subresource-integrity": {
53385346
"libraryName": "webpack-subresource-integrity",
53395347
"asOfVersion": "5.0.0"

types/aws-lambda/test/kinesis-tests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ const firehoseHandler: FirehoseTransformationHandler = async (event, context, ca
5151
recordId: event.records[0].recordId,
5252
result: 'Ok' as FirehoseRecordTransformationStatus,
5353
data: 'eyJmb28iOiJiYXIifQ==',
54+
metadata: {
55+
partitionKeys: {
56+
testPart: 'test1'
57+
}
58+
}
5459
},
5560
],
5661
};

types/aws-lambda/trigger/kinesis-firehose-transformation.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ export interface FirehoseRecordMetadata {
3434

3535
export type FirehoseRecordTransformationStatus = 'Ok' | 'Dropped' | 'ProcessingFailed';
3636

37+
export interface FirehoseTransformationMetadata {
38+
partitionKeys: { [name: string]: string };
39+
}
40+
3741
export interface FirehoseTransformationResultRecord {
3842
recordId: string;
3943
result: FirehoseRecordTransformationStatus;
4044
/** Encode in Base64 */
4145
data: string;
46+
metadata?: FirehoseTransformationMetadata;
4247
}
4348

4449
export interface FirehoseTransformationResult {

types/aws4/aws4-tests.ts

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,76 @@
1-
import * as aws4 from "aws4";
1+
import { sign, RequestSigner } from "aws4";
22

3-
let requestSigner = new aws4.RequestSigner({}, {});
4-
// $ExpectType string[]
3+
// $ExpectType Request
4+
sign("");
5+
// $ExpectType Request
6+
sign("", {});
7+
// $ExpectType Request
8+
sign({});
9+
// $ExpectType Request
10+
sign({}, {});
11+
12+
// $ExpectType RequestSigner
13+
new RequestSigner("");
14+
// $ExpectType RequestSigner
15+
new RequestSigner("", {});
16+
// $ExpectType RequestSigner
17+
new RequestSigner({});
18+
// $ExpectType RequestSigner
19+
new RequestSigner({}, {});
20+
21+
import aws4 = require("aws4");
22+
23+
// $ExpectType RequestSigner
24+
const requestSigner = new aws4.RequestSigner({});
25+
26+
// $ExpectType [service: string, region: string]
527
requestSigner.matchHost("");
628
// $ExpectType boolean
729
requestSigner.isSingleRegion();
830
// $ExpectType string
931
requestSigner.createHost();
10-
// $ExpectType void
11-
requestSigner.prepareRequest();
12-
requestSigner.sign();
13-
// $ExpectType string
14-
requestSigner.getDateTime();
15-
// $ExpectType string
16-
requestSigner.getDate();
1732
// $ExpectType string
1833
requestSigner.authHeader();
1934
// $ExpectType string
20-
requestSigner.signature();
21-
// $ExpectType string
22-
requestSigner.stringToSign();
23-
// $ExpectType string
24-
requestSigner.canonicalString();
25-
// $ExpectType string
2635
requestSigner.canonicalHeaders();
2736
// $ExpectType string
2837
requestSigner.signedHeaders();
2938
// $ExpectType string
3039
requestSigner.credentialString();
40+
// $ExpectType Credentials
3141
requestSigner.defaultCredentials();
42+
// $ExpectType void
3243
requestSigner.parsePath();
3344
// $ExpectType string
3445
requestSigner.formatPath();
46+
// $ExpectType Request
47+
requestSigner.sign();
48+
// $ExpectType void
49+
requestSigner.prepareRequest();
50+
// $ExpectType string
51+
requestSigner.getDateTime();
52+
// $ExpectType string
53+
requestSigner.getDate();
54+
// $ExpectType string
55+
requestSigner.canonicalString();
56+
// $ExpectType string
57+
requestSigner.signature();
58+
// $ExpectType string
59+
requestSigner.stringToSign();
3560

36-
aws4.sign({}, {});
61+
// $ExpectType Request
62+
requestSigner.request;
63+
// $ExpectType Credentials
64+
requestSigner.credentials;
65+
// $ExpectType string
66+
requestSigner.service;
67+
// $ExpectType string
68+
requestSigner.region;
69+
// $ExpectType boolean
70+
requestSigner.isCodeCommitGit;
71+
// $ExpectType string | undefined
72+
requestSigner.parsedPath?.path;
73+
// $ExpectType Record<string, string | string[]> | undefined
74+
requestSigner.parsedPath?.query;
75+
// $ExpectType string | undefined
76+
requestSigner.datetime;

types/aws4/index.d.ts

Lines changed: 209 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,223 @@
1-
// Type definitions for aws4 1.5.0
1+
// Type definitions for aws4 1.11
22
// Project: https://github.com/mhart/aws4
33
// Definitions by: Andrew Crites <https://github.com/ajcrites>
4+
// Alexandre Szymocha <https://github.com/Aksamyt>
45
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6+
// Minimum TypeScript Version: 4.0
7+
8+
/// <reference types="node" />
9+
10+
import { OutgoingHttpHeaders, RequestOptions } from 'http';
11+
12+
export interface Request extends RequestOptions {
13+
/** Defaults to {@link RequestSigner.createHost}() if possible. */
14+
host?: string;
15+
/** Equivalent to {@link host} */
16+
hostname?: string;
17+
/** Defaults to `"GET"`, or `"POST"` if there is a {@link body}. */
18+
method?: string;
19+
/** Defaults to `/`. */
20+
path?: string;
21+
/** Defaults to `""`. */
22+
body?: string;
23+
/** Defaults to {@link RequestSigner.matchHost}()[0], or `""`. */
24+
service?: string;
25+
/** Defaults to {@link RequestSigner.matchHost}()[1], or `"us-east-1"`. */
26+
region?: string;
27+
/** To sign the query instead of adding an Authorization header, defaults to false. */
28+
signQuery?: boolean;
29+
/**
30+
* Some headers have a default value:
31+
* - `Host`: Defaults to {@link hostname}, {@link host}, or
32+
* {@link RequestSigner.createHost}()
33+
* - `Content-Type`: defaults to
34+
* `"application/x-www-form-urlencoded; charset=utf-8"`
35+
* if there is a {@link body}
36+
* - `Date`: used to calculate the signature date if given, defaults to
37+
* `new Date()`
38+
*/
39+
headers?: OutgoingHttpHeaders;
40+
/** If true, signing the Request won’t mutate the headers. */
41+
doNotModifyHeaders?: boolean;
42+
/** If true, {@link path} won’t be encoded in the signature. */
43+
doNotEncodePath?: boolean;
44+
}
45+
46+
export interface Credentials {
47+
/** Equivalent to the env vars `AWS_ACCESS_KEY_ID` and `AWS_ACCESS_KEY`. */
48+
accessKeyId?: string;
49+
/** Equivalent to the env vars `AWS_SECRET_ACCESS_KEY` and `AWS_SECRET_KEY`. */
50+
secretAccessKey?: string;
51+
/** Equivalent to the env var `AWS_SESSION_TOKEN`. */
52+
sessionToken?: string;
53+
}
554

655
export class RequestSigner {
7-
constructor(request?: any, credentials?: any);
8-
request: any;
9-
credentials: any;
10-
service: any;
11-
region: any;
12-
isCodeCommitGit: any;
13-
14-
matchHost(host?: string): string[];
56+
constructor(requestOptions: string | Request, credentials?: Credentials);
57+
58+
request: Request;
59+
credentials: Credentials;
60+
service: string;
61+
region: string;
62+
63+
/**
64+
* `true` if {@link service} is `"codecommit"` and {@link request}.method
65+
* is `"GIT"`.
66+
*/
67+
isCodeCommitGit: boolean;
68+
69+
/**
70+
* Set by:
71+
* - {@link prepareRequest}
72+
* - {@link sign}
73+
* - {@link canonicalString}
74+
* - {@link parsePath}
75+
*/
76+
parsedPath?: {
77+
path: string;
78+
query: Record<string, string | string[]>;
79+
};
80+
81+
/**
82+
* Used as a cache by {@link getDateTime} and {@link getDate}.
83+
* Setting it will shortcut those functions.
84+
*
85+
* Set by:
86+
* - {@link prepareRequest}
87+
* - {@link getDateTime}
88+
* - {@link sign}
89+
*/
90+
datetime?: string;
91+
92+
/**
93+
* Extract the service code and region code from a Host name.
94+
*/
95+
matchHost(host: string): [service: string, region: string];
96+
97+
/**
98+
* https://docs.aws.amazon.com/general/latest/gr/rande.html
99+
*/
15100
isSingleRegion(): boolean;
101+
102+
/**
103+
* Compute the Host name from the {@link service} and the {@link region}.
104+
*/
16105
createHost(): string;
17-
prepareRequest(): void;
18-
sign(): any;
19-
getDateTime(): string;
20-
getDate(): string;
106+
107+
/**
108+
* Generate the Authorization header value.
109+
*/
21110
authHeader(): string;
22-
signature(): string;
23-
stringToSign(): string;
24-
canonicalString(): string;
111+
112+
/**
113+
* Generate a string representation of {@link request}.headers:
114+
* - one header per line, formatted as `<key>:<value>`
115+
* - lines are sorted.
116+
* - `<key>` is in lowercase and is trimmed.
117+
* - `<value>` is trimmed, and contiguous whitespaces are reduced to a
118+
* single space character ` `.
119+
*
120+
* These headers are filtered out:
121+
* - `authorization`
122+
* - `connection`
123+
* - `x-amzn-trace-id`
124+
* - `user-agent`
125+
* - `expect`
126+
* - `presigned-expires`
127+
* - `range`
128+
*/
25129
canonicalHeaders(): string;
130+
131+
/**
132+
* Generates a list of the header names of {@link request}.headers separated
133+
* by `;`.
134+
*
135+
* These headers are filtered out:
136+
* - `authorization`
137+
* - `connection`
138+
* - `x-amzn-trace-id`
139+
* - `user-agent`
140+
* - `expect`
141+
* - `presigned-expires`
142+
* - `range`
143+
*/
26144
signedHeaders(): string;
145+
146+
/**
147+
* Generate the “credential scope” part of the signature.
148+
*/
27149
credentialString(): string;
28-
defaultCredentials(): any;
29-
parsePath(): any;
150+
151+
/**
152+
* Extract credentials from the environment, if found.
153+
*/
154+
defaultCredentials(): Credentials;
155+
156+
/**
157+
* Parse {@link request}.path and store the results in {@link parsedPath}.
158+
*/
159+
parsePath(): void;
160+
161+
/**
162+
* **Will throw if {@link parsedPath} is undefined!**
163+
*
164+
* Rebuild the path from {@link parsedPath}.
165+
*/
30166
formatPath(): string;
167+
168+
/**
169+
* Sign the Request. The Request is returned for convenience.
170+
*/
171+
sign(): Request;
172+
173+
/**
174+
* Calls {@link parsePath}.
175+
* Prepare the Request by setting the required headers,
176+
* or query parameters if {@link request}.signQuery is true.
177+
*/
178+
prepareRequest(): void;
179+
180+
/**
181+
* If {@link datetime} is set, it is returned without further processing.
182+
*
183+
* Else, parse the `Date` header from {@link request}.headers,
184+
* or get the current date, and format it as (ISO 8601):
185+
* ```
186+
* YYYYMMDDThhmmssZ
187+
* ```
188+
* If {@link isCodeCommitGit} is `true`, then the trailing `Z` is removed.
189+
*
190+
* The result is stored to {@link datetime} before being returned.
191+
*/
192+
getDateTime(): string;
193+
194+
/**
195+
* If {@link datetime} is set, its first 8 characters are returned.
196+
*
197+
* Else, call {@link getDateTime} and return the first 8 characters.
198+
*/
199+
getDate(): string;
200+
201+
/**
202+
* Generate a string representation of the Request.
203+
* https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
204+
*/
205+
canonicalString(): string;
206+
207+
/**
208+
* Compute the Request HMAC signature.
209+
*/
210+
signature(): string;
211+
212+
/**
213+
* Generate the raw data to be signed.
214+
* https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html
215+
*/
216+
stringToSign(): string;
31217
}
32218

33-
export function sign(options?: any, credentials?: any): any;
219+
/**
220+
* Calculates and populates any necessary AWS headers and/or request options on
221+
* `requestOptions`. Returns `requestOptions` as a convenience for chaining.
222+
*/
223+
export function sign(requestOptions: string | Request, credentials?: Credentials): Request;

0 commit comments

Comments
 (0)