Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ab667049a | |||
| 871f0e0b78 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -3,7 +3,6 @@
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
@@ -17,4 +16,8 @@ node_modules/
|
||||
dist/
|
||||
dist_*/
|
||||
|
||||
# custom
|
||||
# AI
|
||||
.claude/
|
||||
.serena/
|
||||
|
||||
#------# custom
|
||||
24
changelog.md
24
changelog.md
@@ -1,6 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-11-20 - 2.2.7 - fix(core)
|
||||
Update dependencies, code style and project config; add pnpm overrides and ignore AI folders
|
||||
|
||||
- Bump devDependencies and runtime dependencies (@git.zone/*, @push.rocks/*, @tsclass/tsclass, s3rver) to newer compatible versions
|
||||
- Add pnpm.overrides entry to package.json and normalize repository URL format
|
||||
- Code style and formatting fixes in TypeScript sources (ts/index.ts, ts/00_commitinfo_data.ts): whitespace, trailing commas, parameter formatting and minor API-return typing preserved
|
||||
- tsconfig.json: simplify compiler options and compact exclude list
|
||||
- Update .gitignore to add AI-related folders (.claude/, .serena/) to avoid accidental commits
|
||||
- Documentation and changelog formatting tweaks (readme.md, changelog.md, npmextra.json) — whitespace/newline cleanups and expanded changelog entries
|
||||
|
||||
## 2025-08-16 - 2.2.6 - fix(Smarts3)
|
||||
|
||||
Allow overriding S3 descriptor; update dependencies, test config and documentation
|
||||
|
||||
- ts/index.ts: getS3Descriptor now accepts an optional Partial<IS3Descriptor> to override defaults (backwards compatible)
|
||||
@@ -11,12 +22,14 @@ Allow overriding S3 descriptor; update dependencies, test config and documentati
|
||||
- added project config files: .claude/settings.local.json and .serena/project.yml
|
||||
|
||||
## 2024-11-06 - 2.2.5 - fix(ci)
|
||||
|
||||
Corrected docker image URLs in Gitea workflows to match the correct domain format.
|
||||
|
||||
- Updated IMAGE environment variable in .gitea/workflows/default_nottags.yaml
|
||||
- Updated IMAGE environment variable in .gitea/workflows/default_tags.yaml
|
||||
|
||||
## 2024-11-06 - 2.2.4 - fix(core)
|
||||
|
||||
Improve code style and update dependencies
|
||||
|
||||
- Updated @push.rocks/tapbundle to version ^5.4.3 in package.json.
|
||||
@@ -24,29 +37,34 @@ Improve code style and update dependencies
|
||||
- Improved code consistency in ts/00_commitinfo_data.ts, ts/plugins.ts, and test/test.ts.
|
||||
|
||||
## 2024-11-06 - 2.2.3 - fix(core)
|
||||
|
||||
Fix endpoint address from 'localhost' to '127.0.0.1' for better compatibility in Smarts3.getS3Descriptor
|
||||
|
||||
- Corrected the endpoint address in Smarts3.getS3Descriptor to ensure proper functioning across different environments.
|
||||
|
||||
## 2024-11-06 - 2.2.2 - fix(core)
|
||||
|
||||
Fixed function call for fastPut in the test suite to ensure proper file upload handling.
|
||||
|
||||
- Updated dependencies in package.json to newer versions.
|
||||
- Corrected the function call in test suite for file upload.
|
||||
|
||||
## 2024-10-26 - 2.2.1 - fix(core)
|
||||
|
||||
Fix import and typings for improved compatibility
|
||||
|
||||
- Corrected the type signature for `getS3Descriptor` to return `IS3Descriptor`.
|
||||
- Fixed import structure and updated dependencies for consistent namespace usage across plugins.
|
||||
|
||||
## 2024-10-26 - 2.2.0 - feat(ci)
|
||||
|
||||
Migrate CI/CD workflow from GitLab CI to Gitea CI
|
||||
|
||||
- Added new Gitea CI workflows for both non-tag and tag-based pushes
|
||||
- Removed existing GitLab CI configuration
|
||||
|
||||
## 2024-05-29 - 2.1.1 - Updates and minor changes
|
||||
|
||||
Updates and changes based on minor configuration improvements and organizational shifts.
|
||||
|
||||
- Updated description file.
|
||||
@@ -55,22 +73,26 @@ Updates and changes based on minor configuration improvements and organizational
|
||||
- Shifted to new organizational scheme.
|
||||
|
||||
## 2022-07-30 - 2.1.0 - Core improvements and fixes
|
||||
|
||||
Minor improvements and important core changes.
|
||||
|
||||
- Removed tslint from the core setup.
|
||||
|
||||
## 2022-07-30 - 2.0.2 - Bucket creation improvement
|
||||
|
||||
Enhanced file structure management.
|
||||
|
||||
- Improved bucket creation to store locally within the .nogit directory.
|
||||
|
||||
## 2022-04-14 - 2.0.0 to 2.0.1 - Structural updates and fixes
|
||||
|
||||
This release focused on core updates and structural changes.
|
||||
|
||||
- Reformatted the project structure.
|
||||
- Core updates with minor fixes.
|
||||
|
||||
## 2021-12-20 - 1.0.10 - ESM Transition
|
||||
|
||||
Breaking changes and minor fixes, transitioning to ES Modules.
|
||||
|
||||
- BREAKING CHANGE: Transitioned core setup to ESM.
|
||||
- BREAKING CHANGE: Transitioned core setup to ESM.
|
||||
|
||||
@@ -36,4 +36,4 @@
|
||||
"tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@push.rocks/smarts3",
|
||||
"version": "2.2.6",
|
||||
"version": "2.2.7",
|
||||
"private": false,
|
||||
"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.",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -14,10 +14,10 @@
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.2.0",
|
||||
"@git.zone/tsbundle": "^2.1.0",
|
||||
"@git.zone/tsrun": "^1.3.3",
|
||||
"@git.zone/tstest": "^2.3.2",
|
||||
"@git.zone/tsbuild": "^3.1.0",
|
||||
"@git.zone/tsbundle": "^2.5.2",
|
||||
"@git.zone/tsrun": "^2.0.0",
|
||||
"@git.zone/tstest": "^3.0.0",
|
||||
"@types/node": "^22.9.0"
|
||||
},
|
||||
"browserslist": [
|
||||
@@ -36,10 +36,10 @@
|
||||
"readme.md"
|
||||
],
|
||||
"dependencies": {
|
||||
"@push.rocks/smartbucket": "^3.0.23",
|
||||
"@push.rocks/smartfile": "^11.0.21",
|
||||
"@push.rocks/smartbucket": "^3.3.10",
|
||||
"@push.rocks/smartfile": "^11.2.7",
|
||||
"@push.rocks/smartpath": "^6.0.0",
|
||||
"@tsclass/tsclass": "^9.2.0",
|
||||
"@tsclass/tsclass": "^9.3.0",
|
||||
"@types/s3rver": "^3.7.0",
|
||||
"s3rver": "^3.7.1"
|
||||
},
|
||||
@@ -64,10 +64,13 @@
|
||||
"homepage": "https://code.foss.global/push.rocks/smarts3#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://code.foss.global/push.rocks/smarts3.git"
|
||||
"url": "https://code.foss.global/push.rocks/smarts3.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://code.foss.global/push.rocks/smarts3/issues"
|
||||
},
|
||||
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
|
||||
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
|
||||
"pnpm": {
|
||||
"overrides": {}
|
||||
}
|
||||
}
|
||||
|
||||
4878
pnpm-lock.yaml
generated
4878
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
58
readme.md
58
readme.md
@@ -1,12 +1,12 @@
|
||||
# @push.rocks/smarts3 🚀
|
||||
|
||||
**Mock S3 made simple** - A powerful Node.js TypeScript package for creating a local S3 endpoint that simulates AWS S3 operations using mapped local directories. Perfect for development and testing!
|
||||
**Mock S3 made simple** - A powerful Node.js TypeScript package for creating a local S3 endpoint that simulates AWS S3 operations using mapped local directories. Perfect for development and testing!
|
||||
|
||||
## 🌟 Features
|
||||
|
||||
- 🏃 **Lightning-fast local S3 simulation** - No more waiting for cloud operations during development
|
||||
- 🔄 **Full AWS S3 API compatibility** - Drop-in replacement for S3 in your tests
|
||||
- 📂 **Local directory mapping** - Your buckets live right on your filesystem
|
||||
- 📂 **Local directory mapping** - Your buckets live right on your filesystem
|
||||
- 🧪 **Perfect for testing** - Reliable, repeatable tests without cloud dependencies
|
||||
- 🎯 **TypeScript-first** - Built with TypeScript for excellent type safety and IDE support
|
||||
- 🔧 **Zero configuration** - Works out of the box with sensible defaults
|
||||
@@ -37,7 +37,7 @@ import { Smarts3 } from '@push.rocks/smarts3';
|
||||
// Start your local S3 server
|
||||
const s3Server = await Smarts3.createAndStart({
|
||||
port: 3000,
|
||||
cleanSlate: true // Start with empty buckets
|
||||
cleanSlate: true, // Start with empty buckets
|
||||
});
|
||||
|
||||
// Create a bucket
|
||||
@@ -61,8 +61,8 @@ import { Smarts3 } from '@push.rocks/smarts3';
|
||||
|
||||
// Configuration options
|
||||
const config = {
|
||||
port: 3000, // Port to run the server on (default: 3000)
|
||||
cleanSlate: true // Clear all data on start (default: false)
|
||||
port: 3000, // Port to run the server on (default: 3000)
|
||||
cleanSlate: true, // Clear all data on start (default: false)
|
||||
};
|
||||
|
||||
// Create and start in one go
|
||||
@@ -108,7 +108,7 @@ await baseDir.fastStore('path/to/file.txt', 'Hello, S3! 🎉');
|
||||
// Upload with more control
|
||||
await baseDir.fastPut({
|
||||
path: 'documents/important.pdf',
|
||||
contents: Buffer.from(yourPdfData)
|
||||
contents: Buffer.from(yourPdfData),
|
||||
});
|
||||
```
|
||||
|
||||
@@ -133,7 +133,7 @@ Browse your bucket contents:
|
||||
// List all files in the bucket
|
||||
const files = await baseDir.listFiles();
|
||||
|
||||
files.forEach(file => {
|
||||
files.forEach((file) => {
|
||||
console.log(`📄 ${file.name} (${file.size} bytes)`);
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('S3 Operations', () => {
|
||||
beforeAll(async () => {
|
||||
s3Server = await Smarts3.createAndStart({
|
||||
port: 9999,
|
||||
cleanSlate: true
|
||||
cleanSlate: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -196,7 +196,7 @@ describe('S3 Operations', () => {
|
||||
before(async () => {
|
||||
s3Server = await Smarts3.createAndStart({
|
||||
port: 9999,
|
||||
cleanSlate: true
|
||||
cleanSlate: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -229,16 +229,16 @@ const s3Client = new S3Client({
|
||||
region: 'us-east-1',
|
||||
credentials: {
|
||||
accessKeyId: config.accessKey,
|
||||
secretAccessKey: config.accessSecret
|
||||
secretAccessKey: config.accessSecret,
|
||||
},
|
||||
forcePathStyle: true
|
||||
forcePathStyle: true,
|
||||
});
|
||||
|
||||
// Use AWS SDK as normal
|
||||
const command = new PutObjectCommand({
|
||||
Bucket: 'my-bucket',
|
||||
Key: 'test-file.txt',
|
||||
Body: 'Hello from AWS SDK!'
|
||||
Body: 'Hello from AWS SDK!',
|
||||
});
|
||||
|
||||
await s3Client.send(command);
|
||||
@@ -256,7 +256,7 @@ export async function setupTestEnvironment() {
|
||||
// Start S3 server for CI tests
|
||||
const s3 = await Smarts3.createAndStart({
|
||||
port: process.env.S3_PORT || 3000,
|
||||
cleanSlate: true
|
||||
cleanSlate: true,
|
||||
});
|
||||
|
||||
// Create test buckets
|
||||
@@ -282,7 +282,7 @@ async function startDevelopmentServer() {
|
||||
|
||||
// Start your API server
|
||||
const app = express();
|
||||
|
||||
|
||||
app.post('/upload', async (req, res) => {
|
||||
// Your upload logic using local S3
|
||||
});
|
||||
@@ -300,7 +300,7 @@ import { Smarts3 } from '@push.rocks/smarts3';
|
||||
|
||||
async function testDataMigration() {
|
||||
const s3 = await Smarts3.createAndStart({ cleanSlate: true });
|
||||
|
||||
|
||||
// Create source and destination buckets
|
||||
const sourceBucket = await s3.createBucket('legacy-data');
|
||||
const destBucket = await s3.createBucket('new-data');
|
||||
@@ -310,10 +310,16 @@ async function testDataMigration() {
|
||||
const smartbucket = new SmartBucket(config);
|
||||
const source = await smartbucket.getBucket('legacy-data');
|
||||
const sourceDir = await source.getBaseDirectory();
|
||||
|
||||
|
||||
// Add test files
|
||||
await sourceDir.fastStore('user-1.json', JSON.stringify({ id: 1, name: 'Alice' }));
|
||||
await sourceDir.fastStore('user-2.json', JSON.stringify({ id: 2, name: 'Bob' }));
|
||||
await sourceDir.fastStore(
|
||||
'user-1.json',
|
||||
JSON.stringify({ id: 1, name: 'Alice' }),
|
||||
);
|
||||
await sourceDir.fastStore(
|
||||
'user-2.json',
|
||||
JSON.stringify({ id: 2, name: 'Bob' }),
|
||||
);
|
||||
|
||||
// Run your migration logic
|
||||
await runMigration(config);
|
||||
@@ -322,7 +328,7 @@ async function testDataMigration() {
|
||||
const dest = await smartbucket.getBucket('new-data');
|
||||
const destDir = await dest.getBaseDirectory();
|
||||
const migratedFiles = await destDir.listFiles();
|
||||
|
||||
|
||||
console.log(`✅ Migrated ${migratedFiles.length} files successfully!`);
|
||||
}
|
||||
```
|
||||
@@ -335,9 +341,9 @@ When integrating with different S3 clients, you can customize the connection det
|
||||
|
||||
```typescript
|
||||
const customDescriptor = await s3Server.getS3Descriptor({
|
||||
endpoint: 'localhost', // Custom endpoint
|
||||
port: 3001, // Different port
|
||||
useSsl: false, // SSL configuration
|
||||
endpoint: 'localhost', // Custom endpoint
|
||||
port: 3001, // Different port
|
||||
useSsl: false, // SSL configuration
|
||||
// Add any additional options your S3 client needs
|
||||
});
|
||||
```
|
||||
@@ -347,7 +353,7 @@ const customDescriptor = await s3Server.getS3Descriptor({
|
||||
```typescript
|
||||
const config = {
|
||||
port: parseInt(process.env.S3_PORT || '3000'),
|
||||
cleanSlate: process.env.NODE_ENV === 'test'
|
||||
cleanSlate: process.env.NODE_ENV === 'test',
|
||||
};
|
||||
|
||||
const s3Server = await Smarts3.createAndStart(config);
|
||||
@@ -370,7 +376,7 @@ const s3Server = await Smarts3.createAndStart(config);
|
||||
|
||||
```typescript
|
||||
interface ISmarts3ContructorOptions {
|
||||
port?: number; // Server port (default: 3000)
|
||||
port?: number; // Server port (default: 3000)
|
||||
cleanSlate?: boolean; // Clear storage on start (default: false)
|
||||
}
|
||||
```
|
||||
@@ -408,7 +414,7 @@ interface ISmarts3ContructorOptions {
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
@@ -423,4 +429,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smarts3',
|
||||
version: '2.2.6',
|
||||
version: '2.2.7',
|
||||
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.'
|
||||
}
|
||||
|
||||
12
ts/index.ts
12
ts/index.ts
@@ -8,7 +8,9 @@ export interface ISmarts3ContructorOptions {
|
||||
|
||||
export class Smarts3 {
|
||||
// STATIC
|
||||
public static async createAndStart(optionsArg: ConstructorParameters<typeof Smarts3>[0]) {
|
||||
public static async createAndStart(
|
||||
optionsArg: ConstructorParameters<typeof Smarts3>[0],
|
||||
) {
|
||||
const smartS3Instance = new Smarts3(optionsArg);
|
||||
await smartS3Instance.start();
|
||||
return smartS3Instance;
|
||||
@@ -43,7 +45,7 @@ export class Smarts3 {
|
||||
}
|
||||
|
||||
public async getS3Descriptor(
|
||||
optionsArg?: Partial<plugins.tsclass.storage.IS3Descriptor>
|
||||
optionsArg?: Partial<plugins.tsclass.storage.IS3Descriptor>,
|
||||
): Promise<plugins.tsclass.storage.IS3Descriptor> {
|
||||
return {
|
||||
...{
|
||||
@@ -53,12 +55,14 @@ export class Smarts3 {
|
||||
port: this.options.port,
|
||||
useSsl: false,
|
||||
},
|
||||
...(optionsArg? optionsArg : {})
|
||||
...(optionsArg ? optionsArg : {}),
|
||||
};
|
||||
}
|
||||
|
||||
public async createBucket(bucketNameArg: string) {
|
||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket(await this.getS3Descriptor());
|
||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket(
|
||||
await this.getS3Descriptor(),
|
||||
);
|
||||
const bucket = await smartbucketInstance.createBucket(bucketNameArg);
|
||||
return bucket;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
@@ -10,7 +8,5 @@
|
||||
"baseUrl": ".",
|
||||
"paths": {}
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
"exclude": ["dist_*/**/*.d.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user