hazo_files 1.6.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGE_LOG.md CHANGED
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 2.0.1 (2026-05-23)
9
+
10
+ ### Added
11
+
12
+ - **`FileStorageProvider` interface** (`hazo_files/server`) — lightweight storage abstraction with `put`, `get`, `delete`, `exists`, `getSignedUrl`, and `probe` methods. Complements the existing `StorageModule`/`FileManager` stack for simpler use cases that don't need folder trees or metadata tracking.
13
+ - **`AppFileServerProvider`** (`hazo_files/server`) — local-filesystem provider with HMAC-SHA256-signed download URLs. Constructor options: `root` (filesystem root), `hmac_secret`, and `default_ttl_seconds` (default 300s). Includes `verifySignedUrl(token, path)` for use in the `/api/files/serve` API route. Path traversal is blocked at the `resolve()` layer.
14
+ - **`InMemoryProvider`** (`hazo_files/testing`) — in-memory `FileStorageProvider` backed by a `Map<string, Buffer>`. Intended for unit tests. `getSignedUrl` returns a `data:` URL so tests never need a real HTTP server. Includes `snapshot()` escape hatch for assertions.
15
+ - **`GoogleDriveProvider`** (`hazo_files/server`) — service-account Google Drive provider for Shared Drives. Accepts `service_account_json`, `shared_drive_id`, and a `DrivePathCache` for lazy folder-ID resolution. Unlike `GoogleDriveModule` (which uses OAuth), this provider is designed for server-side use with a GCP service account.
16
+ - **`hazo_files/testing` subpath export** — re-exports `InMemoryProvider` for use in test suites without pulling in server-only modules.
17
+ - **Error classes**: `StorageCollisionExhausted`, `StorageNotConfigured`, `StorageUnavailable` — exported from `hazo_files/server`.
18
+ - **Types**: `PutOpts`, `PutResult`, `SignedUrlOpts`, `ProbeResult`, `DrivePathCache` — exported from `hazo_files/server`.
19
+
20
+ ### Breaking changes from 1.x
21
+ None. All additions are new exports; existing `FileManager`/`TrackedFileManager` API is unchanged.
22
+
23
+ ## 2.0.0 (2026-05-22)
24
+
25
+ ### Changed
26
+
27
+ - **`googleapis` and `mime-types` promoted to direct `dependencies`** (previously optional peer deps) — the package now bundles them so consumers no longer need to install them separately for Google Drive or MIME detection. This is a major bump because it changes the transitive dependency surface for all consumers.
28
+
29
+ ### Not breaking
30
+ The public API is identical to 1.6.0. No migration required.
31
+
8
32
  ## 1.6.0 (2026-05-21)
9
33
 
10
34
  ### Added
package/README.md CHANGED
@@ -7,6 +7,10 @@ A powerful, modular file management package for Node.js and React applications w
7
7
 
8
8
  ## Features
9
9
 
10
+ - **`FileStorageProvider` Interface**: Lightweight `put/get/delete/exists/getSignedUrl/probe` abstraction for simpler use cases
11
+ - **`AppFileServerProvider`**: Local filesystem + HMAC-signed download URLs — no cloud account required
12
+ - **`GoogleDriveProvider`**: Service-account Google Drive for Shared Drives with lazy path-cache
13
+ - **`InMemoryProvider`**: Zero-dependency in-memory store for unit tests (via `hazo_files/testing`)
10
14
  - **Multiple Storage Providers**: Local filesystem, Google Drive, and Dropbox support out of the box
11
15
  - **Modular Architecture**: Easily add custom storage providers
12
16
  - **Unified API**: Single consistent interface across all storage providers
@@ -72,6 +76,17 @@ For the background-upload sonner toast bridge (optional):
72
76
  npm install sonner # Toast notifications for background upload pipelines
73
77
  ```
74
78
 
79
+ ### Subpath exports
80
+
81
+ | Import | Contents |
82
+ |--------|---------|
83
+ | `hazo_files` | Core types, utilities, naming helpers |
84
+ | `hazo_files/ui` | React components (FileBrowser, NamingRuleConfigurator, etc.) |
85
+ | `hazo_files/server` | Server-only: FileManager, TrackedFileManager, FileStorageProvider providers, schema exports |
86
+ | `hazo_files/background-upload` | Framework-agnostic UploadManager pipeline engine |
87
+ | `hazo_files/background-upload/react` | React bindings for background uploads |
88
+ | `hazo_files/testing` | `InMemoryProvider` — import in test suites, safe to use without `server-only` |
89
+
75
90
  ### Tailwind CSS v4 Setup (Required for UI Components)
76
91
 
77
92
  If you're using Tailwind CSS v4 with the UI components, you must add a `@source` directive to your CSS file to ensure Tailwind scans the package's files for utility classes.
@@ -1866,6 +1881,152 @@ try {
1866
1881
  }
1867
1882
  ```
1868
1883
 
1884
+ ## FileStorageProvider (v2 Provider API)
1885
+
1886
+ v2 introduces a slimmer storage abstraction — `FileStorageProvider` — that sits alongside (not replacing) the existing `FileManager`/`StorageModule` stack. Use it when you don't need folder trees, metadata tracking, or naming conventions, and just want put/get/signed-URL semantics.
1887
+
1888
+ ### Interface
1889
+
1890
+ ```typescript
1891
+ import type { FileStorageProvider } from 'hazo_files/server';
1892
+
1893
+ interface FileStorageProvider {
1894
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
1895
+ get(path: string): Promise<Buffer | Readable>;
1896
+ delete(path: string): Promise<void>;
1897
+ exists(path: string): Promise<boolean>;
1898
+ getSignedUrl(path: string, opts?: SignedUrlOpts): Promise<string>;
1899
+ probe(): Promise<ProbeResult>;
1900
+ }
1901
+ ```
1902
+
1903
+ ### AppFileServerProvider
1904
+
1905
+ Local filesystem with HMAC-signed download URLs. Ideal for self-hosted apps where files are served through an API route.
1906
+
1907
+ ```typescript
1908
+ import { AppFileServerProvider } from 'hazo_files/server';
1909
+
1910
+ const provider = new AppFileServerProvider({
1911
+ root: './storage', // filesystem root
1912
+ hmac_secret: process.env.FILE_HMAC_SECRET!,
1913
+ default_ttl_seconds: 300, // default 5 min
1914
+ });
1915
+
1916
+ // Store a file
1917
+ const result = await provider.put('uploads/report.pdf', buffer, {
1918
+ contentType: 'application/pdf',
1919
+ });
1920
+ // { provider: 'app_file_server', native_id: 'uploads/report.pdf', size: 12345 }
1921
+
1922
+ // Generate a signed URL (expires in 5 min)
1923
+ const url = await provider.getSignedUrl('uploads/report.pdf');
1924
+ // '/api/files/serve/1748080800.ABC123.../uploads/report.pdf'
1925
+ ```
1926
+
1927
+ #### Serving signed URLs (Next.js API route)
1928
+
1929
+ ```typescript
1930
+ // app/api/files/serve/[...token]/route.ts
1931
+ import { NextRequest, NextResponse } from 'next/server';
1932
+ import { AppFileServerProvider } from 'hazo_files/server';
1933
+
1934
+ const provider = new AppFileServerProvider({
1935
+ root: './storage',
1936
+ hmac_secret: process.env.FILE_HMAC_SECRET!,
1937
+ });
1938
+
1939
+ export async function GET(
1940
+ _req: NextRequest,
1941
+ { params }: { params: { token: string[] } }
1942
+ ) {
1943
+ // token = ['<exp>.<sig>', 'uploads', 'report.pdf']
1944
+ const [token, ...pathParts] = params.token;
1945
+ const filePath = pathParts.join('/');
1946
+
1947
+ if (!provider.verifySignedUrl(token, filePath)) {
1948
+ return new NextResponse('Forbidden', { status: 403 });
1949
+ }
1950
+
1951
+ const buf = await provider.get(filePath) as Buffer;
1952
+ return new NextResponse(buf, {
1953
+ headers: { 'Content-Type': 'application/octet-stream' },
1954
+ });
1955
+ }
1956
+ ```
1957
+
1958
+ ### GoogleDriveProvider
1959
+
1960
+ Service-account Google Drive for Shared Drives. No OAuth flow — configure a GCP service account with Shared Drive access.
1961
+
1962
+ ```typescript
1963
+ import { GoogleDriveProvider } from 'hazo_files/server';
1964
+ import type { DrivePathCache } from 'hazo_files/server';
1965
+
1966
+ // Implement the path cache (e.g., backed by your hazo_connect adapter)
1967
+ const pathCache: DrivePathCache = {
1968
+ lookup: async (key) => redis.get(`gdrive:${key}`),
1969
+ write: async (key, id) => redis.set(`gdrive:${key}`, id),
1970
+ invalidate: async (key) => redis.del(`gdrive:${key}`),
1971
+ };
1972
+
1973
+ const provider = new GoogleDriveProvider({
1974
+ service_account_json: process.env.GOOGLE_SERVICE_ACCOUNT_JSON!,
1975
+ shared_drive_id: 'your-shared-drive-id',
1976
+ path_cache: pathCache,
1977
+ });
1978
+
1979
+ // Upload a file (folders are created lazily)
1980
+ const result = await provider.put('2026/ACME/invoice.pdf', buffer, {
1981
+ contentType: 'application/pdf',
1982
+ });
1983
+ // { provider: 'gdrive', native_id: '<drive-file-id>', size: 12345 }
1984
+
1985
+ // Check connectivity
1986
+ const health = await provider.probe();
1987
+ // { ok: true } or { ok: false, error: 'drive_not_shared', message: '...' }
1988
+ ```
1989
+
1990
+ **Note**: `getSignedUrl` for Google Drive returns a native `drive.google.com/uc?id=...` link, which requires the viewer to have Drive access. For public unauthenticated downloads, use `AppFileServerProvider` instead or implement your own proxy.
1991
+
1992
+ ### InMemoryProvider (testing)
1993
+
1994
+ Import from the dedicated `hazo_files/testing` subpath — keeps server-only modules out of your test bundle.
1995
+
1996
+ ```typescript
1997
+ import { InMemoryProvider } from 'hazo_files/testing';
1998
+
1999
+ const store = new InMemoryProvider();
2000
+
2001
+ await store.put('docs/readme.txt', Buffer.from('hello'));
2002
+ const buf = await store.get('docs/readme.txt');
2003
+ console.log(buf.toString()); // 'hello'
2004
+
2005
+ // Test helper: inspect internal state
2006
+ const snap = store.snapshot();
2007
+ console.log([...snap.keys()]); // ['docs/readme.txt']
2008
+
2009
+ // getSignedUrl returns a data: URL — no HTTP server needed
2010
+ const url = await store.getSignedUrl('docs/readme.txt');
2011
+ // 'data:application/octet-stream;base64,aGVsbG8='
2012
+ ```
2013
+
2014
+ ### Provider Errors
2015
+
2016
+ ```typescript
2017
+ import {
2018
+ StorageCollisionExhausted,
2019
+ StorageNotConfigured,
2020
+ StorageUnavailable,
2021
+ } from 'hazo_files/server';
2022
+
2023
+ // StorageCollisionExhausted — thrown when put with ifNotExists keeps colliding
2024
+ // StorageNotConfigured — thrown when provider config is absent
2025
+ // StorageUnavailable — wraps a ProbeResult error for runtime checks
2026
+ ```
2027
+
2028
+ ---
2029
+
1869
2030
  ## Extending with Custom Storage Providers
1870
2031
 
1871
2032
  See [docs/ADDING_MODULES.md](docs/ADDING_MODULES.md) for a complete guide on creating custom storage modules.
@@ -1,4 +1,5 @@
1
1
  import { JobHandler } from 'hazo_jobs';
2
+ import { Readable } from 'node:stream';
2
3
  import { OAuth2Client } from 'google-auth-library';
3
4
 
4
5
  /**
@@ -2581,6 +2582,132 @@ declare const HAZO_FILE_QUOTAS_TABLE_SCHEMA: {
2581
2582
  columns: readonly ["scope_id", "byte_limit", "byte_used", "updated_at"];
2582
2583
  };
2583
2584
 
2585
+ type StoragePath = string;
2586
+ interface PutOpts {
2587
+ /** Reject if the target path already exists (atomic). */
2588
+ ifNotExists?: boolean;
2589
+ /** Hint for content-type; provider may sniff if absent. */
2590
+ contentType?: string;
2591
+ /** Free-form key/value metadata persisted with the file when supported. */
2592
+ metadata?: Record<string, string>;
2593
+ }
2594
+ interface PutResult {
2595
+ /** Provider tag — `"app_file_server"`, `"gdrive"`, `"in_memory"`. */
2596
+ provider: string;
2597
+ /** Provider-native identifier (path for app-server; file ID for GDrive). */
2598
+ native_id: string;
2599
+ /** Size in bytes of the persisted body. */
2600
+ size: number;
2601
+ }
2602
+ interface SignedUrlOpts {
2603
+ /** Seconds the URL is valid for. */
2604
+ ttl_seconds?: number;
2605
+ /** Suggested download filename (Content-Disposition). */
2606
+ filename_hint?: string;
2607
+ }
2608
+ interface ProbeResult {
2609
+ ok: boolean;
2610
+ /** Machine-readable error tag when ok=false. */
2611
+ error?: "drive_not_shared" | "write_denied" | "invalid_id" | "transient" | "config_missing";
2612
+ /** Free-form detail for logging. */
2613
+ message?: string;
2614
+ }
2615
+ /**
2616
+ * Storage provider abstraction. Every method MUST be idempotent at the
2617
+ * data-content level — re-invoking put with identical body is allowed.
2618
+ *
2619
+ * Paths are logical; providers translate to native identifiers internally.
2620
+ */
2621
+ interface FileStorageProvider {
2622
+ put(path: StoragePath, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2623
+ get(path: StoragePath): Promise<Buffer | Readable>;
2624
+ delete(path: StoragePath): Promise<void>;
2625
+ exists(path: StoragePath): Promise<boolean>;
2626
+ getSignedUrl(path: StoragePath, opts?: SignedUrlOpts): Promise<string>;
2627
+ /** Used by validation cron + onboarding step 2. */
2628
+ probe(): Promise<ProbeResult>;
2629
+ }
2630
+ declare class StorageCollisionExhausted extends Error {
2631
+ attempts: number;
2632
+ lastPath: StoragePath;
2633
+ constructor(attempts: number, lastPath: StoragePath);
2634
+ }
2635
+ declare class StorageNotConfigured extends Error {
2636
+ constructor();
2637
+ }
2638
+ declare class StorageUnavailable extends Error {
2639
+ reason: ProbeResult["error"];
2640
+ constructor(reason: ProbeResult["error"], message: string);
2641
+ }
2642
+
2643
+ interface AppFileServerOpts {
2644
+ /** Filesystem root. All paths are resolved relative to this. */
2645
+ root: string;
2646
+ /** HMAC secret used to sign download URLs. */
2647
+ hmac_secret: string;
2648
+ /** Default signed-URL TTL in seconds. */
2649
+ default_ttl_seconds?: number;
2650
+ }
2651
+ declare class AppFileServerProvider implements FileStorageProvider {
2652
+ readonly provider_tag: "app_file_server";
2653
+ private readonly root;
2654
+ private readonly secret;
2655
+ private readonly default_ttl;
2656
+ constructor(opts: AppFileServerOpts);
2657
+ private resolve;
2658
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2659
+ get(path: string): Promise<Buffer>;
2660
+ delete(path: string): Promise<void>;
2661
+ exists(path: string): Promise<boolean>;
2662
+ getSignedUrl(path: string, opts?: SignedUrlOpts): Promise<string>;
2663
+ /** Verify a token produced by `getSignedUrl`. Used by the `/api/files/serve` route. */
2664
+ verifySignedUrl(token: string, path: string): boolean;
2665
+ probe(): Promise<ProbeResult>;
2666
+ }
2667
+
2668
+ declare class InMemoryProvider implements FileStorageProvider {
2669
+ readonly provider_tag: "in_memory";
2670
+ private readonly store;
2671
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2672
+ get(path: string): Promise<Buffer>;
2673
+ delete(path: string): Promise<void>;
2674
+ exists(path: string): Promise<boolean>;
2675
+ getSignedUrl(path: string, _opts?: SignedUrlOpts): Promise<string>;
2676
+ probe(): Promise<ProbeResult>;
2677
+ /** Test-only escape hatch — exposes the internal store for assertions. */
2678
+ snapshot(): Map<string, Buffer>;
2679
+ }
2680
+
2681
+ interface DrivePathCache {
2682
+ lookup(key: string): Promise<string | null>;
2683
+ write(key: string, folder_id: string): Promise<void>;
2684
+ invalidate(key: string): Promise<void>;
2685
+ }
2686
+ interface GoogleDriveOpts {
2687
+ /** Raw JSON keyfile contents (decoded from GOOGLE_SERVICE_ACCOUNT_JSON env var). */
2688
+ service_account_json: string;
2689
+ /** Target Shared Drive ID. */
2690
+ shared_drive_id: string;
2691
+ /** Lazy folder-ID cache, scoped per Hazodocs org. */
2692
+ path_cache: DrivePathCache;
2693
+ }
2694
+ declare class GoogleDriveProvider implements FileStorageProvider {
2695
+ readonly provider_tag: "gdrive";
2696
+ private readonly drive;
2697
+ private readonly driveId;
2698
+ private readonly cache;
2699
+ constructor(opts: GoogleDriveOpts);
2700
+ probe(): Promise<ProbeResult>;
2701
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2702
+ get(path: string): Promise<Buffer>;
2703
+ delete(path: string): Promise<void>;
2704
+ exists(path: string): Promise<boolean>;
2705
+ getSignedUrl(path: string, _opts?: SignedUrlOpts): Promise<string>;
2706
+ private resolvePath;
2707
+ private findChild;
2708
+ private lookupFileId;
2709
+ }
2710
+
2584
2711
  /**
2585
2712
  * Migration: Add Reference Tracking (V2)
2586
2713
  *
@@ -3644,4 +3771,4 @@ declare function toV2Record(record: FileMetadataRecord): FileMetadataRecordV2;
3644
3771
  */
3645
3772
  declare function buildFileWithStatus(record: FileMetadataRecord): FileWithStatus;
3646
3773
 
3647
- export { ALL_SYSTEM_VARIABLES, type AddExtractionOptions, type AddRefOptions, type AuthCallbacks, AuthenticationError, type CleanupOrphanedOptions, ConfigurationError, type ContentTagConfig, type CreateFolderOptions, type CrudServiceLike, DEFAULT_DATE_FORMATS, type DatabaseSchemaDefinition, type DatabaseTrackingConfig, DirectoryExistsError, DirectoryNotEmptyError, DirectoryNotFoundError, type DownloadOptions, DropboxAuth, type DropboxAuthCallbacks, type DropboxAuthConfig, type DropboxConfig, DropboxModule, type DropboxTokenData, type ExtractionData, type ExtractionOptions, type ExtractionResult, type FileBrowserState, type FileDataStructure, FileExistsError, type FileInfo, type FileItem, FileManager, type FileManagerOptions, type FileMetadataInput, type FileMetadataRecord, type FileMetadataRecordV2, FileMetadataService, type FileMetadataServiceOptions, type FileMetadataUpdate, FileNotFoundError, type FileRef, type FileRefVisibility, type FileStatus, type FileSystemItem, FileTooLargeError, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_JOB_TYPES, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_MIGRATION_V4, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, HAZO_FILE_QUOTAS_DEFAULT_TABLE_NAME, HAZO_FILE_QUOTAS_TABLE_SCHEMA, type HazoFileQuotasColumnDefinitions, type HazoFilesColumnDefinitions, type HazoFilesConfig, HazoFilesError, type HazoFilesJobType, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesMigrationV4, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesServerInstance, type HazoFilesServerOptions, type HazoFilesTableSchema, type HazoLLMInstance, type HazoLogger, ImportSizeCapError, InvalidExtensionError, InvalidPathError, LLMExtractionService, type LLMFactory, type LLMFactoryConfig, type LLMProvider, type ListNamingConventionsOptions, type ListOptions, type LocalStorageConfig, LocalStorageModule, type MetadataLogger, type MigrationExecutor, type MigrationSchemaDefinition, type MoveOptions, type NameGenerationOptions, type NamingConventionInput, type NamingConventionRecord, NamingConventionService, type NamingConventionServiceOptions, type NamingConventionType, type NamingConventionUpdate, type NamingRuleConfiguratorProps, type NamingRuleHistoryEntry, type NamingRuleSchema, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProgressCallback, type PurgeJobHandlerOptions, type PurgeOnePayload, type PurgePlanPayload, type PurgePlanResult, type QuotaCrudServiceLike, QuotaExceededError, QuotaService, type QuotaServiceOptions, type QuotaStatus, type QuotaThresholdEvent, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, SSRFError, SYSTEM_COUNTER_VARIABLES, SYSTEM_DATE_VARIABLES, SYSTEM_FILE_VARIABLES, type StorageModule, type StorageProvider, type TokenData, TrackedFileManager, type TrackedFileManagerFullOptions, type TrackedFileManagerOptions, type TrackedUploadOptions, type TreeNode, type UploadExtractOptions, type UploadExtractResult, UploadExtractService, type UploadOptions, type UploadWithRefOptions, type UseNamingRuleActions, type UseNamingRuleReturn, type UseNamingRuleState, type VariableCategory, addExtractionToFileData, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, createAndInitializeModule, createBasicFileManager, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createHazoFilesServer, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, createPurgeJobHandlers, createQuotaService, createTrackedFileManager, createUploadExtractService, createVariableSegment, deepMerge, errorResult, filterItems, formatBytes, formatCounter, formatDateToken, generateExtractionId, generateId, generatePreviewName, generateRefId, generateSampleConfig, generateSegmentId, getBaseName, getBreadcrumbs, getDirName, getExtension, getExtensionFromMime, getExtractionById, getExtractionCount, getExtractions, getFileCategory, getFileMetadataValues, getMergedData, getMigrationForTable, getMigrationV3ForTable, getMigrationV4ForTable, getMimeType, getNameWithoutExtension, getNamingSchemaForTable, getParentPath, getPathSegments, getRegisteredProviders, getRelativePath, getSchemaForTable, getSystemVariablePreviewValues, hasExtension, hasExtractionStructure, hasFileContentChanged, hashesEqual, hazo_files_generate_file_name, hazo_files_generate_folder_name, isAudio, isChildPath, isCounterVariable, isDateVariable, isDocument, isFile, isFileMetadataVariable, isFolder, isImage, isPreviewable, isProviderRegistered, isText, isVideo, joinPath, loadConfig, loadConfigAsync, migrateToV2, migrateToV3, normalizePath, parseConfig, parseFileData, parseFileRefs, parsePatternString, patternToString, recalculateMergedData, registerModule, removeExtractionById, removeExtractionByIndex, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath };
3774
+ export { ALL_SYSTEM_VARIABLES, type AddExtractionOptions, type AddRefOptions, type AppFileServerOpts, AppFileServerProvider, type AuthCallbacks, AuthenticationError, type CleanupOrphanedOptions, ConfigurationError, type ContentTagConfig, type CreateFolderOptions, type CrudServiceLike, DEFAULT_DATE_FORMATS, type DatabaseSchemaDefinition, type DatabaseTrackingConfig, DirectoryExistsError, DirectoryNotEmptyError, DirectoryNotFoundError, type DownloadOptions, type DrivePathCache, DropboxAuth, type DropboxAuthCallbacks, type DropboxAuthConfig, type DropboxConfig, DropboxModule, type DropboxTokenData, type ExtractionData, type ExtractionOptions, type ExtractionResult, type FileBrowserState, type FileDataStructure, FileExistsError, type FileInfo, type FileItem, FileManager, type FileManagerOptions, type FileMetadataInput, type FileMetadataRecord, type FileMetadataRecordV2, FileMetadataService, type FileMetadataServiceOptions, type FileMetadataUpdate, FileNotFoundError, type FileRef, type FileRefVisibility, type FileStatus, type FileStorageProvider, type FileSystemItem, FileTooLargeError, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, type GoogleDriveOpts, GoogleDriveProvider, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_JOB_TYPES, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_MIGRATION_V4, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, HAZO_FILE_QUOTAS_DEFAULT_TABLE_NAME, HAZO_FILE_QUOTAS_TABLE_SCHEMA, type HazoFileQuotasColumnDefinitions, type HazoFilesColumnDefinitions, type HazoFilesConfig, HazoFilesError, type HazoFilesJobType, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesMigrationV4, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesServerInstance, type HazoFilesServerOptions, type HazoFilesTableSchema, type HazoLLMInstance, type HazoLogger, ImportSizeCapError, InMemoryProvider, InvalidExtensionError, InvalidPathError, LLMExtractionService, type LLMFactory, type LLMFactoryConfig, type LLMProvider, type ListNamingConventionsOptions, type ListOptions, type LocalStorageConfig, LocalStorageModule, type MetadataLogger, type MigrationExecutor, type MigrationSchemaDefinition, type MoveOptions, type NameGenerationOptions, type NamingConventionInput, type NamingConventionRecord, NamingConventionService, type NamingConventionServiceOptions, type NamingConventionType, type NamingConventionUpdate, type NamingRuleConfiguratorProps, type NamingRuleHistoryEntry, type NamingRuleSchema, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProbeResult, type ProgressCallback, type PurgeJobHandlerOptions, type PurgeOnePayload, type PurgePlanPayload, type PurgePlanResult, type PutOpts, type PutResult, type QuotaCrudServiceLike, QuotaExceededError, QuotaService, type QuotaServiceOptions, type QuotaStatus, type QuotaThresholdEvent, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, SSRFError, SYSTEM_COUNTER_VARIABLES, SYSTEM_DATE_VARIABLES, SYSTEM_FILE_VARIABLES, type SignedUrlOpts, StorageCollisionExhausted, type StorageModule, StorageNotConfigured, type StoragePath, type StorageProvider, StorageUnavailable, type TokenData, TrackedFileManager, type TrackedFileManagerFullOptions, type TrackedFileManagerOptions, type TrackedUploadOptions, type TreeNode, type UploadExtractOptions, type UploadExtractResult, UploadExtractService, type UploadOptions, type UploadWithRefOptions, type UseNamingRuleActions, type UseNamingRuleReturn, type UseNamingRuleState, type VariableCategory, addExtractionToFileData, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, createAndInitializeModule, createBasicFileManager, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createHazoFilesServer, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, createPurgeJobHandlers, createQuotaService, createTrackedFileManager, createUploadExtractService, createVariableSegment, deepMerge, errorResult, filterItems, formatBytes, formatCounter, formatDateToken, generateExtractionId, generateId, generatePreviewName, generateRefId, generateSampleConfig, generateSegmentId, getBaseName, getBreadcrumbs, getDirName, getExtension, getExtensionFromMime, getExtractionById, getExtractionCount, getExtractions, getFileCategory, getFileMetadataValues, getMergedData, getMigrationForTable, getMigrationV3ForTable, getMigrationV4ForTable, getMimeType, getNameWithoutExtension, getNamingSchemaForTable, getParentPath, getPathSegments, getRegisteredProviders, getRelativePath, getSchemaForTable, getSystemVariablePreviewValues, hasExtension, hasExtractionStructure, hasFileContentChanged, hashesEqual, hazo_files_generate_file_name, hazo_files_generate_folder_name, isAudio, isChildPath, isCounterVariable, isDateVariable, isDocument, isFile, isFileMetadataVariable, isFolder, isImage, isPreviewable, isProviderRegistered, isText, isVideo, joinPath, loadConfig, loadConfigAsync, migrateToV2, migrateToV3, normalizePath, parseConfig, parseFileData, parseFileRefs, parsePatternString, patternToString, recalculateMergedData, registerModule, removeExtractionById, removeExtractionByIndex, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath };
@@ -1,4 +1,5 @@
1
1
  import { JobHandler } from 'hazo_jobs';
2
+ import { Readable } from 'node:stream';
2
3
  import { OAuth2Client } from 'google-auth-library';
3
4
 
4
5
  /**
@@ -2581,6 +2582,132 @@ declare const HAZO_FILE_QUOTAS_TABLE_SCHEMA: {
2581
2582
  columns: readonly ["scope_id", "byte_limit", "byte_used", "updated_at"];
2582
2583
  };
2583
2584
 
2585
+ type StoragePath = string;
2586
+ interface PutOpts {
2587
+ /** Reject if the target path already exists (atomic). */
2588
+ ifNotExists?: boolean;
2589
+ /** Hint for content-type; provider may sniff if absent. */
2590
+ contentType?: string;
2591
+ /** Free-form key/value metadata persisted with the file when supported. */
2592
+ metadata?: Record<string, string>;
2593
+ }
2594
+ interface PutResult {
2595
+ /** Provider tag — `"app_file_server"`, `"gdrive"`, `"in_memory"`. */
2596
+ provider: string;
2597
+ /** Provider-native identifier (path for app-server; file ID for GDrive). */
2598
+ native_id: string;
2599
+ /** Size in bytes of the persisted body. */
2600
+ size: number;
2601
+ }
2602
+ interface SignedUrlOpts {
2603
+ /** Seconds the URL is valid for. */
2604
+ ttl_seconds?: number;
2605
+ /** Suggested download filename (Content-Disposition). */
2606
+ filename_hint?: string;
2607
+ }
2608
+ interface ProbeResult {
2609
+ ok: boolean;
2610
+ /** Machine-readable error tag when ok=false. */
2611
+ error?: "drive_not_shared" | "write_denied" | "invalid_id" | "transient" | "config_missing";
2612
+ /** Free-form detail for logging. */
2613
+ message?: string;
2614
+ }
2615
+ /**
2616
+ * Storage provider abstraction. Every method MUST be idempotent at the
2617
+ * data-content level — re-invoking put with identical body is allowed.
2618
+ *
2619
+ * Paths are logical; providers translate to native identifiers internally.
2620
+ */
2621
+ interface FileStorageProvider {
2622
+ put(path: StoragePath, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2623
+ get(path: StoragePath): Promise<Buffer | Readable>;
2624
+ delete(path: StoragePath): Promise<void>;
2625
+ exists(path: StoragePath): Promise<boolean>;
2626
+ getSignedUrl(path: StoragePath, opts?: SignedUrlOpts): Promise<string>;
2627
+ /** Used by validation cron + onboarding step 2. */
2628
+ probe(): Promise<ProbeResult>;
2629
+ }
2630
+ declare class StorageCollisionExhausted extends Error {
2631
+ attempts: number;
2632
+ lastPath: StoragePath;
2633
+ constructor(attempts: number, lastPath: StoragePath);
2634
+ }
2635
+ declare class StorageNotConfigured extends Error {
2636
+ constructor();
2637
+ }
2638
+ declare class StorageUnavailable extends Error {
2639
+ reason: ProbeResult["error"];
2640
+ constructor(reason: ProbeResult["error"], message: string);
2641
+ }
2642
+
2643
+ interface AppFileServerOpts {
2644
+ /** Filesystem root. All paths are resolved relative to this. */
2645
+ root: string;
2646
+ /** HMAC secret used to sign download URLs. */
2647
+ hmac_secret: string;
2648
+ /** Default signed-URL TTL in seconds. */
2649
+ default_ttl_seconds?: number;
2650
+ }
2651
+ declare class AppFileServerProvider implements FileStorageProvider {
2652
+ readonly provider_tag: "app_file_server";
2653
+ private readonly root;
2654
+ private readonly secret;
2655
+ private readonly default_ttl;
2656
+ constructor(opts: AppFileServerOpts);
2657
+ private resolve;
2658
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2659
+ get(path: string): Promise<Buffer>;
2660
+ delete(path: string): Promise<void>;
2661
+ exists(path: string): Promise<boolean>;
2662
+ getSignedUrl(path: string, opts?: SignedUrlOpts): Promise<string>;
2663
+ /** Verify a token produced by `getSignedUrl`. Used by the `/api/files/serve` route. */
2664
+ verifySignedUrl(token: string, path: string): boolean;
2665
+ probe(): Promise<ProbeResult>;
2666
+ }
2667
+
2668
+ declare class InMemoryProvider implements FileStorageProvider {
2669
+ readonly provider_tag: "in_memory";
2670
+ private readonly store;
2671
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2672
+ get(path: string): Promise<Buffer>;
2673
+ delete(path: string): Promise<void>;
2674
+ exists(path: string): Promise<boolean>;
2675
+ getSignedUrl(path: string, _opts?: SignedUrlOpts): Promise<string>;
2676
+ probe(): Promise<ProbeResult>;
2677
+ /** Test-only escape hatch — exposes the internal store for assertions. */
2678
+ snapshot(): Map<string, Buffer>;
2679
+ }
2680
+
2681
+ interface DrivePathCache {
2682
+ lookup(key: string): Promise<string | null>;
2683
+ write(key: string, folder_id: string): Promise<void>;
2684
+ invalidate(key: string): Promise<void>;
2685
+ }
2686
+ interface GoogleDriveOpts {
2687
+ /** Raw JSON keyfile contents (decoded from GOOGLE_SERVICE_ACCOUNT_JSON env var). */
2688
+ service_account_json: string;
2689
+ /** Target Shared Drive ID. */
2690
+ shared_drive_id: string;
2691
+ /** Lazy folder-ID cache, scoped per Hazodocs org. */
2692
+ path_cache: DrivePathCache;
2693
+ }
2694
+ declare class GoogleDriveProvider implements FileStorageProvider {
2695
+ readonly provider_tag: "gdrive";
2696
+ private readonly drive;
2697
+ private readonly driveId;
2698
+ private readonly cache;
2699
+ constructor(opts: GoogleDriveOpts);
2700
+ probe(): Promise<ProbeResult>;
2701
+ put(path: string, body: Buffer | Readable, opts?: PutOpts): Promise<PutResult>;
2702
+ get(path: string): Promise<Buffer>;
2703
+ delete(path: string): Promise<void>;
2704
+ exists(path: string): Promise<boolean>;
2705
+ getSignedUrl(path: string, _opts?: SignedUrlOpts): Promise<string>;
2706
+ private resolvePath;
2707
+ private findChild;
2708
+ private lookupFileId;
2709
+ }
2710
+
2584
2711
  /**
2585
2712
  * Migration: Add Reference Tracking (V2)
2586
2713
  *
@@ -3644,4 +3771,4 @@ declare function toV2Record(record: FileMetadataRecord): FileMetadataRecordV2;
3644
3771
  */
3645
3772
  declare function buildFileWithStatus(record: FileMetadataRecord): FileWithStatus;
3646
3773
 
3647
- export { ALL_SYSTEM_VARIABLES, type AddExtractionOptions, type AddRefOptions, type AuthCallbacks, AuthenticationError, type CleanupOrphanedOptions, ConfigurationError, type ContentTagConfig, type CreateFolderOptions, type CrudServiceLike, DEFAULT_DATE_FORMATS, type DatabaseSchemaDefinition, type DatabaseTrackingConfig, DirectoryExistsError, DirectoryNotEmptyError, DirectoryNotFoundError, type DownloadOptions, DropboxAuth, type DropboxAuthCallbacks, type DropboxAuthConfig, type DropboxConfig, DropboxModule, type DropboxTokenData, type ExtractionData, type ExtractionOptions, type ExtractionResult, type FileBrowserState, type FileDataStructure, FileExistsError, type FileInfo, type FileItem, FileManager, type FileManagerOptions, type FileMetadataInput, type FileMetadataRecord, type FileMetadataRecordV2, FileMetadataService, type FileMetadataServiceOptions, type FileMetadataUpdate, FileNotFoundError, type FileRef, type FileRefVisibility, type FileStatus, type FileSystemItem, FileTooLargeError, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_JOB_TYPES, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_MIGRATION_V4, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, HAZO_FILE_QUOTAS_DEFAULT_TABLE_NAME, HAZO_FILE_QUOTAS_TABLE_SCHEMA, type HazoFileQuotasColumnDefinitions, type HazoFilesColumnDefinitions, type HazoFilesConfig, HazoFilesError, type HazoFilesJobType, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesMigrationV4, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesServerInstance, type HazoFilesServerOptions, type HazoFilesTableSchema, type HazoLLMInstance, type HazoLogger, ImportSizeCapError, InvalidExtensionError, InvalidPathError, LLMExtractionService, type LLMFactory, type LLMFactoryConfig, type LLMProvider, type ListNamingConventionsOptions, type ListOptions, type LocalStorageConfig, LocalStorageModule, type MetadataLogger, type MigrationExecutor, type MigrationSchemaDefinition, type MoveOptions, type NameGenerationOptions, type NamingConventionInput, type NamingConventionRecord, NamingConventionService, type NamingConventionServiceOptions, type NamingConventionType, type NamingConventionUpdate, type NamingRuleConfiguratorProps, type NamingRuleHistoryEntry, type NamingRuleSchema, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProgressCallback, type PurgeJobHandlerOptions, type PurgeOnePayload, type PurgePlanPayload, type PurgePlanResult, type QuotaCrudServiceLike, QuotaExceededError, QuotaService, type QuotaServiceOptions, type QuotaStatus, type QuotaThresholdEvent, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, SSRFError, SYSTEM_COUNTER_VARIABLES, SYSTEM_DATE_VARIABLES, SYSTEM_FILE_VARIABLES, type StorageModule, type StorageProvider, type TokenData, TrackedFileManager, type TrackedFileManagerFullOptions, type TrackedFileManagerOptions, type TrackedUploadOptions, type TreeNode, type UploadExtractOptions, type UploadExtractResult, UploadExtractService, type UploadOptions, type UploadWithRefOptions, type UseNamingRuleActions, type UseNamingRuleReturn, type UseNamingRuleState, type VariableCategory, addExtractionToFileData, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, createAndInitializeModule, createBasicFileManager, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createHazoFilesServer, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, createPurgeJobHandlers, createQuotaService, createTrackedFileManager, createUploadExtractService, createVariableSegment, deepMerge, errorResult, filterItems, formatBytes, formatCounter, formatDateToken, generateExtractionId, generateId, generatePreviewName, generateRefId, generateSampleConfig, generateSegmentId, getBaseName, getBreadcrumbs, getDirName, getExtension, getExtensionFromMime, getExtractionById, getExtractionCount, getExtractions, getFileCategory, getFileMetadataValues, getMergedData, getMigrationForTable, getMigrationV3ForTable, getMigrationV4ForTable, getMimeType, getNameWithoutExtension, getNamingSchemaForTable, getParentPath, getPathSegments, getRegisteredProviders, getRelativePath, getSchemaForTable, getSystemVariablePreviewValues, hasExtension, hasExtractionStructure, hasFileContentChanged, hashesEqual, hazo_files_generate_file_name, hazo_files_generate_folder_name, isAudio, isChildPath, isCounterVariable, isDateVariable, isDocument, isFile, isFileMetadataVariable, isFolder, isImage, isPreviewable, isProviderRegistered, isText, isVideo, joinPath, loadConfig, loadConfigAsync, migrateToV2, migrateToV3, normalizePath, parseConfig, parseFileData, parseFileRefs, parsePatternString, patternToString, recalculateMergedData, registerModule, removeExtractionById, removeExtractionByIndex, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath };
3774
+ export { ALL_SYSTEM_VARIABLES, type AddExtractionOptions, type AddRefOptions, type AppFileServerOpts, AppFileServerProvider, type AuthCallbacks, AuthenticationError, type CleanupOrphanedOptions, ConfigurationError, type ContentTagConfig, type CreateFolderOptions, type CrudServiceLike, DEFAULT_DATE_FORMATS, type DatabaseSchemaDefinition, type DatabaseTrackingConfig, DirectoryExistsError, DirectoryNotEmptyError, DirectoryNotFoundError, type DownloadOptions, type DrivePathCache, DropboxAuth, type DropboxAuthCallbacks, type DropboxAuthConfig, type DropboxConfig, DropboxModule, type DropboxTokenData, type ExtractionData, type ExtractionOptions, type ExtractionResult, type FileBrowserState, type FileDataStructure, FileExistsError, type FileInfo, type FileItem, FileManager, type FileManagerOptions, type FileMetadataInput, type FileMetadataRecord, type FileMetadataRecordV2, FileMetadataService, type FileMetadataServiceOptions, type FileMetadataUpdate, FileNotFoundError, type FileRef, type FileRefVisibility, type FileStatus, type FileStorageProvider, type FileSystemItem, FileTooLargeError, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, type GoogleDriveOpts, GoogleDriveProvider, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_JOB_TYPES, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_MIGRATION_V4, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, HAZO_FILE_QUOTAS_DEFAULT_TABLE_NAME, HAZO_FILE_QUOTAS_TABLE_SCHEMA, type HazoFileQuotasColumnDefinitions, type HazoFilesColumnDefinitions, type HazoFilesConfig, HazoFilesError, type HazoFilesJobType, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesMigrationV4, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesServerInstance, type HazoFilesServerOptions, type HazoFilesTableSchema, type HazoLLMInstance, type HazoLogger, ImportSizeCapError, InMemoryProvider, InvalidExtensionError, InvalidPathError, LLMExtractionService, type LLMFactory, type LLMFactoryConfig, type LLMProvider, type ListNamingConventionsOptions, type ListOptions, type LocalStorageConfig, LocalStorageModule, type MetadataLogger, type MigrationExecutor, type MigrationSchemaDefinition, type MoveOptions, type NameGenerationOptions, type NamingConventionInput, type NamingConventionRecord, NamingConventionService, type NamingConventionServiceOptions, type NamingConventionType, type NamingConventionUpdate, type NamingRuleConfiguratorProps, type NamingRuleHistoryEntry, type NamingRuleSchema, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProbeResult, type ProgressCallback, type PurgeJobHandlerOptions, type PurgeOnePayload, type PurgePlanPayload, type PurgePlanResult, type PutOpts, type PutResult, type QuotaCrudServiceLike, QuotaExceededError, QuotaService, type QuotaServiceOptions, type QuotaStatus, type QuotaThresholdEvent, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, SSRFError, SYSTEM_COUNTER_VARIABLES, SYSTEM_DATE_VARIABLES, SYSTEM_FILE_VARIABLES, type SignedUrlOpts, StorageCollisionExhausted, type StorageModule, StorageNotConfigured, type StoragePath, type StorageProvider, StorageUnavailable, type TokenData, TrackedFileManager, type TrackedFileManagerFullOptions, type TrackedFileManagerOptions, type TrackedUploadOptions, type TreeNode, type UploadExtractOptions, type UploadExtractResult, UploadExtractService, type UploadOptions, type UploadWithRefOptions, type UseNamingRuleActions, type UseNamingRuleReturn, type UseNamingRuleState, type VariableCategory, addExtractionToFileData, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, createAndInitializeModule, createBasicFileManager, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createHazoFilesServer, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, createPurgeJobHandlers, createQuotaService, createTrackedFileManager, createUploadExtractService, createVariableSegment, deepMerge, errorResult, filterItems, formatBytes, formatCounter, formatDateToken, generateExtractionId, generateId, generatePreviewName, generateRefId, generateSampleConfig, generateSegmentId, getBaseName, getBreadcrumbs, getDirName, getExtension, getExtensionFromMime, getExtractionById, getExtractionCount, getExtractions, getFileCategory, getFileMetadataValues, getMergedData, getMigrationForTable, getMigrationV3ForTable, getMigrationV4ForTable, getMimeType, getNameWithoutExtension, getNamingSchemaForTable, getParentPath, getPathSegments, getRegisteredProviders, getRelativePath, getSchemaForTable, getSystemVariablePreviewValues, hasExtension, hasExtractionStructure, hasFileContentChanged, hashesEqual, hazo_files_generate_file_name, hazo_files_generate_folder_name, isAudio, isChildPath, isCounterVariable, isDateVariable, isDocument, isFile, isFileMetadataVariable, isFolder, isImage, isPreviewable, isProviderRegistered, isText, isVideo, joinPath, loadConfig, loadConfigAsync, migrateToV2, migrateToV3, normalizePath, parseConfig, parseFileData, parseFileRefs, parsePatternString, patternToString, recalculateMergedData, registerModule, removeExtractionById, removeExtractionByIndex, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath };