Skip to content

Commit 19ea37b

Browse files
authored
Merge pull request #6 from shutterstock/remove-ts-lib-runtime
Remove tslib runtime dep
2 parents 69f994d + ef01c9c commit 19ea37b

File tree

7 files changed

+2845
-2866
lines changed

7 files changed

+2845
-2866
lines changed

examples/aws-kinesis-writer.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-console */
2-
import * as kinesis from '@aws-sdk/client-kinesis';
2+
import { KinesisClient, PutRecordsCommand, PutRecordsRequestEntry } from '@aws-sdk/client-kinesis';
33
import { Chunker } from '@shutterstock/chunker';
44

5-
const kinesisClient = new kinesis.KinesisClient({});
5+
const kinesisClient = new KinesisClient({});
66
const { KINESIS_STREAM_NAME = 'chunker-test-stream', RECORDS_TO_WRITE = '1500' } = process.env;
77
const RECORDS_TO_WRITE_NUM = parseInt(RECORDS_TO_WRITE, 10);
88

@@ -21,7 +21,7 @@ async function main() {
2121
* @param record The record to compute the size of
2222
* @returns
2323
*/
24-
sizer: (record: { item: kinesis.PutRecordsRequestEntry; index: number }): number => {
24+
sizer: (record: { item: PutRecordsRequestEntry; index: number }): number => {
2525
const { item, index } = record;
2626
const itemJSON = JSON.stringify(item);
2727
// Return the real size of the record if below 500 items
@@ -39,17 +39,15 @@ async function main() {
3939
* @param records The records to write
4040
* @returns The result of the Kinesis PutRecordsCommand
4141
*/
42-
writer: async (
43-
records: { index: number; item: kinesis.PutRecordsRequestEntry }[],
44-
): Promise<void> => {
42+
writer: async (records: { index: number; item: PutRecordsRequestEntry }[]): Promise<void> => {
4543
console.log(
4644
`Writing to Kinesis - Start - Records: ${records.length}, First Index: ${
4745
records[0].index
4846
}, Last Index: ${records[records.length - 1].index}`,
4947
);
5048
// Send the records in a batch since we know we will be under the batch limits
5149
await kinesisClient.send(
52-
new kinesis.PutRecordsCommand({
50+
new PutRecordsCommand({
5351
StreamName: KINESIS_STREAM_NAME,
5452
Records: records.map((record) => record.item),
5553
}),
@@ -66,7 +64,7 @@ async function main() {
6664
for (let i = 0; i < RECORDS_TO_WRITE_NUM; i++) {
6765
const niceNumberStr = `${i.toString().padStart(5, '0')}`;
6866
const partitionKey = `${(i % 100).toString().padStart(5, '0')}`;
69-
const record: kinesis.PutRecordsRequestEntry = {
67+
const record: PutRecordsRequestEntry = {
7068
Data: Buffer.from(niceNumberStr, 'utf-8'),
7169
PartitionKey: partitionKey,
7270
};

jest.config.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ module.exports = {
6464

6565
// A set of global variables that need to be available in all test environments
6666
// globals: {},
67-
globals: {
68-
'ts-jest': {
69-
tsconfig: 'tsconfig.json',
70-
},
71-
},
67+
globals: {},
7268

7369
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
7470
// maxWorkers: "50%",
@@ -188,7 +184,12 @@ module.exports = {
188184
// A map from regular expressions to paths to transformers
189185
// transform: undefined,
190186
transform: {
191-
'^.+\\.tsx?$': 'ts-jest',
187+
'^.+\\.tsx?$': [
188+
'ts-jest',
189+
{
190+
tsconfig: 'tsconfig.jest.json',
191+
},
192+
],
192193
},
193194

194195
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation

0 commit comments

Comments
 (0)