|
| 1 | +/** |
| 2 | + * ChatToMap Core Library - Worker-Safe Exports |
| 3 | + * |
| 4 | + * This module exports only pure JS functionality that can run in |
| 5 | + * Cloudflare Workers without Node.js dependencies. |
| 6 | + * |
| 7 | + * For PDF/Excel exports, use `chat-to-map/exports` instead. |
| 8 | + * |
| 9 | + * @license AGPL-3.0 |
| 10 | + */ |
| 11 | + |
| 12 | +// Cache module |
| 13 | +export type { |
| 14 | + CachedResponse, |
| 15 | + CacheKeyComponents, |
| 16 | + ResponseCache |
| 17 | +} from '../caching/index' |
| 18 | +export { |
| 19 | + FilesystemCache, |
| 20 | + generateCacheKey, |
| 21 | + generateClassifierCacheKey, |
| 22 | + generateEmbeddingCacheKey, |
| 23 | + generateGeocodeCacheKey, |
| 24 | + generatePlaceLookupCacheKey |
| 25 | +} from '../caching/index' |
| 26 | + |
| 27 | +// Classifier module |
| 28 | +export type { |
| 29 | + ClassifyBatchResult, |
| 30 | + ClassifyMessagesResult, |
| 31 | + ParsedClassification, |
| 32 | + ParsedImageHints, |
| 33 | + ParsedLinkHints, |
| 34 | + ResolvedModel |
| 35 | +} from '../classifier/index' |
| 36 | +export { |
| 37 | + buildClassificationPrompt, |
| 38 | + type ClassificationContext, |
| 39 | + classifyBatch, |
| 40 | + classifyMessages, |
| 41 | + createSmartBatches, |
| 42 | + DEFAULT_MODEL_ID, |
| 43 | + filterActivities, |
| 44 | + getRequiredApiKeyEnvVar, |
| 45 | + getValidModelIds, |
| 46 | + groupByCategory, |
| 47 | + groupCandidatesByProximity, |
| 48 | + parseClassificationResponse, |
| 49 | + resolveModel, |
| 50 | + sortActivitiesByScore |
| 51 | +} from '../classifier/index' |
| 52 | + |
| 53 | +// Export module - pure JS parts only (CSV, JSON, Map HTML, filtering) |
| 54 | +export { |
| 55 | + exportToCSV, |
| 56 | + exportToJSON, |
| 57 | + exportToMapHTML, |
| 58 | + type FilterOptions, |
| 59 | + filterActivities as filterActivitiesForExport, |
| 60 | + matchesSender, |
| 61 | + normalizeCountry, |
| 62 | + parseJSON, |
| 63 | + type SortOrder |
| 64 | +} from '../export/index' |
| 65 | + |
| 66 | +// Extraction module (heuristics + embeddings) |
| 67 | +export type { |
| 68 | + ExtractCandidatesConfig, |
| 69 | + ExtractCandidatesResult |
| 70 | +} from '../extraction/index' |
| 71 | +export { |
| 72 | + ACTIVITY_KEYWORDS, |
| 73 | + ACTIVITY_PATTERNS, |
| 74 | + ACTIVITY_TYPE_QUERIES, |
| 75 | + type ActivityLinkOptions, |
| 76 | + AGREEMENT_QUERIES, |
| 77 | + classifyUrl, |
| 78 | + cosineSimilarity, |
| 79 | + DEFAULT_ACTIVITY_QUERIES, |
| 80 | + EXCLUSION_PATTERNS, |
| 81 | + embedQueries, |
| 82 | + extractActivityLinks, |
| 83 | + extractCandidates, |
| 84 | + extractCandidatesByEmbeddings, |
| 85 | + extractCandidatesByHeuristics, |
| 86 | + extractGoogleMapsCoords, |
| 87 | + findSemanticCandidates, |
| 88 | + findTopK, |
| 89 | + getAllQueryEmbeddings, |
| 90 | + getDefaultQueryEmbeddings, |
| 91 | + getQueryEmbedding, |
| 92 | + getQueryEmbeddingsDimensions, |
| 93 | + getQueryEmbeddingsModel, |
| 94 | + getQueryType, |
| 95 | + isActivityUrl, |
| 96 | + isSocialUrl, |
| 97 | + loadQueryEmbeddings, |
| 98 | + SUGGESTION_QUERIES |
| 99 | +} from '../extraction/index' |
| 100 | + |
| 101 | +// Fingerprint module (for deduplication) |
| 102 | +export type { |
| 103 | + DeduplicationPlan, |
| 104 | + FingerprintConfig, |
| 105 | + MonthlyChunk |
| 106 | +} from '../fingerprint/index' |
| 107 | +export { |
| 108 | + createDeduplicationPlan, |
| 109 | + generateChunkFingerprint, |
| 110 | + generateMonthlyChunks, |
| 111 | + getMonthKey, |
| 112 | + getMonthStart, |
| 113 | + groupMessagesByMonth |
| 114 | +} from '../fingerprint/index' |
| 115 | + |
| 116 | +// Images module |
| 117 | +export type { |
| 118 | + ImageFetchConfig, |
| 119 | + ImageMeta, |
| 120 | + ImageMetadata, |
| 121 | + ImageResult, |
| 122 | + ImageSize, |
| 123 | + ImageSource, |
| 124 | + LicenseCheckResult, |
| 125 | + MediaIndexOptions, |
| 126 | + PixabayImageCandidate, |
| 127 | + PixabayImageMatch, |
| 128 | + WikipediaImageCandidate, |
| 129 | + WikipediaImageMatch |
| 130 | +} from '../images/index' |
| 131 | +export { |
| 132 | + buildImageUrl, |
| 133 | + fetchGooglePlacesPhoto, |
| 134 | + fetchImageForActivity, |
| 135 | + fetchImagesForActivities, |
| 136 | + fetchPexelsImage, |
| 137 | + fetchPixabayImage, |
| 138 | + fetchWikipediaImage, |
| 139 | + filterPixabayImages, |
| 140 | + filterWikipediaImages, |
| 141 | + findCategoryFallbackImage, |
| 142 | + findObjectImage, |
| 143 | + hasAllowedLicense, |
| 144 | + IMAGE_SIZES, |
| 145 | + isLicenseAllowed, |
| 146 | + loadMediaIndex, |
| 147 | + shouldShowAttribution |
| 148 | +} from '../images/index' |
| 149 | + |
| 150 | +// Parser module |
| 151 | +export { |
| 152 | + detectChatSource, |
| 153 | + detectFormat, |
| 154 | + parseChat, |
| 155 | + parseChatStream, |
| 156 | + parseChatWithStats, |
| 157 | + parseIMessageChat, |
| 158 | + parseIMessageChatStream, |
| 159 | + parseWhatsAppChat, |
| 160 | + parseWhatsAppChatStream |
| 161 | +} from '../parser/index' |
| 162 | + |
| 163 | +// Place Lookup module |
| 164 | +export type { LookupActivitiesResult, LookupActivityResult } from '../place-lookup/index' |
| 165 | +export { |
| 166 | + calculateCenter, |
| 167 | + countWithCoordinates, |
| 168 | + filterWithCoordinates, |
| 169 | + lookupActivityPlace, |
| 170 | + lookupActivityPlaces, |
| 171 | + lookupPlace |
| 172 | +} from '../place-lookup/index' |
| 173 | + |
| 174 | +// Processor module - interface and real implementation |
| 175 | +export type { |
| 176 | + ChatProcessor, |
| 177 | + ProcessingStageResults, |
| 178 | + ProcessorCandidateResult, |
| 179 | + ProcessorClassifyResult, |
| 180 | + ProcessorConfig, |
| 181 | + ProcessorGeocodeResult, |
| 182 | + ProcessorParseResult |
| 183 | +} from '../processor' |
| 184 | +export { RealChatProcessor } from '../processor' |
| 185 | + |
| 186 | +// Scanner module (zero API cost heuristic scanning) |
| 187 | +export type { QuickScanOptions, QuickScanResult } from '../scanner/index' |
| 188 | +export { quickScan, quickScanMessages } from '../scanner/index' |
| 189 | + |
| 190 | +// Scraper module (social media metadata extraction) |
| 191 | +export type { |
| 192 | + ScrapedMetadata, |
| 193 | + ScrapeOutcome, |
| 194 | + ScraperConfig |
| 195 | +} from '../scraper/index' |
| 196 | +export { |
| 197 | + buildYouTubeUrl, |
| 198 | + detectPlatform, |
| 199 | + extractRedditPostId, |
| 200 | + extractTikTokVideoId, |
| 201 | + extractYouTubeVideoId, |
| 202 | + isRedditUrl, |
| 203 | + resolveTikTokUrl, |
| 204 | + scrapeActivityLinks, |
| 205 | + scrapeReddit, |
| 206 | + scrapeTikTok, |
| 207 | + scrapeUrl, |
| 208 | + scrapeUrls, |
| 209 | + scrapeYouTube |
| 210 | +} from '../scraper/index' |
| 211 | + |
| 212 | +// Search/Entity Resolution module |
| 213 | +export type { |
| 214 | + AIClassificationConfig, |
| 215 | + ClassificationResult, |
| 216 | + DeferredItem, |
| 217 | + EntitySource, |
| 218 | + EntityType, |
| 219 | + ExternalIdType, |
| 220 | + GoogleSearchConfig, |
| 221 | + GoogleSearchResult, |
| 222 | + HeuristicMatch, |
| 223 | + OpenLibraryResult, |
| 224 | + ResolvedEntity, |
| 225 | + ResolverConfig, |
| 226 | + WikidataResult |
| 227 | +} from '../search/index' |
| 228 | +export { |
| 229 | + applyHeuristics, |
| 230 | + buildCanonicalUrl, |
| 231 | + buildSearchQuery, |
| 232 | + classificationToMatch, |
| 233 | + classifyItem, |
| 234 | + classifyItems, |
| 235 | + extractContentWords, |
| 236 | + getBestUrl, |
| 237 | + getCanonicalUrl, |
| 238 | + getSource, |
| 239 | + normalizeUnicode, |
| 240 | + resolveBook, |
| 241 | + resolveEntity, |
| 242 | + searchGoogle, |
| 243 | + searchGoogleForEntity, |
| 244 | + searchOpenLibrary, |
| 245 | + searchWikidata, |
| 246 | + tryHeuristicMatch |
| 247 | +} from '../search/index' |
| 248 | + |
| 249 | +// Shared module re-exports (types + pure functions for lightweight imports) |
| 250 | +export * from '../shared/index' |
0 commit comments