aab_node_storage_core
v1.0.0
Published
AppSolve Application Blocks - Storage Core TypeScript Interfaces
Maintainers
Readme
AppSolve Application Blocks - Storage Core
TypeScript interfaces for unified storage providers in AppSolve Application Blocks.
Installation
npm install aab_node_storage_coreUsage
This package provides a TypeScript interface for implementing storage providers with a unified API.
Basic Storage Provider Interface
import { StorageProvider } from 'aab_node_storage_core';
class MyStorageProvider implements StorageProvider {
async list(path: string): Promise<string[]> {
// Implementation for listing files/directories
}
async get(path: string): Promise<Buffer> {
// Implementation for getting file contents
}
async put(path: string, data: Buffer): Promise<void> {
// Implementation for storing data
}
async delete(path: string): Promise<void> {
// Implementation for deleting files/directories
}
}Available Interface
StorageProvider
The core StorageProvider interface provides basic storage operations:
list(path: string): Promise<string[]>- List files and directoriesget(path: string): Promise<Buffer>- Get file contentsput(path: string, data: Buffer): Promise<void>- Store datadelete(path: string): Promise<void>- Delete files/directories
TypeScript Support
This package is written in TypeScript and includes full type definitions. No additional @types packages are needed.
Publishing to npm
To publish this package to npm, follow these steps:
Prerequisites
- Create an npm account at npmjs.com if you don't have one
- Login to npm in your terminal:
npm login - Verify your login:
npm whoami
Publishing Steps
Update the version in
package.json(follow semantic versioning):# For patch releases (bug fixes) npm version patch # For minor releases (new features) npm version minor # For major releases (breaking changes) npm version majorBuild the package (this happens automatically during publish due to
prepublishOnlyscript):npm run buildTest the package contents before publishing:
npm pack --dry-runPublish to npm:
npm publish
Publishing to a Scoped Package (Optional)
If you want to publish under a scope (e.g., @your-org/aab_node_storage_core):
Update package name in
package.json:{ "name": "@your-org/aab_node_storage_core" }Publish with public access:
npm publish --access public
Automated Publishing (Optional)
For automated publishing via CI/CD, you can:
Generate an npm token:
npm token createAdd to your CI environment as
NPM_TOKENUse in CI script:
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc npm publish
Verification
After publishing, verify your package:
- Check on npmjs.com: Visit
https://www.npmjs.com/package/aab_node_storage_core - Test installation:
npm install aab_node_storage_core
License
ISC
Contributing
Issues and pull requests are welcome on GitHub.
Author
Chintana Meegamarachchi
