Skip to content

Commit 7023ad1

Browse files
committed
style: format code for consistency and readability across multiple files
1 parent 2043813 commit 7023ad1

146 files changed

Lines changed: 20921 additions & 19048 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.

biome.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/2.4.9/schema.json",
33
"files": {
4-
"includes": ["**/*.ts", "**/*.tsx", "!node_modules", "!dist", "!build", "!**/routeTree.gen.ts"]
4+
"includes": [
5+
"**/*.ts",
6+
"**/*.tsx",
7+
"!node_modules",
8+
"!dist",
9+
"!build",
10+
"!**/routeTree.gen.ts"
11+
]
512
},
613
"vcs": {
714
"enabled": true,
Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,72 @@
1-
import { S3Client } from "@aws-sdk/client-s3";
2-
import { SQSClient } from "@aws-sdk/client-sqs";
3-
import { SNSClient } from "@aws-sdk/client-sns";
4-
import { IAMClient } from "@aws-sdk/client-iam";
51
import { CloudFormationClient } from "@aws-sdk/client-cloudformation";
62
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
7-
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
83
import { DynamoDBStreamsClient } from "@aws-sdk/client-dynamodb-streams";
4+
import { IAMClient } from "@aws-sdk/client-iam";
5+
import { S3Client } from "@aws-sdk/client-s3";
6+
import { SNSClient } from "@aws-sdk/client-sns";
7+
import { SQSClient } from "@aws-sdk/client-sqs";
8+
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
99

1010
export interface AwsClients {
11-
s3: S3Client;
12-
sqs: SQSClient;
13-
sns: SNSClient;
14-
iam: IAMClient;
15-
cloudformation: CloudFormationClient;
16-
dynamodb: DynamoDBClient;
17-
dynamodbDocument: DynamoDBDocumentClient;
18-
dynamodbStreams: DynamoDBStreamsClient;
11+
s3: S3Client;
12+
sqs: SQSClient;
13+
sns: SNSClient;
14+
iam: IAMClient;
15+
cloudformation: CloudFormationClient;
16+
dynamodb: DynamoDBClient;
17+
dynamodbDocument: DynamoDBDocumentClient;
18+
dynamodbStreams: DynamoDBStreamsClient;
1919
}
2020

2121
const MAX_CACHE_SIZE = 20;
2222

2323
export class ClientCache {
24-
private cache = new Map<string, AwsClients>();
24+
private cache = new Map<string, AwsClients>();
2525

26-
private makeKey(endpoint: string, region: string): string {
27-
return `${endpoint}::${region}`;
28-
}
26+
private makeKey(endpoint: string, region: string): string {
27+
return `${endpoint}::${region}`;
28+
}
2929

30-
private createClients(endpoint: string, region: string): AwsClients {
31-
const commonConfig = {
32-
endpoint,
33-
region,
34-
credentials: {
35-
accessKeyId: "test",
36-
secretAccessKey: "test",
37-
},
38-
};
30+
private createClients(endpoint: string, region: string): AwsClients {
31+
const commonConfig = {
32+
endpoint,
33+
region,
34+
credentials: {
35+
accessKeyId: "test",
36+
secretAccessKey: "test",
37+
},
38+
};
3939

40-
const dynamodb = new DynamoDBClient(commonConfig);
40+
const dynamodb = new DynamoDBClient(commonConfig);
4141

42-
return {
43-
s3: new S3Client({ ...commonConfig, forcePathStyle: true }),
44-
sqs: new SQSClient(commonConfig),
45-
sns: new SNSClient(commonConfig),
46-
iam: new IAMClient(commonConfig),
47-
cloudformation: new CloudFormationClient(commonConfig),
48-
dynamodb,
49-
dynamodbDocument: DynamoDBDocumentClient.from(dynamodb, {
50-
marshallOptions: { removeUndefinedValues: true },
51-
}),
52-
dynamodbStreams: new DynamoDBStreamsClient(commonConfig),
53-
};
54-
}
42+
return {
43+
s3: new S3Client({ ...commonConfig, forcePathStyle: true }),
44+
sqs: new SQSClient(commonConfig),
45+
sns: new SNSClient(commonConfig),
46+
iam: new IAMClient(commonConfig),
47+
cloudformation: new CloudFormationClient(commonConfig),
48+
dynamodb,
49+
dynamodbDocument: DynamoDBDocumentClient.from(dynamodb, {
50+
marshallOptions: { removeUndefinedValues: true },
51+
}),
52+
dynamodbStreams: new DynamoDBStreamsClient(commonConfig),
53+
};
54+
}
5555

56-
getClients(endpoint: string, region: string): AwsClients {
57-
const key = this.makeKey(endpoint, region);
56+
getClients(endpoint: string, region: string): AwsClients {
57+
const key = this.makeKey(endpoint, region);
5858

59-
let clients = this.cache.get(key);
60-
if (clients) return clients;
59+
let clients = this.cache.get(key);
60+
if (clients) return clients;
6161

62-
// LRU eviction: remove oldest entry if cache is full
63-
if (this.cache.size >= MAX_CACHE_SIZE) {
64-
const firstKey = this.cache.keys().next().value;
65-
if (firstKey) this.cache.delete(firstKey);
66-
}
62+
// LRU eviction: remove oldest entry if cache is full
63+
if (this.cache.size >= MAX_CACHE_SIZE) {
64+
const firstKey = this.cache.keys().next().value;
65+
if (firstKey) this.cache.delete(firstKey);
66+
}
6767

68-
clients = this.createClients(endpoint, region);
69-
this.cache.set(key, clients);
70-
return clients;
71-
}
68+
clients = this.createClients(endpoint, region);
69+
this.cache.set(key, clients);
70+
return clients;
71+
}
7272
}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
import { S3Client } from "@aws-sdk/client-s3";
2-
import { SQSClient } from "@aws-sdk/client-sqs";
3-
import { SNSClient } from "@aws-sdk/client-sns";
4-
import { IAMClient } from "@aws-sdk/client-iam";
51
import { CloudFormationClient } from "@aws-sdk/client-cloudformation";
62
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
7-
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
83
import { DynamoDBStreamsClient } from "@aws-sdk/client-dynamodb-streams";
4+
import { IAMClient } from "@aws-sdk/client-iam";
5+
import { S3Client } from "@aws-sdk/client-s3";
6+
import { SNSClient } from "@aws-sdk/client-sns";
7+
import { SQSClient } from "@aws-sdk/client-sqs";
8+
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
99
import { config } from "../config.js";
1010

1111
const commonConfig = {
12-
endpoint: config.localstackEndpoint,
13-
region: config.localstackRegion,
14-
credentials: {
15-
accessKeyId: "test",
16-
secretAccessKey: "test",
17-
},
12+
endpoint: config.localstackEndpoint,
13+
region: config.localstackRegion,
14+
credentials: {
15+
accessKeyId: "test",
16+
secretAccessKey: "test",
17+
},
1818
};
1919

2020
export function createS3Client(): S3Client {
21-
return new S3Client({
22-
...commonConfig,
23-
forcePathStyle: true,
24-
});
21+
return new S3Client({
22+
...commonConfig,
23+
forcePathStyle: true,
24+
});
2525
}
2626

2727
export function createSQSClient(): SQSClient {
28-
return new SQSClient(commonConfig);
28+
return new SQSClient(commonConfig);
2929
}
3030

3131
export function createSNSClient(): SNSClient {
32-
return new SNSClient(commonConfig);
32+
return new SNSClient(commonConfig);
3333
}
3434

3535
export function createIAMClient(): IAMClient {
36-
return new IAMClient(commonConfig);
36+
return new IAMClient(commonConfig);
3737
}
3838

3939
export function createCloudFormationClient(): CloudFormationClient {
40-
return new CloudFormationClient(commonConfig);
40+
return new CloudFormationClient(commonConfig);
4141
}
4242

4343
export function createDynamoDBClient(): DynamoDBClient {
44-
return new DynamoDBClient(commonConfig);
44+
return new DynamoDBClient(commonConfig);
4545
}
4646

4747
export function createDynamoDBDocumentClient(): DynamoDBDocumentClient {
48-
const client = new DynamoDBClient(commonConfig);
49-
return DynamoDBDocumentClient.from(client, {
50-
marshallOptions: { removeUndefinedValues: true },
51-
});
48+
const client = new DynamoDBClient(commonConfig);
49+
return DynamoDBDocumentClient.from(client, {
50+
marshallOptions: { removeUndefinedValues: true },
51+
});
5252
}
5353

5454
export function createDynamoDBStreamsClient(): DynamoDBStreamsClient {
55-
return new DynamoDBStreamsClient(commonConfig);
55+
return new DynamoDBStreamsClient(commonConfig);
5656
}

packages/backend/src/bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import Fastify from "fastify";
55
import type { ServiceName } from "./config.js";
66
import { config } from "./config.js";
77
import { checkLocalstackHealth } from "./health.js";
8+
import clientCachePlugin from "./plugins/client-cache.js";
89
import cloudformationPlugin from "./plugins/cloudformation/index.js";
910
import dynamodbPlugin from "./plugins/dynamodb/index.js";
1011
import iamPlugin from "./plugins/iam/index.js";
1112
import localstackConfigPlugin from "./plugins/localstack-config.js";
12-
import clientCachePlugin from "./plugins/client-cache.js";
1313
// Explicit plugin imports (replaces autoload for bundled builds)
1414
import s3Plugin from "./plugins/s3/index.js";
1515
import snsPlugin from "./plugins/sns/index.js";

packages/backend/src/health.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
export async function checkLocalstackHealth(endpoint: string, region: string) {
2-
try {
3-
const controller = new AbortController();
4-
const timeout = setTimeout(() => controller.abort(), 3000);
2+
try {
3+
const controller = new AbortController();
4+
const timeout = setTimeout(() => controller.abort(), 3000);
55

6-
const response = await fetch(`${endpoint}/_localstack/health`, {
7-
signal: controller.signal,
8-
});
9-
clearTimeout(timeout);
6+
const response = await fetch(`${endpoint}/_localstack/health`, {
7+
signal: controller.signal,
8+
});
9+
clearTimeout(timeout);
1010

11-
if (!response.ok) {
12-
return { connected: false, endpoint, region, error: `HTTP ${response.status}` };
13-
}
11+
if (!response.ok) {
12+
return {
13+
connected: false,
14+
endpoint,
15+
region,
16+
error: `HTTP ${response.status}`,
17+
};
18+
}
1419

15-
return { connected: true, endpoint, region };
16-
} catch (err) {
17-
const message = err instanceof Error ? err.message : "Unknown error";
18-
return { connected: false, endpoint, region, error: message };
19-
}
20+
return { connected: true, endpoint, region };
21+
} catch (err) {
22+
const message = err instanceof Error ? err.message : "Unknown error";
23+
return { connected: false, endpoint, region, error: message };
24+
}
2025
}

0 commit comments

Comments
 (0)