/**
 * Baasix Utilities - Core utility functions and managers
 *
 * This module exports all utility functions and managers used throughout
 * the Baasix application with Drizzle ORM.
 */
/**
 * Baasix Utilities Index
 *
 * Centralized exports for all utility modules
 */
export { initializeDatabase, initializeDatabaseWithCache, getDatabase, getSqlClient, getReadSqlClient, testConnection, closeDatabase, createTransaction, getInstanceId, getPostgresVersion, isPgVersionAtLeast, db, sqlClient, } from './db.js';
export type { TransactionClient, Transaction } from './db.js';
export { default as env } from './env.js';
export { mapJsonTypeToDrizzle } from './typeMapper.js';
export { default as typeMapper } from './typeMapper.js';
export { schemaManager } from './schemaManager.js';
export { relationBuilder, RelationBuilder } from './relationUtils.js';
export { systemSchemas } from './systemschema.js';
export * from './filterOperators.js';
export * from './queryBuilder.js';
export * from './orderUtils.js';
export * from './aggregationUtils.js';
export * from './relationLoader.js';
export { getBaasixRoot, getBaasixPath, getProjectDir, getProjectPath, toFileURL, isCommonJS, } from './dirname.js';
export { initializeCache, getCache, closeCache, } from './cache.js';
export type { CacheInterface } from './cache.js';
export { shouldEnforceTenantContext, supportsPublicAccess, buildTenantFilter, enforceTenantContext, validateTenantContext, } from './tenantUtils.js';
export { verifyJWT, generateJWT, getRolesAndPermissions, getUserRolesPermissionsAndTenant, extractTokenFromHeader, getPublicRole, authMiddleware, isAdmin, adminOnly, createSession, validateSession, generateToken, } from './auth.js';
export type { UserWithRolesAndPermissions } from './auth.js';
export { default as spatialUtils } from './spatialUtils.js';
export { default as fieldUtils } from './fieldUtils.js';
export { default as importUtils } from './importUtils.js';
export { default as schemaValidator } from './schemaValidator.js';
export { default as valueValidator } from './valueValidator.js';
export { initializeCacheService, getCacheService, closeCacheService, invalidateCollection, invalidateEntireCache, BaasixDrizzleCache, InMemoryCacheAdapter, RedisCacheAdapter, UpstashCacheAdapter, } from '../services/CacheService.js';
export { default as seedUtility } from './seed.js';
export { seedCollection, seedMultiple, generateTemplate, printSummary, } from './seed.js';
export { checkWorkflowRoleAccess, fetchWorkflowForExecution, validateWorkflowAccess, fetchAndValidateWorkflow, canSetWorkflowRoles, } from './workflow.js';
export { sortItems, reorderItems, getNextSortValue, } from './sortUtils.js';
export type { SortOptions, SortResult } from './sortUtils.js';
export { APIError, errorHandler } from './errorHandler.js';
export { triggerLogCleanup, startLogCleanup } from './logCleanup.js';
export { initializeLogger, getLogger, getOriginalConsole } from './logger.js';
export type { BaasixLoggerOptions, Logger, LoggerOptions, DestinationStream } from './logger.js';
export { modelExistsMiddleware, requireAuth, collectionHasTenantField, invalidateAuthCache, invalidateUserRoleCache, invalidateCollectionCache, invalidateSettingsCache, invalidateSettingsCacheAfterImport, } from './common.js';
export { resolveDynamicVariables } from './dynamicVariableResolver.js';
/**
 * USAGE EXAMPLES FOR EXTENSIONS
 * ==============================
 *
 * 1. DATABASE OPERATIONS:
 *    import { db, sqlClient, getDatabase, createTransaction } from 'baasix';
 *
 *    // Raw SQL query
 *    const results = await sqlClient`SELECT * FROM users WHERE active = true`;
 *
 *    // Using transaction
 *    const tx = await createTransaction();
 *    try {
 *      await tx.insert(table).values(data);
 *      await tx.commit();
 *    } catch (error) {
 *      await tx.rollback();
 *    }
 *
 * 2. PATH UTILITIES:
 *    import { getBaasixPath, getProjectPath } from 'baasix';
 *    const templatePath = getBaasixPath('templates', 'email.liquid');
 *    const extensionPath = getProjectPath('extensions', 'my-plugin');
 *
 * 3. CACHE OPERATIONS:
 *    import { getCache } from 'baasix';
 *    const cache = getCache();
 *    await cache.set('my-key', value, 3600); // 1 hour TTL
 *    const cached = await cache.get('my-key');
 *
 * 4. TENANT UTILITIES (Multi-tenant mode):
 *    import { shouldEnforceTenantContext, buildTenantFilter } from 'baasix';
 *    if (await shouldEnforceTenantContext(service)) {
 *      const filter = buildTenantFilter('orders', tenantId);
 *    }
 *
 * 5. AUTH UTILITIES:
 *    import { verifyJWT, getRolesAndPermissions } from 'baasix';
 *    const decoded = verifyJWT(token);
 *    const { role, permissions } = await getRolesAndPermissions(roleId);
 *
 * 6. SPATIAL OPERATIONS:
 *    import { spatialUtils } from 'baasix';
 *    const point = spatialUtils.pointToGeometry(-122.4194, 37.7749);
 *    const nearby = spatialUtils.dwithin('location', point, 1000, true);
 *
 * 7. FIELD UTILITIES:
 *    import { fieldUtils } from 'baasix';
 *    const fields = fieldUtils.getFlattenedFields('users');
 *    const validation = fieldUtils.validateRequiredFields('users', data);
 *
 * 8. IMPORT/EXPORT:
 *    import { importUtils } from 'baasix';
 *    const data = importUtils.parseCSV(fileBuffer);
 *    const csv = importUtils.exportToCSV(users, ['id', 'email']);
 *
 * 9. SCHEMA VALIDATION:
 *    import { schemaValidator } from 'baasix';
 *    const result = schemaValidator.validateSchemaBeforeCreate('users', schema);
 *
 * 10. CACHED OPERATIONS:
 *     import { getCacheService } from 'baasix';
 *     const cacheService = getCacheService();
 *
 * 11. DATABASE SEEDING:
 *     import { seedUtility } from 'baasix';
 *     await seedUtility.seedCollection({ collection: 'users', data: [...] });
 *
 * 12. WORKFLOW ACCESS CONTROL:
 *     import { checkWorkflowRoleAccess, fetchWorkflowForExecution } from 'baasix';
 *     const workflow = await fetchWorkflowForExecution(workflowId, true);
 *     const hasAccess = checkWorkflowRoleAccess(workflow, req.accountability);
 *
 * 13. ENVIRONMENT VARIABLES:
 *     import { env } from 'baasix';
 *     const dbUrl = env.get('DATABASE_URL');
 *     const isMultiTenant = env.get('MULTI_TENANT') === 'true';
 *
 * 14. ERROR HANDLING:
 *     import { APIError } from 'baasix';
 *     throw new APIError('Not found', 404);
 */
//# sourceMappingURL=index.d.ts.map