Skip to content

Commit 50f8527

Browse files
committed
feat: cutting over to the aws-sdk v3
1 parent 361d1d2 commit 50f8527

File tree

58 files changed

+1115
-1146
lines changed

Some content is hidden

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

58 files changed

+1115
-1146
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,5 @@ coverage/
150150
!.yarn/releases
151151
!.yarn/sdks
152152
!.yarn/versions
153+
154+
jest-html-reporters-attach/

.pnp.cjs

+269-145
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

.yarn/sdks/typescript/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript",
3-
"version": "5.2.2-sdk",
3+
"version": "4.9.5-sdk",
44
"main": "./lib/typescript.js",
55
"type": "commonjs"
66
}

jest-html-reporters-attach/jest_html_reporters/index.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jest.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
let reporters = ['default'];
2+
if (process.env.HTML_REPORT === 'true') {
3+
reporters.push([
4+
'jest-html-reporters',
5+
{
6+
openReport: true,
7+
},
8+
]);
9+
}
10+
111
module.exports = {
212
preset: 'ts-jest',
313
testEnvironment: 'node',
@@ -22,4 +32,5 @@ module.exports = {
2232
moduleNameMapper: {
2333
'^~/(.*)$': '<rootDir>/src/$1',
2434
},
35+
reporters,
2536
};

jest_html_reporters.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Type" content="text/html;charset=utf-8"><meta name="keywords" contect="jest, reporters"><meta name="author" contect="hazyzh"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1,maximum-scale=1"><link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAHX0lEQVR4Xu2bfWwUVRDAZ/buSsG0Vxq1EAhtL/e2kKISAVEoKJVE4gfiR6wmJsoflpBANLZKqyRIgVg+/CLBNqKoMX5RKWhFsUbRBuJHRCoECLt7x0Jb5IBmr62tx+3dPrNH93Itd7e7xx0ccu+/dmfmzfz2vXmzu3MI1/jAazx+yADIrIBrnMDl2gK4atWqF8+ePXufx+OZFAgEbLG422w2/8SJE7fW1dXVAgBN9f1JOYD6+vqb2trafhUEYZSZYAghA3Pnzp1eXV19xIyeWdmUAli2bNmIY8eOeUVRzDbrmCo/duzYwPz580tqa2vdiegb0UkpgKVLl/7c2to6R3OEYRgoLS2F7OzoPHw+Hxw+fBgURQn7Xl5efqCxsfFWI8EkIpMQAIfDMc1iscxHxFmU0pGxJs7Pz79TkqTQZYfDAVu2bIHx48fH9bOvrw8WL14M+/fvD8nl5uZCT0/Pz1GU/ADQBQBuRPzF7/fvFUXRZxaCKQDFxcUlVqv1NUS8T28iu92uOh4WW7duHSxcuFBPLXR9586dsHz58rBsXl4eeL1ePd1/AGDjwMDA+s7Ozn/1hLXrhgGwLHsbpfQ7RMwzYvwKAAi5RSnlFUUpc7lcZ4z4aQiA0+m8HRF/QMSLMjmlVKV9FAD6hk84bty4OadOnQrNMXXqVGhoaAAVTLzR0dEBlZWV4HZfyHs5OTnQ29sbbQuol7MAYAYiMpE2KaVuWZZniaJ4Wg+CLgCWZR0A8AcAjNaMUUp9iLg6EAg0ud1uIdZ5XVVVtb2lpeVhTS/BJPhnY2Pj1FiBFBUVjcnKylpBKV0yDMTB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FgcNuJ2iBBCehAxV9WhlK7leX7F1QCgYsETfcfdovaqOcBxXMzmbL0WmR0AoHU3HuI47uYwAL80BUE5YDg1XyZBz+kz8MA8rTciNOlejuNmx5o+LgCn0/kkwzCRr3UXcxz3jmbM6+9OeTu7WW51K9bA1zt3hdUURXleEIQ3EgJQWlqaJcvyCQAYM7gNfMFg8Ba32x1qnJD83R8gwFNmnUyV/Jfbv4K1K1+NNN/n8/kKY+1/VVC3T9DpdC5hGOZtzSqlVH26WcTz/C61Rwhk5ScEuCVVQRm1+8mHn8KbGzYNEaeUPsvz/NB/mkmCmizLsp8BQEWkLqV0OwBsav299WDeqNznAOBpxCFNikZ9T0iuv78fXLwbXLwLvm3ZDe1//jXcThPHcY/pGdddAYMGbISQTxHxET2D6XCdUvoFz/NPAEBAzx+jAFQ7DMuyjQDwjJ7RK3mdUtrA8/xStXQx4ocZACF76o8lrFbrKkrp3Yg4wsgkqZahlJ5Xu9kDgcBKt9utNnYbHqYBRFi2OZ3OaYhYRCktZBgmod8FGfZ0mCCldEB950IpPS4Ighq0sUbkRJJgok5eDXqXsgKuhvh0fcwA0EX0Pxf4Dws8WYyVxouxAAAAAElFTkSuQmCC"></head><title>Report</title><body><div id="app"></div><script defer="defer" src="./jest-html-reporters-attach/jest_html_reporters/index.js"></script></body></html>

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"@types/jest": "^26.0.15",
5454
"@types/node": "^18.0.0",
5555
"@types/uuid": "^7.0.0",
56-
"@typescript-eslint/eslint-plugin": "^4.8.1",
57-
"@typescript-eslint/parser": "^4.8.1",
56+
"@typescript-eslint/eslint-plugin": "^6.7.5",
57+
"@typescript-eslint/parser": "^6.7.5",
5858
"@yarnpkg/sdks": "^3.0.0-rc.53",
5959
"eslint": "^7.13.0",
6060
"eslint-config-prettier": "^6.15.0",
@@ -65,10 +65,11 @@
6565
"eslint-plugin-prettier": "^3.1.3",
6666
"jest": "^26.6.3",
6767
"jest-circus": "^26.6.3",
68+
"jest-html-reporters": "^3.1.4",
6869
"prettier": "^2.2.0",
6970
"ts-jest": "^26.4.4",
7071
"ts-node": "^9.1.1",
71-
"typescript": "^5.2.2"
72+
"typescript": "^4.9.5"
7273
},
7374
"peerDependencies": {
7475
"@aws-sdk/client-cloudwatch": "^3.428.0",

src/builder.ts

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Lombok style builder that was part of the legacy plugin as
2+
// part of the abandoned package @org-formation/tombok
3+
// Copied here and kept for ease of transition
4+
5+
import { Constructor } from './interface';
6+
7+
/**
8+
* The builder decorator creates a so-called 'builder' aspect to the class that is annotated with `@builder`.
9+
*
10+
* Whenever a class is decorated, the private constructor is generated with all fields as arguments,
11+
* and it is as if this constructor has been decorated with `@builder` instead.
12+
* Note that this constructor is only generated if you haven't written any constructors and also haven't
13+
* added any explicit `@xArgsConstructor` decorators. In those cases, tombok will assume an all-args
14+
* constructor is present and generate code that uses it; this means you'd get a compiler error if this
15+
* constructor is not present.
16+
*
17+
* The effect of `@builder` is that an inner class is generated named `TBuilder`,
18+
* with a private constructor. Instances of `TBuilder` are made with the method named
19+
* `builder()` which is also generated for you in the class itself (not in the builder class).
20+
*
21+
* The `TBuilder` class contains 1 method for each parameter of the decorated class, which returns
22+
* the builder itself. The builder also has a `build()` method which returns a completed instance of
23+
* the original type, created by passing all parameters as set via the various other methods in the
24+
* builder to the constructor or method that was decorated with `@builder`. The return type of this
25+
* method will be the same as the relevant class, unless a method has been decorated, in which case
26+
* it'll be equal to the return type of that method.
27+
*
28+
* Example:
29+
* ```typescript
30+
* @builder
31+
* class Person {}
32+
*
33+
* Person.builder()
34+
* .name('Adam Savage').city('San Francisco')
35+
* .job('Mythbusters').job('Unchained Reaction')
36+
* .build();
37+
* ```
38+
*
39+
* @param <T> Type of the base class that must contain a constructor
40+
* @param {T} target Base class that we are going to mutate
41+
*/
42+
export function builder<T extends new (...args: any) => any>(target: T): T {
43+
return class TBuilder extends target {
44+
/**
45+
* Create a Builder for a class. Returned objects will be of the class type.
46+
*
47+
* @param <T> The class to instantiate.
48+
* @param {Partial<T>} [template] Class partial which the builder will derive initial params from.
49+
*/
50+
static builder(template) {
51+
const built = template ? Object.assign({}, template) : {};
52+
const builder = new Proxy({}, {
53+
get(_, prop) {
54+
if ('build' === prop) {
55+
// Instantiate the input class with props
56+
const obj = new target();
57+
return () => Object.assign(obj, { ...built });
58+
}
59+
return (x) => {
60+
built[prop] = x;
61+
return builder;
62+
};
63+
}
64+
});
65+
return builder;
66+
}
67+
};
68+
}
69+
70+
export type IBuilder<T> = {
71+
[k in keyof T]-?: (arg: T[k]) => IBuilder<T>;
72+
} & {
73+
build(): T;
74+
};

src/exceptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BaseModel, HandlerErrorCode } from './interface';
22
import { ProgressEvent } from './proxy';
33

44
export abstract class BaseHandlerException extends Error {
5-
static serialVersionUID = -1646136434112354328;
5+
static serialVersionUID = -1646136434112354328n;
66

77
public errorCode: HandlerErrorCode;
88

src/interface.ts

+9-23
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
import 'reflect-metadata';
2-
import {
3-
ClientRequestToken,
4-
LogGroupName,
5-
LogicalResourceId,
6-
NextToken,
7-
} from 'aws-sdk/clients/cloudformation';
8-
import { Service } from 'aws-sdk/lib/service';
92
import {
103
classToPlain,
114
ClassTransformOptions,
@@ -14,24 +7,16 @@ import {
147
plainToClass,
158
} from 'class-transformer';
169

10+
type ClientRequestToken = string;
11+
type LogGroupName = string;
12+
type LogicalResourceId = string;
13+
type NextToken = string;
14+
1715
export type Optional<T> = T | undefined | null;
1816
export type Dict<T = any> = Record<string, T>;
19-
export type Constructor<T = {}> = new (...args: any[]) => T;
17+
export type Constructor<T = {}> = new (...args: any) => T;
2018
export type integer = bigint;
2119

22-
export type InstanceProperties<
23-
T extends object = Service,
24-
C extends Constructor<T> = Constructor<T>
25-
> = keyof InstanceType<C>;
26-
27-
export type ServiceProperties<
28-
S extends Service = Service,
29-
C extends Constructor<S> = Constructor<S>
30-
> = Exclude<
31-
InstanceProperties<S, C>,
32-
InstanceProperties<Service, Constructor<Service>>
33-
>;
34-
3520
export type OverloadedArguments<T> = T extends {
3621
(...args: any[]): any;
3722
(params: infer P, callback: any): any;
@@ -103,8 +88,9 @@ export const Integer: IntegerConstructor = new Proxy(BigInt, {
10388
const isSafeInteger = (value: unknown): boolean => {
10489
if (
10590
value &&
106-
(value < BigInt(Number.MIN_SAFE_INTEGER) ||
107-
value > BigInt(Number.MAX_SAFE_INTEGER))
91+
!Number.isNaN(value) &&
92+
((value as bigint) < BigInt(Number.MIN_SAFE_INTEGER) ||
93+
(value as bigint) > BigInt(Number.MAX_SAFE_INTEGER))
10894
) {
10995
return false;
11096
}

0 commit comments

Comments
 (0)