s3db.js
Version:
Use AWS S3, the world's most reliable document storage, as a database with this ORM.
39 lines (35 loc) • 1.11 kB
JavaScript
import * as userManaged from './user-managed.js';
import * as enforceLimits from './enforce-limits.js';
import * as dataTruncate from './truncate-data.js';
import * as bodyOverflow from './body-overflow.js';
import * as bodyOnly from './body-only.js';
/**
* Available behaviors for Resource metadata handling
*/
export const behaviors = {
'user-managed': userManaged,
'enforce-limits': enforceLimits,
'truncate-data': dataTruncate,
'body-overflow': bodyOverflow,
'body-only': bodyOnly
};
/**
* Get behavior implementation by name
* @param {string} behaviorName - Name of the behavior
* @returns {Object} Behavior implementation with handler functions
*/
export function getBehavior(behaviorName) {
const behavior = behaviors[behaviorName];
if (!behavior) {
throw new Error(`Unknown behavior: ${behaviorName}. Available behaviors: ${Object.keys(behaviors).join(', ')}`);
}
return behavior;
}
/**
* List of available behavior names
*/
export const AVAILABLE_BEHAVIORS = Object.keys(behaviors);
/**
* Default behavior name
*/
export const DEFAULT_BEHAVIOR = 'user-managed';