BREAKING CHANGE(Smarts3): Migrate Smarts3 configuration to nested server/storage objects and remove legacy flat config support

This commit is contained in:
2025-11-23 22:42:47 +00:00
parent 263e7a58b9
commit a9ba9de6be
5 changed files with 24 additions and 8 deletions

View File

@@ -1,5 +1,13 @@
# Changelog # Changelog
## 2025-11-23 - 4.0.0 - BREAKING CHANGE(Smarts3)
Migrate Smarts3 configuration to nested server/storage objects and remove legacy flat config support
- Smarts3.createAndStart() and Smarts3 constructor now accept ISmarts3Config with nested `server` and `storage` objects.
- Removed support for the legacy flat config shape (top-level `port` and `cleanSlate`) / ILegacySmarts3Config.
- Updated tests to use new config shape (server:{ port, silent } and storage:{ cleanSlate }).
- mergeConfig and Smarts3Server now rely on the nested config shape; consumers must update their initialization code.
## 2025-11-23 - 3.2.0 - feat(multipart) ## 2025-11-23 - 3.2.0 - feat(multipart)
Add multipart upload support with MultipartUploadManager and controller integration Add multipart upload support with MultipartUploadManager and controller integration

View File

@@ -18,9 +18,13 @@ async function streamToString(stream: Readable): Promise<string> {
tap.test('should start the S3 server and configure client', async () => { tap.test('should start the S3 server and configure client', async () => {
testSmarts3Instance = await smarts3.Smarts3.createAndStart({ testSmarts3Instance = await smarts3.Smarts3.createAndStart({
server: {
port: 3337, port: 3337,
cleanSlate: true,
silent: true, silent: true,
},
storage: {
cleanSlate: true,
},
}); });
const descriptor = await testSmarts3Instance.getS3Descriptor(); const descriptor = await testSmarts3Instance.getS3Descriptor();

View File

@@ -7,8 +7,12 @@ let testSmarts3Instance: smarts3.Smarts3;
tap.test('should create a smarts3 instance and run it', async (toolsArg) => { tap.test('should create a smarts3 instance and run it', async (toolsArg) => {
testSmarts3Instance = await smarts3.Smarts3.createAndStart({ testSmarts3Instance = await smarts3.Smarts3.createAndStart({
server: {
port: 3333, port: 3333,
},
storage: {
cleanSlate: true, cleanSlate: true,
},
}); });
console.log(`Let the instance run for 2 seconds`); console.log(`Let the instance run for 2 seconds`);
await toolsArg.delayFor(2000); await toolsArg.delayFor(2000);

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smarts3', name: '@push.rocks/smarts3',
version: '3.2.0', version: '4.0.0',
description: 'A Node.js TypeScript package to create a local S3 endpoint for simulating AWS S3 operations using mapped local directories for development and testing purposes.' description: 'A Node.js TypeScript package to create a local S3 endpoint for simulating AWS S3 operations using mapped local directories for development and testing purposes.'
} }

View File

@@ -153,7 +153,7 @@ function mergeConfig(userConfig: ISmarts3Config): Required<ISmarts3Config> {
*/ */
export class Smarts3 { export class Smarts3 {
// STATIC // STATIC
public static async createAndStart(configArg: ISmarts3Config | ILegacySmarts3Config = {}) { public static async createAndStart(configArg: ISmarts3Config = {}) {
const smartS3Instance = new Smarts3(configArg); const smartS3Instance = new Smarts3(configArg);
await smartS3Instance.start(); await smartS3Instance.start();
return smartS3Instance; return smartS3Instance;
@@ -163,7 +163,7 @@ export class Smarts3 {
public config: Required<ISmarts3Config>; public config: Required<ISmarts3Config>;
public s3Instance: Smarts3Server; public s3Instance: Smarts3Server;
constructor(configArg: ISmarts3Config | ILegacySmarts3Config = {}) { constructor(configArg: ISmarts3Config = {}) {
this.config = mergeConfig(configArg); this.config = mergeConfig(configArg);
} }