Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/constants/quota-constants

lib/constants/quota-constants

Constants for the quota system.

This file defines trust levels, default quotas, and quota-related constants used throughout the application to control resource usage and enforce limits.

Interfaces

UserQuotas

User quota configuration interface.

Properties

maxActiveSchedules

maxActiveSchedules: number

maxUrlFetchesPerDay

maxUrlFetchesPerDay: number

maxFileUploadsPerDay

maxFileUploadsPerDay: number

maxEventsPerImport

maxEventsPerImport: number

maxTotalEvents

maxTotalEvents: number

maxImportJobsPerDay

maxImportJobsPerDay: number

maxFileSizeMB

maxFileSizeMB: number

maxCatalogsPerUser

maxCatalogsPerUser: number


UserUsage

User usage tracking interface.

Properties

currentActiveSchedules

currentActiveSchedules: number

urlFetchesToday

urlFetchesToday: number

fileUploadsToday

fileUploadsToday: number

importJobsToday

importJobsToday: number

totalEventsCreated

totalEventsCreated: number

currentCatalogs

currentCatalogs: number

lastResetDate

lastResetDate: string

Type Aliases

TrustLevel

TrustLevel = typeof TRUST_LEVELS[keyof typeof TRUST_LEVELS]


QuotaType

QuotaType = typeof QUOTA_TYPES[keyof typeof QUOTA_TYPES]


UsageType

UsageType = typeof USAGE_TYPES[keyof typeof USAGE_TYPES]

Variables

TRUST_LEVELS

const TRUST_LEVELS: object

Trust levels for users, determining their access and resource limits.

Type declaration

UNTRUSTED

readonly UNTRUSTED: 0 = 0

BASIC

readonly BASIC: 1 = 1

REGULAR

readonly REGULAR: 2 = 2

TRUSTED

readonly TRUSTED: 3 = 3

POWER_USER

readonly POWER_USER: 4 = 4

UNLIMITED

readonly UNLIMITED: 5 = 5


DEFAULT_QUOTAS

const DEFAULT_QUOTAS: Record<TrustLevel, UserQuotas>

Default quotas for each trust level. -1 indicates unlimited.


TRUST_LEVEL_LABELS

const TRUST_LEVEL_LABELS: Record<TrustLevel, string>

Trust level labels for UI display.


TRUST_LEVEL_DESCRIPTIONS

const TRUST_LEVEL_DESCRIPTIONS: Record<TrustLevel, string>

Trust level descriptions for UI tooltips.


QUOTA_TYPES

const QUOTA_TYPES: object

Quota type identifiers for tracking and error messages.

Type declaration

ACTIVE_SCHEDULES

readonly ACTIVE_SCHEDULES: "maxActiveSchedules" = "maxActiveSchedules"

URL_FETCHES_PER_DAY

readonly URL_FETCHES_PER_DAY: "maxUrlFetchesPerDay" = "maxUrlFetchesPerDay"

FILE_UPLOADS_PER_DAY

readonly FILE_UPLOADS_PER_DAY: "maxFileUploadsPerDay" = "maxFileUploadsPerDay"

EVENTS_PER_IMPORT

readonly EVENTS_PER_IMPORT: "maxEventsPerImport" = "maxEventsPerImport"

TOTAL_EVENTS

readonly TOTAL_EVENTS: "maxTotalEvents" = "maxTotalEvents"

IMPORT_JOBS_PER_DAY

readonly IMPORT_JOBS_PER_DAY: "maxImportJobsPerDay" = "maxImportJobsPerDay"

FILE_SIZE_MB

readonly FILE_SIZE_MB: "maxFileSizeMB" = "maxFileSizeMB"

CATALOGS_PER_USER

readonly CATALOGS_PER_USER: "maxCatalogsPerUser" = "maxCatalogsPerUser"


USAGE_TYPES

const USAGE_TYPES: object

Usage type identifiers for tracking.

Type declaration

CURRENT_ACTIVE_SCHEDULES

readonly CURRENT_ACTIVE_SCHEDULES: "currentActiveSchedules" = "currentActiveSchedules"

URL_FETCHES_TODAY

readonly URL_FETCHES_TODAY: "urlFetchesToday" = "urlFetchesToday"

FILE_UPLOADS_TODAY

readonly FILE_UPLOADS_TODAY: "fileUploadsToday" = "fileUploadsToday"

IMPORT_JOBS_TODAY

readonly IMPORT_JOBS_TODAY: "importJobsToday" = "importJobsToday"

TOTAL_EVENTS_CREATED

readonly TOTAL_EVENTS_CREATED: "totalEventsCreated" = "totalEventsCreated"

CURRENT_CATALOGS

readonly CURRENT_CATALOGS: "currentCatalogs" = "currentCatalogs"


RATE_LIMITS_BY_TRUST_LEVEL

const RATE_LIMITS_BY_TRUST_LEVEL: object

Rate limit configurations by trust level. Each level has progressively more generous limits.

Type declaration

0

readonly 0: object

0.FILE_UPLOAD

readonly FILE_UPLOAD: object

0.FILE_UPLOAD.windows

readonly windows: readonly [{ limit: 1; windowMs: number; name: "burst"; }, { limit: 1; windowMs: number; name: "hourly"; }, { limit: 1; windowMs: number; name: "daily"; }]

0.API_GENERAL

readonly API_GENERAL: object

0.API_GENERAL.windows

readonly windows: readonly [{ limit: 1; windowMs: 1000; name: "burst"; }, { limit: 10; windowMs: number; name: "hourly"; }]

1

readonly 1: object

1.FILE_UPLOAD

readonly FILE_UPLOAD: object

1.FILE_UPLOAD.windows

readonly windows: readonly [{ limit: 1; windowMs: number; name: "burst"; }, { limit: 3; windowMs: number; name: "hourly"; }, { limit: 3; windowMs: number; name: "daily"; }]

1.API_GENERAL

readonly API_GENERAL: object

1.API_GENERAL.windows

readonly windows: readonly [{ limit: 2; windowMs: 1000; name: "burst"; }, { limit: 30; windowMs: number; name: "hourly"; }]

2

readonly 2: object

2.FILE_UPLOAD

readonly FILE_UPLOAD: object

2.FILE_UPLOAD.windows

readonly windows: readonly [{ limit: 1; windowMs: number; name: "burst"; }, { limit: 5; windowMs: number; name: "hourly"; }, { limit: 20; windowMs: number; name: "daily"; }]

2.API_GENERAL

readonly API_GENERAL: object

2.API_GENERAL.windows

readonly windows: readonly [{ limit: 5; windowMs: 1000; name: "burst"; }, { limit: 50; windowMs: number; name: "hourly"; }]

3

readonly 3: object

3.FILE_UPLOAD

readonly FILE_UPLOAD: object

3.FILE_UPLOAD.windows

readonly windows: readonly [{ limit: 2; windowMs: number; name: "burst"; }, { limit: 20; windowMs: number; name: "hourly"; }, { limit: 50; windowMs: number; name: "daily"; }]

3.API_GENERAL

readonly API_GENERAL: object

3.API_GENERAL.windows

readonly windows: readonly [{ limit: 10; windowMs: 1000; name: "burst"; }, { limit: 200; windowMs: number; name: "hourly"; }]

4

readonly 4: object

4.FILE_UPLOAD

readonly FILE_UPLOAD: object

4.FILE_UPLOAD.windows

readonly windows: readonly [{ limit: 5; windowMs: number; name: "burst"; }, { limit: 100; windowMs: number; name: "hourly"; }, { limit: 200; windowMs: number; name: "daily"; }]

4.API_GENERAL

readonly API_GENERAL: object

4.API_GENERAL.windows

readonly windows: readonly [{ limit: 20; windowMs: 1000; name: "burst"; }, { limit: 1000; windowMs: number; name: "hourly"; }]

5

readonly 5: object

5.FILE_UPLOAD

readonly FILE_UPLOAD: object

5.FILE_UPLOAD.windows

readonly windows: readonly [{ limit: 10; windowMs: 1000; name: "burst"; }, { limit: 1000; windowMs: number; name: "hourly"; }]

5.API_GENERAL

readonly API_GENERAL: object

5.API_GENERAL.windows

readonly windows: readonly [{ limit: 100; windowMs: 1000; name: "burst"; }, { limit: 10000; windowMs: number; name: "hourly"; }]


QUOTA_ERROR_MESSAGES

const QUOTA_ERROR_MESSAGES: Record<QuotaType, (current, limit) => string>

Error messages for quota exceeded scenarios.

Last updated on