hazo_files 2.1.1 → 3.0.0

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,26 @@ 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
+ ## 3.0.0 — 2026-05-29
9
+
10
+ ### Breaking changes (Wave 2 standardisation)
11
+
12
+ - **Required peer dep:** `hazo_core ^1.0.0`. Provides `HazoError` hierarchy, structured logger, and `withContext()` correlation propagation.
13
+ - **Cross-hazo peer-dep major bumps:** `hazo_connect ^3.0.0` (was `^2.7.3`), `hazo_llm_api ^2.0.0` (was `^1.3.0`). Consumers using these alongside `hazo_files` must upgrade them together.
14
+ - **Error API surface:** the 12 `HazoFilesError` subclasses (`FileNotFoundError`, `FileTooLargeError`, etc.) now extend `HazoError` from `hazo_core` and carry `HAZO_FILES_*` codes. Catch sites that used `instanceof HazoFilesError` continue to work; catch sites that matched `error.message` text should switch to `.code`.
15
+
16
+ ### Internal changes
17
+
18
+ - Default logger resolves to `createLogger('hazo_files')` from `hazo_core` (delegates to `hazo_logs`).
19
+ - Google Drive adapter outbound API calls and `LLMExtractionService` provider calls use `fetchWithRequestId()` so `x-request-id` propagates.
20
+ - `TrackedFileManager` operations run inside `withContext({ correlationId })` per call so DB writes and storage writes share the same correlation ID.
21
+
22
+ ### Migration
23
+
24
+ 1. `npm install hazo_core@^1.0.0`.
25
+ 2. Upgrade `hazo_connect` to `^3.0.0` and `hazo_llm_api` to `^2.0.0` if you depend on them.
26
+ 3. No public API method signatures changed — `FileManager` and `TrackedFileManager` methods keep their existing call shape.
27
+
8
28
  ## 2.1.1 — 2026-05-24
9
29
 
10
30
  **Docs + housekeeping** — no API changes.
@@ -42,3 +42,14 @@ root_path =
42
42
  ; Comma-separated list of supported date format tokens for naming rules
43
43
  ; Available: YYYY, YY, MM, M, DD, D, MMM, MMMM, YYYY-MM-DD, YYYY-MMM-DD, DD-MM-YYYY, MM-DD-YYYY
44
44
  date_formats = YYYY,YY,MM,M,DD,D,MMM,MMMM,YYYY-MM-DD,YYYY-MMM-DD,DD-MM-YYYY,MM-DD-YYYY
45
+
46
+ [log.overrides]
47
+ ; Override log levels per namespace. Format: namespace = TRACE|DEBUG|INFO|WARN|ERROR
48
+ ; Example:
49
+ ; hazo_files.metadata = DEBUG
50
+ ; hazo_files.naming = WARN
51
+
52
+ [env]
53
+ ; Set HAZO_ENV to control which overlay config file is loaded
54
+ ; e.g. HAZO_ENV=production loads hazo_files_config.production.ini as an overlay
55
+ ; hazo_env = production
@@ -57,6 +57,7 @@ var TypedEventEmitter = class {
57
57
  };
58
58
 
59
59
  // src/background_upload/core/job.ts
60
+ var import_hazo_core = require("hazo_core");
60
61
  var Job = class {
61
62
  constructor(init) {
62
63
  this.status = "queued";
@@ -64,7 +65,7 @@ var Job = class {
64
65
  this.error = null;
65
66
  this.confirmation_payload = null;
66
67
  this.confirmation_resolve = null;
67
- this.job_id = crypto.randomUUID();
68
+ this.job_id = (0, import_hazo_core.generateRequestId)().slice(4);
68
69
  this.batch_id = init.batch_id;
69
70
  this.created_at = Date.now();
70
71
  this.updated_at = this.created_at;
@@ -183,6 +184,7 @@ var PipelineExecutor = class {
183
184
  };
184
185
 
185
186
  // src/background_upload/core/upload-manager.ts
187
+ var import_hazo_core2 = require("hazo_core");
186
188
  var UploadManager = class {
187
189
  constructor(config) {
188
190
  this.jobs = /* @__PURE__ */ new Map();
@@ -204,7 +206,7 @@ var UploadManager = class {
204
206
  }
205
207
  submit_batch(options) {
206
208
  if (this.destroyed) throw new Error("UploadManager is destroyed");
207
- const batch_id = crypto.randomUUID();
209
+ const batch_id = (0, import_hazo_core2.generateRequestId)().slice(4);
208
210
  const job_ids = [];
209
211
  const pipeline_steps = options.pipeline_steps ?? this.config.default_pipeline_steps;
210
212
  for (const file of options.files) {
@@ -28,6 +28,7 @@ var TypedEventEmitter = class {
28
28
  };
29
29
 
30
30
  // src/background_upload/core/job.ts
31
+ import { generateRequestId } from "hazo_core";
31
32
  var Job = class {
32
33
  constructor(init) {
33
34
  this.status = "queued";
@@ -35,7 +36,7 @@ var Job = class {
35
36
  this.error = null;
36
37
  this.confirmation_payload = null;
37
38
  this.confirmation_resolve = null;
38
- this.job_id = crypto.randomUUID();
39
+ this.job_id = generateRequestId().slice(4);
39
40
  this.batch_id = init.batch_id;
40
41
  this.created_at = Date.now();
41
42
  this.updated_at = this.created_at;
@@ -154,6 +155,7 @@ var PipelineExecutor = class {
154
155
  };
155
156
 
156
157
  // src/background_upload/core/upload-manager.ts
158
+ import { generateRequestId as generateRequestId2 } from "hazo_core";
157
159
  var UploadManager = class {
158
160
  constructor(config) {
159
161
  this.jobs = /* @__PURE__ */ new Map();
@@ -175,7 +177,7 @@ var UploadManager = class {
175
177
  }
176
178
  submit_batch(options) {
177
179
  if (this.destroyed) throw new Error("UploadManager is destroyed");
178
- const batch_id = crypto.randomUUID();
180
+ const batch_id = generateRequestId2().slice(4);
179
181
  const job_ids = [];
180
182
  const pipeline_steps = options.pipeline_steps ?? this.config.default_pipeline_steps;
181
183
  for (const file of options.files) {
@@ -41,7 +41,11 @@ module.exports = __toCommonJS(index_exports);
41
41
  // src/background_upload/react/provider.tsx
42
42
  var import_react3 = require("react");
43
43
 
44
+ // src/background_upload/core/upload-manager.ts
45
+ var import_hazo_core2 = require("hazo_core");
46
+
44
47
  // src/background_upload/core/job.ts
48
+ var import_hazo_core = require("hazo_core");
45
49
  var Job = class {
46
50
  constructor(init) {
47
51
  this.status = "queued";
@@ -49,7 +53,7 @@ var Job = class {
49
53
  this.error = null;
50
54
  this.confirmation_payload = null;
51
55
  this.confirmation_resolve = null;
52
- this.job_id = crypto.randomUUID();
56
+ this.job_id = (0, import_hazo_core.generateRequestId)().slice(4);
53
57
  this.batch_id = init.batch_id;
54
58
  this.created_at = Date.now();
55
59
  this.updated_at = this.created_at;
@@ -218,7 +222,7 @@ var UploadManager = class {
218
222
  }
219
223
  submit_batch(options) {
220
224
  if (this.destroyed) throw new Error("UploadManager is destroyed");
221
- const batch_id = crypto.randomUUID();
225
+ const batch_id = (0, import_hazo_core2.generateRequestId)().slice(4);
222
226
  const job_ids = [];
223
227
  const pipeline_steps = options.pipeline_steps ?? this.config.default_pipeline_steps;
224
228
  for (const file of options.files) {
@@ -1,7 +1,11 @@
1
1
  // src/background_upload/react/provider.tsx
2
2
  import { useRef, useEffect as useEffect2 } from "react";
3
3
 
4
+ // src/background_upload/core/upload-manager.ts
5
+ import { generateRequestId as generateRequestId2 } from "hazo_core";
6
+
4
7
  // src/background_upload/core/job.ts
8
+ import { generateRequestId } from "hazo_core";
5
9
  var Job = class {
6
10
  constructor(init) {
7
11
  this.status = "queued";
@@ -9,7 +13,7 @@ var Job = class {
9
13
  this.error = null;
10
14
  this.confirmation_payload = null;
11
15
  this.confirmation_resolve = null;
12
- this.job_id = crypto.randomUUID();
16
+ this.job_id = generateRequestId().slice(4);
13
17
  this.batch_id = init.batch_id;
14
18
  this.created_at = Date.now();
15
19
  this.updated_at = this.created_at;
@@ -178,7 +182,7 @@ var UploadManager = class {
178
182
  }
179
183
  submit_batch(options) {
180
184
  if (this.destroyed) throw new Error("UploadManager is destroyed");
181
- const batch_id = crypto.randomUUID();
185
+ const batch_id = generateRequestId2().slice(4);
182
186
  const job_ids = [];
183
187
  const pipeline_steps = options.pipeline_steps ?? this.config.default_pipeline_steps;
184
188
  for (const file of options.files) {
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { HazoAuthError, HazoConfigError, HazoConflictError, HazoNotFoundError, HazoValidationError, HazoExternalError } from 'hazo_core';
2
+ export { HazoError as HazoFilesError } from 'hazo_core';
1
3
  import { Readable } from 'node:stream';
2
4
  import { OAuth2Client } from 'google-auth-library';
3
5
 
@@ -2871,46 +2873,43 @@ declare function registerModule(provider: StorageProvider, factory: ModuleFactor
2871
2873
 
2872
2874
  /**
2873
2875
  * Custom error classes for hazo_files
2876
+ * All errors extend the appropriate hazo_core subclass.
2874
2877
  */
2875
- declare class HazoFilesError extends Error {
2876
- code: string;
2877
- details?: Record<string, unknown> | undefined;
2878
- constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
2879
- }
2880
- declare class FileNotFoundError extends HazoFilesError {
2878
+
2879
+ declare class FileNotFoundError extends HazoNotFoundError {
2881
2880
  constructor(path: string);
2882
2881
  }
2883
- declare class DirectoryNotFoundError extends HazoFilesError {
2882
+ declare class DirectoryNotFoundError extends HazoNotFoundError {
2884
2883
  constructor(path: string);
2885
2884
  }
2886
- declare class FileExistsError extends HazoFilesError {
2885
+ declare class FileExistsError extends HazoConflictError {
2887
2886
  constructor(path: string);
2888
2887
  }
2889
- declare class DirectoryExistsError extends HazoFilesError {
2888
+ declare class DirectoryExistsError extends HazoConflictError {
2890
2889
  constructor(path: string);
2891
2890
  }
2892
- declare class DirectoryNotEmptyError extends HazoFilesError {
2891
+ declare class DirectoryNotEmptyError extends HazoConflictError {
2893
2892
  constructor(path: string);
2894
2893
  }
2895
- declare class PermissionDeniedError extends HazoFilesError {
2894
+ declare class PermissionDeniedError extends HazoAuthError {
2896
2895
  constructor(path: string, operation: string);
2897
2896
  }
2898
- declare class InvalidPathError extends HazoFilesError {
2897
+ declare class InvalidPathError extends HazoValidationError {
2899
2898
  constructor(path: string, reason: string);
2900
2899
  }
2901
- declare class FileTooLargeError extends HazoFilesError {
2900
+ declare class FileTooLargeError extends HazoValidationError {
2902
2901
  constructor(path: string, size: number, maxSize: number);
2903
2902
  }
2904
- declare class InvalidExtensionError extends HazoFilesError {
2903
+ declare class InvalidExtensionError extends HazoValidationError {
2905
2904
  constructor(path: string, extension: string, allowedExtensions: string[]);
2906
2905
  }
2907
- declare class AuthenticationError extends HazoFilesError {
2906
+ declare class AuthenticationError extends HazoAuthError {
2908
2907
  constructor(provider: string, message: string);
2909
2908
  }
2910
- declare class ConfigurationError extends HazoFilesError {
2909
+ declare class ConfigurationError extends HazoConfigError {
2911
2910
  constructor(message: string);
2912
2911
  }
2913
- declare class OperationError extends HazoFilesError {
2912
+ declare class OperationError extends HazoExternalError {
2914
2913
  constructor(operation: string, message: string, details?: Record<string, unknown>);
2915
2914
  }
2916
2915
 
@@ -3371,4 +3370,4 @@ declare function addRef<T extends FileWithRefs>(file: T, ref: FileRef): T;
3371
3370
  declare function removeRef<T extends FileWithRefs>(file: T, ref_id: string, removed_at: string): T;
3372
3371
  declare function countRefs(file: Pick<FileWithRefs, "file_refs">): number;
3373
3372
 
3374
- 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$1 as FileRef, type FileRefVisibility, type FileStatus, type FileSystemItem, FileTooLargeError, type FileWithRefs, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, type HazoFilesColumnDefinitions, type HazoFilesConfig, HazoFilesError, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesTableSchema, type HazoLLMInstance, 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, NamingTemplate, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProgressCallback, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, 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, type WriteWithCollisionOpts, addExtractionToFileData, addRef, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, countRefs, createAndInitializeModule, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, 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, 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, removeRef, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath, writeWithCollisionRetry };
3373
+ 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$1 as FileRef, type FileRefVisibility, type FileStatus, type FileSystemItem, FileTooLargeError, type FileWithRefs, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, type HazoFilesColumnDefinitions, type HazoFilesConfig, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesTableSchema, type HazoLLMInstance, 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, NamingTemplate, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProgressCallback, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, 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, type WriteWithCollisionOpts, addExtractionToFileData, addRef, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, countRefs, createAndInitializeModule, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, 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, 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, removeRef, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath, writeWithCollisionRetry };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { HazoAuthError, HazoConfigError, HazoConflictError, HazoNotFoundError, HazoValidationError, HazoExternalError } from 'hazo_core';
2
+ export { HazoError as HazoFilesError } from 'hazo_core';
1
3
  import { Readable } from 'node:stream';
2
4
  import { OAuth2Client } from 'google-auth-library';
3
5
 
@@ -2871,46 +2873,43 @@ declare function registerModule(provider: StorageProvider, factory: ModuleFactor
2871
2873
 
2872
2874
  /**
2873
2875
  * Custom error classes for hazo_files
2876
+ * All errors extend the appropriate hazo_core subclass.
2874
2877
  */
2875
- declare class HazoFilesError extends Error {
2876
- code: string;
2877
- details?: Record<string, unknown> | undefined;
2878
- constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
2879
- }
2880
- declare class FileNotFoundError extends HazoFilesError {
2878
+
2879
+ declare class FileNotFoundError extends HazoNotFoundError {
2881
2880
  constructor(path: string);
2882
2881
  }
2883
- declare class DirectoryNotFoundError extends HazoFilesError {
2882
+ declare class DirectoryNotFoundError extends HazoNotFoundError {
2884
2883
  constructor(path: string);
2885
2884
  }
2886
- declare class FileExistsError extends HazoFilesError {
2885
+ declare class FileExistsError extends HazoConflictError {
2887
2886
  constructor(path: string);
2888
2887
  }
2889
- declare class DirectoryExistsError extends HazoFilesError {
2888
+ declare class DirectoryExistsError extends HazoConflictError {
2890
2889
  constructor(path: string);
2891
2890
  }
2892
- declare class DirectoryNotEmptyError extends HazoFilesError {
2891
+ declare class DirectoryNotEmptyError extends HazoConflictError {
2893
2892
  constructor(path: string);
2894
2893
  }
2895
- declare class PermissionDeniedError extends HazoFilesError {
2894
+ declare class PermissionDeniedError extends HazoAuthError {
2896
2895
  constructor(path: string, operation: string);
2897
2896
  }
2898
- declare class InvalidPathError extends HazoFilesError {
2897
+ declare class InvalidPathError extends HazoValidationError {
2899
2898
  constructor(path: string, reason: string);
2900
2899
  }
2901
- declare class FileTooLargeError extends HazoFilesError {
2900
+ declare class FileTooLargeError extends HazoValidationError {
2902
2901
  constructor(path: string, size: number, maxSize: number);
2903
2902
  }
2904
- declare class InvalidExtensionError extends HazoFilesError {
2903
+ declare class InvalidExtensionError extends HazoValidationError {
2905
2904
  constructor(path: string, extension: string, allowedExtensions: string[]);
2906
2905
  }
2907
- declare class AuthenticationError extends HazoFilesError {
2906
+ declare class AuthenticationError extends HazoAuthError {
2908
2907
  constructor(provider: string, message: string);
2909
2908
  }
2910
- declare class ConfigurationError extends HazoFilesError {
2909
+ declare class ConfigurationError extends HazoConfigError {
2911
2910
  constructor(message: string);
2912
2911
  }
2913
- declare class OperationError extends HazoFilesError {
2912
+ declare class OperationError extends HazoExternalError {
2914
2913
  constructor(operation: string, message: string, details?: Record<string, unknown>);
2915
2914
  }
2916
2915
 
@@ -3371,4 +3370,4 @@ declare function addRef<T extends FileWithRefs>(file: T, ref: FileRef): T;
3371
3370
  declare function removeRef<T extends FileWithRefs>(file: T, ref_id: string, removed_at: string): T;
3372
3371
  declare function countRefs(file: Pick<FileWithRefs, "file_refs">): number;
3373
3372
 
3374
- 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$1 as FileRef, type FileRefVisibility, type FileStatus, type FileSystemItem, FileTooLargeError, type FileWithRefs, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, type HazoFilesColumnDefinitions, type HazoFilesConfig, HazoFilesError, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesTableSchema, type HazoLLMInstance, 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, NamingTemplate, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProgressCallback, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, 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, type WriteWithCollisionOpts, addExtractionToFileData, addRef, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, countRefs, createAndInitializeModule, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, 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, 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, removeRef, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath, writeWithCollisionRetry };
3373
+ 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$1 as FileRef, type FileRefVisibility, type FileStatus, type FileSystemItem, FileTooLargeError, type FileWithRefs, type FileWithStatus, type FindOrphanedOptions, type FolderItem, type GeneratedNameResult, type GoogleAuthConfig, GoogleDriveAuth, type GoogleDriveConfig, GoogleDriveModule, HAZO_FILES_DEFAULT_TABLE_NAME, HAZO_FILES_MIGRATION_V2, HAZO_FILES_MIGRATION_V3, HAZO_FILES_NAMING_DEFAULT_TABLE_NAME, HAZO_FILES_NAMING_TABLE_SCHEMA, HAZO_FILES_TABLE_SCHEMA, type HazoFilesColumnDefinitions, type HazoFilesConfig, type HazoFilesMigrationV2, type HazoFilesMigrationV3, type HazoFilesNamingColumnDefinitions, type HazoFilesNamingTableSchema, type HazoFilesTableSchema, type HazoLLMInstance, 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, NamingTemplate, type NamingVariable, OperationError, type OperationResult, type ParsedNamingConvention, type PatternSegment, PermissionDeniedError, type ProgressCallback, type RemoveExtractionOptions, type RemoveRefsCriteria, type RenameOptions, 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, type WriteWithCollisionOpts, addExtractionToFileData, addRef, backfillV2Defaults, buildFileWithStatus, clearExtractions, clonePattern, computeFileHash, computeFileHashFromStream, computeFileHashSync, computeFileInfo, countRefs, createAndInitializeModule, createDropboxAuth, createDropboxModule, createEmptyFileDataStructure, createEmptyNamingRuleSchema, createFileItem, createFileManager, createFileMetadataService, createFileRef, createFolderItem, createGoogleDriveAuth, createGoogleDriveModule, createInitializedFileManager, createInitializedTrackedFileManager, createLLMExtractionService, createLiteralSegment, createLocalModule, createModule, createNamingConventionService, 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, 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, removeRef, removeRefFromArray, removeRefsByCriteriaFromArray, sanitizeFilename, saveConfig, sortItems, stringifyFileData, stringifyFileRefs, successResult, toV2Record, updateExtractionById, validateExtractionData, validateFileDataStructure, validateNamingRuleSchema, validatePath, writeWithCollisionRetry };