/** * @db4/core - Constants and Limits * * Defines system-wide constants, limits, thresholds, and default values. * * @packageDocumentation */ /** * Maximum document size in bytes (100KB). * Documents larger than this will be rejected. */ export declare const MAX_DOCUMENT_SIZE: number; /** * Maximum batch size in bytes (900KB). * Batches larger than this will be split. */ export declare const MAX_BATCH_SIZE: number; /** * Maximum result size in bytes (10MB). * Query results larger than this will trigger streaming mode. */ export declare const MAX_RESULT_SIZE: number; /** * Maximum query memory budget in bytes (50MB). * Queries exceeding this will be aborted. */ export declare const MAX_QUERY_MEMORY: number; /** * Maximum CDC log size in bytes before compaction (100MB). */ export declare const MAX_CDC_LOG_SIZE: number; /** * Maximum index size in bytes (1GB). */ export declare const MAX_INDEX_SIZE: number; /** * Durable Object transient allocation limit (128MB). */ export declare const DO_TRANSIENT_LIMIT: number; /** * Documents per batch tier options. */ export declare const BATCH_SIZE_TIER: { readonly SMALL: 64; readonly MEDIUM: 128; readonly LARGE: 256; }; /** * Default documents per batch. */ export declare const DEFAULT_BATCH_SIZE: 128; /** * Maximum nested depth for documents. */ export declare const MAX_NESTED_DEPTH = 100; /** * Maximum field name length. */ export declare const MAX_FIELD_NAME_LENGTH = 256; /** * Maximum string field value length. */ export declare const MAX_STRING_VALUE_LENGTH: number; /** * Maximum array length in a document. */ export declare const MAX_ARRAY_LENGTH = 10000; /** * Maximum number of fields in a document. */ export declare const MAX_DOCUMENT_FIELDS = 1000; /** * Default query result limit. */ export declare const DEFAULT_QUERY_LIMIT = 100; /** * Maximum query result limit. */ export declare const MAX_QUERY_LIMIT = 10000; /** * Default query timeout in milliseconds (30 seconds). */ export declare const DEFAULT_QUERY_TIMEOUT: number; /** * Maximum query timeout in milliseconds (5 minutes). */ export declare const MAX_QUERY_TIMEOUT: number; /** * Threshold for auto-switching to streaming mode (document count). */ export declare const STREAMING_THRESHOLD = 1000; /** * Maximum filters in a single query. */ export declare const MAX_QUERY_FILTERS = 50; /** * Maximum sort fields in a single query. */ export declare const MAX_SORT_FIELDS = 10; /** * Maximum projection fields in a single query. */ export declare const MAX_PROJECTION_FIELDS = 100; /** * Default transaction timeout in milliseconds (30 seconds). */ export declare const DEFAULT_TRANSACTION_TIMEOUT: number; /** * Maximum transaction timeout in milliseconds (2 minutes). */ export declare const MAX_TRANSACTION_TIMEOUT: number; /** * Maximum concurrent transactions per shard. */ export declare const MAX_CONCURRENT_TRANSACTIONS = 100; /** * Maximum documents in a transaction read set. */ export declare const MAX_TRANSACTION_READ_SET = 10000; /** * Maximum documents in a transaction write set. */ export declare const MAX_TRANSACTION_WRITE_SET = 1000; /** * Default CDC batch size (entries per batch). */ export declare const DEFAULT_CDC_BATCH_SIZE = 100; /** * Maximum CDC batch size. */ export declare const MAX_CDC_BATCH_SIZE = 1000; /** * Default CDC flush interval in milliseconds (5 seconds). */ export declare const DEFAULT_CDC_FLUSH_INTERVAL: number; /** * CDC retention period in milliseconds (7 days). */ export declare const DEFAULT_CDC_RETENTION_PERIOD: number; /** * Maximum CDC log entries before compaction. */ export declare const MAX_CDC_LOG_ENTRIES = 1000000; /** * Maximum indexes per collection. */ export declare const MAX_INDEXES_PER_COLLECTION = 20; /** * Maximum fields in a compound index. */ export declare const MAX_COMPOUND_INDEX_FIELDS = 10; /** * Maximum index name length. */ export declare const MAX_INDEX_NAME_LENGTH = 64; /** * Maximum shards per database. */ export declare const MAX_SHARDS = 1000; /** * Default number of shards. */ export declare const DEFAULT_SHARD_COUNT = 1; /** * Maximum shard key length. */ export declare const MAX_SHARD_KEY_LENGTH = 256; /** * Default retry count for transient errors. */ export declare const DEFAULT_RETRY_COUNT = 3; /** * Default retry delay in milliseconds. */ export declare const DEFAULT_RETRY_DELAY = 100; /** * Maximum retry delay in milliseconds. */ export declare const MAX_RETRY_DELAY: number; /** * Retry backoff multiplier. */ export declare const RETRY_BACKOFF_MULTIPLIER = 2; /** * Jitter factor for retry delays (0-1). */ export declare const RETRY_JITTER_FACTOR = 0.1; /** * Default cursor TTL in milliseconds (1 hour). */ export declare const DEFAULT_CURSOR_TTL: number; /** * Maximum cursor TTL in milliseconds (24 hours). */ export declare const MAX_CURSOR_TTL: number; /** * Cursor version for schema migration. */ export declare const CURSOR_VERSION = 1; /** * Default telemetry buffer size. */ export declare const DEFAULT_TELEMETRY_BUFFER_SIZE = 100; /** * Default telemetry flush interval in milliseconds. */ export declare const DEFAULT_TELEMETRY_FLUSH_INTERVAL: number; /** * Default query sampling rate. */ export declare const DEFAULT_QUERY_SAMPLING_RATE = 1; /** * Default performance sampling rate. */ export declare const DEFAULT_PERFORMANCE_SAMPLING_RATE = 0.1; /** * Maximum log entry size in bytes. */ export declare const MAX_LOG_ENTRY_SIZE: number; /** * Default log batch size. */ export declare const DEFAULT_LOG_BATCH_SIZE = 50; /** * Default log batch interval in milliseconds. */ export declare const DEFAULT_LOG_BATCH_INTERVAL = 1000; /** * Reserved collection names that cannot be used. */ export declare const RESERVED_COLLECTION_NAMES: readonly ["_system", "_meta", "_cdc", "_indexes", "_transactions", "_stats", "_config", "_schema"]; /** * Internal collection name prefix. */ export declare const INTERNAL_COLLECTION_PREFIX = "_"; /** * Maximum collection name length. */ export declare const MAX_COLLECTION_NAME_LENGTH = 128; /** * Reserved field names that have special meaning. */ export declare const RESERVED_FIELD_NAMES: readonly ["id", "_meta", "_id", "_rev", "_deleted"]; /** * Internal field name prefix. */ export declare const INTERNAL_FIELD_PREFIX = "_"; /** * Default feature flag values. */ export declare const DEFAULT_FEATURE_FLAGS: { /** Enable CDC logging */ readonly enableCDC: true; /** Enable schemaless mode */ readonly enableSchemaless: true; /** Enable query caching */ readonly enableQueryCache: false; /** Enable compression */ readonly enableCompression: false; /** Enable telemetry */ readonly enableTelemetry: true; /** Enable structured logging */ readonly enableStructuredLogging: true; /** Enable cursor pagination */ readonly enableCursorPagination: true; /** Enable transactions */ readonly enableTransactions: true; /** Enable streaming queries */ readonly enableStreamingQueries: true; }; /** * Feature flag type. */ export type FeatureFlags = typeof DEFAULT_FEATURE_FLAGS; /** * Default HTTP request timeout in milliseconds. */ export declare const DEFAULT_HTTP_TIMEOUT: number; /** * Maximum HTTP request body size in bytes. */ export declare const MAX_HTTP_BODY_SIZE: number; /** * Maximum concurrent HTTP requests. */ export declare const MAX_CONCURRENT_REQUESTS = 100; /** * Package version. */ export declare const VERSION = "0.1.0-rc.1"; /** * Minimum supported version for compatibility. */ export declare const MIN_COMPATIBLE_VERSION = "0.1.0"; /** * Schema version for data format. */ export declare const SCHEMA_VERSION = 1; /** * Check if a collection name is reserved. */ export declare function isReservedCollectionName(name: string): boolean; /** * Check if a field name is reserved. */ export declare function isReservedFieldName(name: string): boolean; /** * Check if a collection name is internal (starts with underscore). */ export declare function isInternalCollection(name: string): boolean; /** * Check if a field name is internal (starts with underscore). */ export declare function isInternalField(name: string): boolean; /** * Validates that a document size is within limits. */ export declare function validateDocumentSize(sizeBytes: number): { valid: boolean; error?: string; }; /** * Validates that a collection name is valid. */ export declare function validateCollectionName(name: string): { valid: boolean; error?: string; }; /** * Validates that a field name is valid. */ export declare function validateFieldName(name: string): { valid: boolean; error?: string; }; //# sourceMappingURL=constants.d.ts.map