mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-04-26 00:13:57 -05:00
chore: Add @smithy/types for correct type for s3 client
This commit is contained in:
parent
23bf64c2c5
commit
96d2ccf8a8
1239
package-lock.json
generated
1239
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -32,6 +32,7 @@
|
||||||
"xmlbuilder": "^15.1.1"
|
"xmlbuilder": "^15.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@smithy/types": "^4.0.0",
|
||||||
"@types/dicer": "^0.2.4",
|
"@types/dicer": "^0.2.4",
|
||||||
"@types/express": "^4.17.17",
|
"@types/express": "^4.17.17",
|
||||||
"@types/fs-extra": "^11.0.1",
|
"@types/fs-extra": "^11.0.1",
|
||||||
|
|
@ -45,4 +46,3 @@
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"xmlbuilder2": "^3.0.2"
|
"xmlbuilder2": "^3.0.2"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,16 @@ import path from 'node:path';
|
||||||
import { Readable } from 'node:stream';
|
import { Readable } from 'node:stream';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import { createChannel, createClient, Metadata } from 'nice-grpc';
|
import { createChannel, createClient, Metadata } from 'nice-grpc';
|
||||||
import { GetObjectCommand, PutObjectCommand, S3 } from '@aws-sdk/client-s3';
|
import { GetObjectCommand, PutObjectCommand, S3, S3Client } from '@aws-sdk/client-s3';
|
||||||
import { AccountClient, AccountDefinition } from '@pretendonetwork/grpc/account/account_service';
|
import { AccountClient, AccountDefinition } from '@pretendonetwork/grpc/account/account_service';
|
||||||
import { FriendsClient, FriendsDefinition } from '@pretendonetwork/grpc/friends/friends_service';
|
import { FriendsClient, FriendsDefinition } from '@pretendonetwork/grpc/friends/friends_service';
|
||||||
import { GetNEXDataResponse } from '@pretendonetwork/grpc/account/get_nex_data_rpc';
|
import { GetNEXDataResponse } from '@pretendonetwork/grpc/account/get_nex_data_rpc';
|
||||||
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
|
||||||
import { GetUserFriendPIDsResponse } from '@pretendonetwork/grpc/friends/get_user_friend_pids_rpc';
|
import { GetUserFriendPIDsResponse } from '@pretendonetwork/grpc/friends/get_user_friend_pids_rpc';
|
||||||
import { config, disabledFeatures } from '@/config-manager';
|
import { config, disabledFeatures } from '@/config-manager';
|
||||||
|
import { NodeJsClient } from '@smithy/types';
|
||||||
|
|
||||||
let s3: S3;
|
let s3: NodeJsClient<S3Client>;
|
||||||
|
|
||||||
if (!disabledFeatures.s3) {
|
if (!disabledFeatures.s3) {
|
||||||
s3 = new S3({
|
s3 = new S3({
|
||||||
|
|
@ -138,7 +139,7 @@ export async function getFriends(pid: number): Promise<GetUserFriendPIDsResponse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCDNFileStream(key: string): Promise<Readable | fs.ReadStream | null> {
|
export async function getCDNFileStream(key: string): Promise<Readable | null> {
|
||||||
try {
|
try {
|
||||||
if (disabledFeatures.s3) {
|
if (disabledFeatures.s3) {
|
||||||
return await getLocalCDNFile(key);
|
return await getLocalCDNFile(key);
|
||||||
|
|
@ -152,7 +153,7 @@ export async function getCDNFileStream(key: string): Promise<Readable | fs.ReadS
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.Body as Readable;
|
return response.Body;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user