diff --git a/changelog.md b/changelog.md index 6016d16..2b6deda 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ # Changelog +## 2025-11-23 - 1.7.0 - feat(core) +Standardize S3 storage config using @tsclass/tsclass IS3Descriptor and wire it into RegistryStorage and plugins exports; update README and package dependencies. + +- Add @tsclass/tsclass dependency to package.json to provide a standardized IS3Descriptor for S3 configuration. +- Export tsclass from ts/plugins.ts so plugin types are available to core modules. +- Update IStorageConfig to extend plugins.tsclass.storage.IS3Descriptor, consolidating storage configuration typing. +- Change RegistryStorage.init() to pass the storage config directly as an IS3Descriptor to SmartBucket (bucketName remains part of IStorageConfig). +- Update README storage section with example config and mention IS3Descriptor integration. + ## 2025-11-21 - 1.6.0 - feat(core) Add PyPI and RubyGems registries, integrate into SmartRegistry, extend storage and auth diff --git a/package.json b/package.json index dc7f046..f33a8be 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@push.rocks/smartbucket": "^4.3.0", "@push.rocks/smartlog": "^3.1.10", "@push.rocks/smartpath": "^6.0.0", + "@tsclass/tsclass": "^9.3.0", "adm-zip": "^0.5.10" }, "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d62d4b9..46d61b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@push.rocks/smartpath': specifier: ^6.0.0 version: 6.0.0 + '@tsclass/tsclass': + specifier: ^9.3.0 + version: 9.3.0 adm-zip: specifier: ^0.5.10 version: 0.5.16 diff --git a/readme.md b/readme.md index d1116e4..0731101 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community ### 🏗️ Unified Architecture - **Composable Design**: Core infrastructure with protocol plugins -- **Shared Storage**: Cloud-agnostic S3-compatible backend ([@push.rocks/smartbucket](https://www.npmjs.com/package/@push.rocks/smartbucket)) +- **Shared Storage**: Cloud-agnostic S3-compatible backend using [@push.rocks/smartbucket](https://www.npmjs.com/package/@push.rocks/smartbucket) with standardized `IS3Descriptor` from [@tsclass/tsclass](https://www.npmjs.com/package/@tsclass/tsclass) - **Unified Authentication**: Scope-based permissions across all protocols - **Path-based Routing**: `/oci/*` for containers, `/npm/*` for packages, `/maven/*` for Java artifacts, `/cargo/*` for Rust crates, `/composer/*` for PHP packages, `/pypi/*` for Python packages, `/rubygems/*` for Ruby gems @@ -652,15 +652,24 @@ const canWrite = await authManager.authorize( ### Storage Configuration +The storage configuration extends `IS3Descriptor` from `@tsclass/tsclass` for standardized S3 configuration: + ```typescript +import type { IS3Descriptor } from '@tsclass/tsclass'; + +storage: IS3Descriptor & { + bucketName: string; // Bucket name for registry storage +} + +// Example: storage: { accessKey: string; // S3 access key accessSecret: string; // S3 secret key - endpoint: string; // S3 endpoint + endpoint: string; // S3 endpoint (e.g., 's3.amazonaws.com') port?: number; // Default: 443 useSsl?: boolean; // Default: true - region?: string; // Default: 'us-east-1' - bucketName: string; // Bucket name + region?: string; // AWS region (e.g., 'us-east-1') + bucketName: string; // Bucket name for this registry } ``` diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 5ec5c67..da0f77d 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartregistry', - version: '1.6.0', + version: '1.7.0', description: 'A composable TypeScript library implementing OCI, NPM, Maven, Cargo, Composer, PyPI, and RubyGems registries for building unified container and package registries' } diff --git a/ts/core/classes.registrystorage.ts b/ts/core/classes.registrystorage.ts index ee2bbc1..a35aa5e 100644 --- a/ts/core/classes.registrystorage.ts +++ b/ts/core/classes.registrystorage.ts @@ -18,14 +18,8 @@ export class RegistryStorage implements IStorageBackend { * Initialize the storage backend */ public async init(): Promise { - this.smartBucket = new plugins.smartbucket.SmartBucket({ - accessKey: this.config.accessKey, - accessSecret: this.config.accessSecret, - endpoint: this.config.endpoint, - port: this.config.port || 443, - useSsl: this.config.useSsl !== false, - region: this.config.region || 'us-east-1', - }); + // Pass config as IS3Descriptor to SmartBucket (bucketName is extra, SmartBucket ignores it) + this.smartBucket = new plugins.smartbucket.SmartBucket(this.config as plugins.tsclass.storage.IS3Descriptor); // Ensure bucket exists await this.smartBucket.createBucket(this.bucketName).catch(() => { diff --git a/ts/core/interfaces.core.ts b/ts/core/interfaces.core.ts index a0fc535..019fb0e 100644 --- a/ts/core/interfaces.core.ts +++ b/ts/core/interfaces.core.ts @@ -2,6 +2,8 @@ * Core interfaces for the composable registry system */ +import type * as plugins from '../plugins.js'; + /** * Registry protocol types */ @@ -40,14 +42,9 @@ export interface ICredentials { /** * Storage backend configuration + * Extends IS3Descriptor from @tsclass/tsclass with bucketName */ -export interface IStorageConfig { - accessKey: string; - accessSecret: string; - endpoint: string; - port?: number; - useSsl?: boolean; - region?: string; +export interface IStorageConfig extends plugins.tsclass.storage.IS3Descriptor { bucketName: string; } diff --git a/ts/plugins.ts b/ts/plugins.ts index 1e89589..d4fdbe9 100644 --- a/ts/plugins.ts +++ b/ts/plugins.ts @@ -9,3 +9,8 @@ import * as smartlog from '@push.rocks/smartlog'; import * as smartpath from '@push.rocks/smartpath'; export { smartbucket, smartlog, smartpath }; + +// @tsclass scope +import * as tsclass from '@tsclass/tsclass'; + +export { tsclass };