@chargebee/chargebee-apps-shared
Shared interfaces, types, and utilities for the Chargebee Apps CLI ecosystem.
Installation
npm install @chargebee/chargebee-apps-shared
This package is typically installed as a dependency of @chargebee/chargebee-apps or @chargebee/chargebee-apps-libs.
Overview
Provides the common building blocks used across Chargebee Apps packages:
- Configuration — environment detection and path resolution
- Dependency management — isolated npm installs and secure module loading
- Validation — manifest, package, and iparams validation
- File and archive services — packaging and file operations
- Logging — standardized logging interfaces
- Sandbox — secure code execution contracts
- Types — shared event, manifest, and handler types
Usage
import {
DependencyManager,
ManifestValidator,
PathResolver,
EnvironmentConfig,
CBFileSystem,
CBProcess,
} from '@chargebee/chargebee-apps-shared';
const envConfig = new EnvironmentConfig();
const pathResolver = new PathResolver();
const fileSystem = new CBFileSystem();
const dependencyManager = new DependencyManager(fileSystem);
const allowedModules = [{ name: 'lodash', version: '^4.17.21' }];
const validator = new ManifestValidator(allowedModules);
const manifest = validator.validateFile('./my-app/manifest.json');
await dependencyManager.ensureDependencies('./my-app', manifest);
Main exports
EnvironmentConfig | Detect development vs production runtime |
PathResolver | Resolve CLI and package paths |
DependencyManager | Install and load app dependencies safely |
ManifestValidator | Validate manifest.json |
PackageValidator | Validate app package structure |
ArchiveService | Create and extract zip packages |
TemplateService | Copy app templates |
FileManagementService | Collect files for packaging |
IparamsService | Load and validate iparams |
CBFileSystem / CBProcess | File and process abstractions |
sandboxContext | Correlate sandbox execution context |
Related packages
License
MIT