@ucdjs/ucd-store 0.0.1 → 1.0.1-beta.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.
@@ -0,0 +1,747 @@
1
+ import { OperationResult, PathFilter, PathFilterOptions } from "@ucdjs-internal/shared";
2
+ import { UCDClient } from "@ucdjs/client";
3
+ import { FileSystemBridge, FileSystemBridgeArgs, FileSystemBridgeFactory } from "@ucdjs/fs-bridge";
4
+ import z from "zod";
5
+ import { ExpectedFile, UCDWellKnownConfig, UnicodeFileTreeNode } from "@ucdjs/schemas";
6
+
7
+ //#region src/errors.d.ts
8
+ declare abstract class UCDStoreBaseError extends Error {
9
+ constructor(message: string);
10
+ }
11
+ declare class UCDStoreGenericError extends UCDStoreBaseError {
12
+ readonly data?: Record<string, unknown>;
13
+ constructor(message: string, data?: Record<string, unknown>);
14
+ }
15
+ declare class UCDStoreFileNotFoundError extends UCDStoreBaseError {
16
+ readonly filePath: string;
17
+ readonly version?: string;
18
+ constructor(filePath: string, version?: string);
19
+ }
20
+ declare class UCDStoreVersionNotFoundError extends UCDStoreBaseError {
21
+ readonly version: string;
22
+ constructor(version: string);
23
+ }
24
+ declare class UCDStoreBridgeUnsupportedOperation extends UCDStoreBaseError {
25
+ readonly operation: string;
26
+ readonly requiredCapabilities: string[];
27
+ readonly availableCapabilities: string[];
28
+ constructor(operation: string, requiredCapabilities: string[], availableCapabilities: string[]);
29
+ }
30
+ declare class UCDStoreInvalidManifestError extends UCDStoreBaseError {
31
+ readonly manifestPath: string;
32
+ readonly details: string[];
33
+ constructor({
34
+ manifestPath,
35
+ message,
36
+ details
37
+ }: {
38
+ manifestPath: string;
39
+ message: string;
40
+ details?: string[];
41
+ });
42
+ }
43
+ declare class UCDStoreNotInitializedError extends UCDStoreBaseError {
44
+ constructor();
45
+ }
46
+ declare class UCDStoreApiFallbackError extends UCDStoreBaseError {
47
+ readonly version: string;
48
+ readonly filePath: string;
49
+ readonly status?: number;
50
+ readonly reason: "fetch-failed" | "no-data";
51
+ constructor({
52
+ version,
53
+ filePath,
54
+ status,
55
+ reason,
56
+ message
57
+ }: {
58
+ version: string;
59
+ filePath: string;
60
+ status?: number;
61
+ reason: "fetch-failed" | "no-data";
62
+ message?: string;
63
+ });
64
+ }
65
+ type StoreError = UCDStoreGenericError | UCDStoreFileNotFoundError | UCDStoreVersionNotFoundError | UCDStoreBridgeUnsupportedOperation | UCDStoreInvalidManifestError | UCDStoreNotInitializedError | UCDStoreApiFallbackError;
66
+ //#endregion
67
+ //#region src/files/get.d.ts
68
+ interface GetFileOptions extends SharedOperationOptions {
69
+ /**
70
+ * Whether to allow falling back to API if file is not found in local store
71
+ * @default false
72
+ */
73
+ allowApi?: boolean;
74
+ }
75
+ //#endregion
76
+ //#region src/files/list.d.ts
77
+ interface ListFilesOptions extends SharedOperationOptions {
78
+ /**
79
+ * Whether to allow falling back to API if files are not found in local store
80
+ * @default false
81
+ */
82
+ allowApi?: boolean;
83
+ }
84
+ //#endregion
85
+ //#region src/files/tree.d.ts
86
+ interface GetFileTreeOptions extends SharedOperationOptions {
87
+ /**
88
+ * Whether to allow falling back to API if files are not found in local store
89
+ * @default false
90
+ */
91
+ allowApi?: boolean;
92
+ }
93
+ //#endregion
94
+ //#region src/reports/analyze.d.ts
95
+ interface AnalyzeOptions extends SharedOperationOptions {
96
+ /**
97
+ * Specific versions to analyze. If not provided, analyzes all versions.
98
+ */
99
+ versions?: string[];
100
+ }
101
+ interface AnalysisFilesReport {
102
+ /**
103
+ * List of files that were found in the store for this version.
104
+ * NOTE: This does not include orphaned files.
105
+ */
106
+ present: ReportFile[];
107
+ /**
108
+ * List of orphaned files (in store but not expected).
109
+ */
110
+ orphaned: ReportFile[];
111
+ /**
112
+ * List of files missing from the store.
113
+ */
114
+ missing: ReportFile[];
115
+ }
116
+ interface AnalysisVersionReport extends BaseVersionReport {
117
+ /**
118
+ * Whether the version is complete.
119
+ * True if all expected files are present and no orphaned files exist.
120
+ */
121
+ isComplete: boolean;
122
+ /**
123
+ * Categorized file lists.
124
+ */
125
+ files: AnalysisFilesReport;
126
+ /**
127
+ * Breakdown of file types by extension.
128
+ * Provides insight into the composition of files within the version.
129
+ */
130
+ fileTypes: Record<string, number>;
131
+ }
132
+ interface AnalysisReport extends BaseOperationReport {
133
+ /**
134
+ * Per-version analysis results.
135
+ */
136
+ versions: Map<string, AnalysisVersionReport>;
137
+ }
138
+ //#endregion
139
+ //#region src/reports/compare.d.ts
140
+ /**
141
+ * Single mode types for comparison.
142
+ * - "prefer-local": Try local first, fall back to API if not found
143
+ * - "local": Only use local files, fail if not present
144
+ * - "api": Only use API, never check local files
145
+ */
146
+ type SingleModeType = "prefer-local" | "local" | "api";
147
+ /**
148
+ * Comparison mode configuration.
149
+ * Can be a single mode applied to both versions, or a tuple specifying different modes for from/to.
150
+ *
151
+ * @example
152
+ * // Single mode - same behavior for both versions
153
+ * mode: "prefer-local"
154
+ *
155
+ * @example
156
+ * // Tuple mode - different behavior for from/to
157
+ * mode: ["local", "api"] // from uses local, to uses API
158
+ */
159
+ type ComparisonMode = SingleModeType | readonly [SingleModeType, SingleModeType];
160
+ interface CompareOptions extends SharedOperationOptions {
161
+ /** Version to compare from */
162
+ from: string;
163
+ /** Version to compare to */
164
+ to: string;
165
+ /** Whether to compare file contents using SHA-256 hashes. Defaults to true. */
166
+ includeFileHashes?: boolean;
167
+ /** Concurrency for file reads when computing hashes. Defaults to 5. */
168
+ concurrency?: number;
169
+ /**
170
+ * Comparison mode determining how files are fetched.
171
+ *
172
+ * - "prefer-local" (default): Try local first, fall back to API if not found
173
+ * - "local": Only use local files, fail if not present
174
+ * - "api": Only use API, never check local files
175
+ * - ["fromMode", "toMode"]: Tuple specifying different modes for from/to versions
176
+ *
177
+ * @default "prefer-local"
178
+ */
179
+ mode?: ComparisonMode;
180
+ }
181
+ /**
182
+ * Change type for modified files.
183
+ * - "content-changed": File content differs (hash mismatch)
184
+ * - "size-only-changed": Only size differs (rare, usually implies content change)
185
+ */
186
+ type FileChangeType = "content-changed" | "size-only-changed";
187
+ interface FileChangeInfo {
188
+ /** The file path */
189
+ file: string;
190
+ /** Type of change detected */
191
+ changeType: FileChangeType;
192
+ /** File metadata from the source version */
193
+ from: {
194
+ /** File size in bytes */size: number; /** Content hash (SHA-256, computed without UCD header) */
195
+ hash: string;
196
+ };
197
+ /** File metadata from the target version */
198
+ to: {
199
+ /** File size in bytes */size: number; /** Content hash (SHA-256, computed without UCD header) */
200
+ hash: string;
201
+ };
202
+ }
203
+ interface VersionComparison {
204
+ /** The source version being compared from */
205
+ from: string;
206
+ /** The target version being compared to */
207
+ to: string;
208
+ /** Files that were added in the target version */
209
+ added: readonly string[];
210
+ /** Files that were removed from the source version */
211
+ removed: readonly string[];
212
+ /** Files that were modified between versions */
213
+ modified: readonly string[];
214
+ /** Number of files that are unchanged between versions */
215
+ unchanged: number;
216
+ /** Detailed change information for modified files */
217
+ changes: readonly FileChangeInfo[];
218
+ }
219
+ //#endregion
220
+ //#region src/tasks/mirror.d.ts
221
+ interface MirrorOptions extends SharedOperationOptions {
222
+ /**
223
+ * Specific versions to mirror. If not provided, mirrors all manifest versions.
224
+ */
225
+ versions?: string[];
226
+ /**
227
+ * Whether to re-download files even if they already exist locally.
228
+ * @default false
229
+ */
230
+ force?: boolean;
231
+ /**
232
+ * Maximum concurrent downloads
233
+ * @default 5
234
+ */
235
+ concurrency?: number;
236
+ }
237
+ interface MirrorFilesReport {
238
+ /**
239
+ * List of successfully downloaded files.
240
+ */
241
+ downloaded: ReportFile[];
242
+ /**
243
+ * List of skipped files (already existed locally).
244
+ */
245
+ skipped: ReportFile[];
246
+ /**
247
+ * List of failed files.
248
+ */
249
+ failed: ReportFile[];
250
+ }
251
+ interface MirrorVersionReport extends BaseVersionReport {
252
+ /**
253
+ * Categorized file lists.
254
+ */
255
+ files: MirrorFilesReport;
256
+ }
257
+ interface MirrorReport extends BaseOperationReport {
258
+ /**
259
+ * Per-version mirror results.
260
+ */
261
+ versions: Map<string, MirrorVersionReport>;
262
+ }
263
+ //#endregion
264
+ //#region src/tasks/sync.d.ts
265
+ interface SyncOptions extends SharedOperationOptions {
266
+ /**
267
+ * Specific versions to sync. If not provided, syncs all versions in lockfile.
268
+ */
269
+ versions?: string[];
270
+ /**
271
+ * Whether to re-download files even if they already exist locally.
272
+ * @default false
273
+ */
274
+ force?: boolean;
275
+ /**
276
+ * Maximum concurrent downloads
277
+ * @default 5
278
+ */
279
+ concurrency?: number;
280
+ /**
281
+ * Remove versions from lockfile that are not available in API.
282
+ * @default false
283
+ */
284
+ removeUnavailable?: boolean;
285
+ /**
286
+ * Remove orphaned files (files not in expected files list for each version).
287
+ * @default false
288
+ */
289
+ cleanOrphaned?: boolean;
290
+ }
291
+ /**
292
+ * Complete sync report.
293
+ * Extends BaseOperationReport for consistency with analyze/mirror.
294
+ */
295
+ interface SyncResult extends BaseOperationReport {
296
+ /**
297
+ * Versions that were added to the lockfile.
298
+ */
299
+ added: string[];
300
+ /**
301
+ * Versions that were removed from the lockfile (if removeUnavailable was true).
302
+ */
303
+ removed: string[];
304
+ /**
305
+ * Versions that were already in the lockfile.
306
+ */
307
+ unchanged: string[];
308
+ /**
309
+ * All versions in lockfile after sync.
310
+ */
311
+ versions: string[];
312
+ /**
313
+ * Report of mirrored files (same structure as mirror operation).
314
+ * Always present (uses empty report when no mirroring occurred).
315
+ */
316
+ mirrorReport: MirrorReport;
317
+ /**
318
+ * Files that were removed per version (orphaned files, only if cleanOrphaned was true).
319
+ * Always present (empty Map when no files removed).
320
+ */
321
+ removedFiles: Map<string, ReportFile[]>;
322
+ }
323
+ //#endregion
324
+ //#region src/types.d.ts
325
+ /**
326
+ * Strategy for handling version conflicts when manifest exists and versions are provided.
327
+ */
328
+ type VersionConflictStrategy = "strict" | "merge" | "overwrite";
329
+ /**
330
+ * Context available during bridge construction after endpoint discovery.
331
+ */
332
+ interface DiscoveryContext {
333
+ /**
334
+ * The resolved base URL for the API.
335
+ */
336
+ baseUrl: string;
337
+ /**
338
+ * The discovered endpoint configuration.
339
+ */
340
+ endpointConfig: UCDWellKnownConfig;
341
+ /**
342
+ * The resolved versions from config (if available).
343
+ */
344
+ versions: string[];
345
+ }
346
+ /**
347
+ * Helper type to extract the options type from a FileSystemBridgeFactory.
348
+ * Returns the first argument type, or `never` if the factory takes no arguments.
349
+ */
350
+ type ExtractBridgeOptions<TSchema extends z.ZodType> = FileSystemBridgeArgs<TSchema>[0];
351
+ type FsOptionsInputFn<TSchema extends z.ZodType> = (ctx: DiscoveryContext) => ExtractBridgeOptions<TSchema>;
352
+ /**
353
+ * Input type for fsOptions - can be static options or a function receiving DiscoveryContext.
354
+ */
355
+ type FsOptionsInput<TSchema extends z.ZodType> = [ExtractBridgeOptions<TSchema>] extends [never] ? never : ExtractBridgeOptions<TSchema> | FsOptionsInputFn<TSchema>;
356
+ interface UCDStoreOptions<BridgeOptionsSchema extends z.ZodType = z.ZodUnknown> {
357
+ /**
358
+ * Base URL for the Unicode API
359
+ *
360
+ * @default "https://api.ucdjs.dev"
361
+ */
362
+ baseUrl?: string;
363
+ /**
364
+ * Optional pre-initialized UCD client instance.
365
+ * If provided, this client will be used instead of creating a new one.
366
+ * The baseUrl and endpointConfig options will be ignored if a client is provided.
367
+ */
368
+ client?: UCDClient;
369
+ /**
370
+ * Optional endpoint configuration for the UCD API.
371
+ * If not provided, will use default configuration or discover from API.
372
+ */
373
+ endpointConfig?: UCDWellKnownConfig;
374
+ /**
375
+ * Optional filters to apply when fetching Unicode data.
376
+ * These can be used to limit the data fetched from the API.
377
+ */
378
+ globalFilters?: PathFilterOptions;
379
+ /**
380
+ * File System Bridge to use for file operations.
381
+ * You can either provide your own implementation or use one of the following:
382
+ * - `@ucdjs/fs-bridge/bridges/node` for Node.js environments with full capabilities
383
+ * - `@ucdjs/fs-bridge/bridges/http` for HTTP-based file systems (read-only)
384
+ */
385
+ fs: FileSystemBridgeFactory<BridgeOptionsSchema>;
386
+ /**
387
+ * Options to pass to the File System Bridge factory.
388
+ * Can be static options or a function that receives the discovery context.
389
+ *
390
+ * TODO:
391
+ * When using the function form, the options has some typing issues.
392
+ * E.g. the function allows unspecified properties that are not in the schema.
393
+ * This should be fixed to strictly enforce the schema shape.
394
+ */
395
+ fsOptions?: FsOptionsInput<BridgeOptionsSchema>;
396
+ /**
397
+ * List of Unicode versions to include in the store.
398
+ * Only used when initializing a new store that supports mirroring.
399
+ */
400
+ versions?: string[];
401
+ /**
402
+ * Whether to require an existing store with a lockfile.
403
+ * If true (default), store creation will fail if no lockfile is found.
404
+ * Set to false to automatically initialize a new lockfile when one doesn't exist.
405
+ *
406
+ * @default true
407
+ */
408
+ requireExistingStore?: boolean;
409
+ /**
410
+ * Whether to verify lockfile versions against the API.
411
+ * If true, will check that all versions in the lockfile are still available.
412
+ * Only applies when a lockfile already exists.
413
+ *
414
+ * @default true
415
+ */
416
+ verify?: boolean;
417
+ /**
418
+ * Strategy for handling version conflicts when lockfile exists and versions are provided.
419
+ * - "strict": Throw error if provided versions differ from lockfile (default)
420
+ * - "merge": Combine lockfile and provided versions, update lockfile
421
+ * - "overwrite": Replace lockfile versions with provided versions, update lockfile
422
+ *
423
+ * Only applies when lockfile exists and versions are provided.
424
+ *
425
+ * @default "strict"
426
+ */
427
+ versionStrategy?: VersionConflictStrategy;
428
+ }
429
+ /**
430
+ * Internal store context to be passed
431
+ *
432
+ * @internal
433
+ */
434
+ interface InternalUCDStoreContext {
435
+ /**
436
+ * UCD API client instance.
437
+ */
438
+ client: UCDClient;
439
+ /**
440
+ * Path filter to apply when fetching files.
441
+ */
442
+ filter: PathFilter;
443
+ /**
444
+ * File system bridge for file operations.
445
+ */
446
+ fs: FileSystemBridge;
447
+ /**
448
+ * Lockfile-related state and configuration.
449
+ */
450
+ lockfile: {
451
+ /**
452
+ * Whether the file system bridge supports lockfile operations (write capability).
453
+ */
454
+ supports: boolean;
455
+ /**
456
+ * Whether a lockfile currently exists.
457
+ */
458
+ exists: boolean;
459
+ /**
460
+ * Path to the store lockfile.
461
+ * Empty string if lockfile is not supported.
462
+ */
463
+ path: string;
464
+ };
465
+ /**
466
+ * Version sources and resolution.
467
+ */
468
+ versions: {
469
+ /**
470
+ * The versions that were provided as input to createUCDStore.
471
+ * Empty array if no versions were explicitly provided.
472
+ */
473
+ userProvided: readonly string[];
474
+ /**
475
+ * The versions from the resolved endpoint configuration.
476
+ * Empty array if no config was available.
477
+ */
478
+ configFile: readonly string[];
479
+ /**
480
+ * Getter that lazily fetches and caches available versions from the API.
481
+ * Returns a frozen array of version strings.
482
+ */
483
+ apiVersions: () => Promise<readonly string[]>;
484
+ /**
485
+ * The currently resolved/effective versions used for operations.
486
+ */
487
+ resolved: string[];
488
+ };
489
+ /**
490
+ * Retrieves the expected files for a specific Unicode version from the API.
491
+ *
492
+ * @param version - The Unicode version to get expected files for
493
+ * @returns A promise that resolves to an array of ExpectedFile objects
494
+ */
495
+ getExpectedFilePaths: (version: string) => Promise<ExpectedFile[]>;
496
+ }
497
+ type UCDStoreContext = Readonly<Pick<InternalUCDStoreContext, "fs">> & {
498
+ /**
499
+ * List of Unicode versions available in the store.
500
+ */
501
+ versions: readonly string[];
502
+ };
503
+ interface UCDStore extends UCDStoreContext, UCDStoreOperations {}
504
+ /**
505
+ * Options for store methods that support filtering
506
+ */
507
+ interface SharedOperationOptions {
508
+ /**
509
+ * Additional filters to apply on top of global filters
510
+ */
511
+ filters?: Pick<PathFilterOptions, "include" | "exclude">;
512
+ }
513
+ /**
514
+ * File operations namespace for the store.
515
+ * Provides methods for accessing and manipulating Unicode data files.
516
+ */
517
+ interface UCDStoreFileOperations {
518
+ /**
519
+ * Get a specific file for a Unicode version.
520
+ * Tries local FS first, then falls back to API.
521
+ */
522
+ get: (version: string, path: string, options?: GetFileOptions) => Promise<OperationResult<string, StoreError>>;
523
+ /**
524
+ * List all file paths for a Unicode version.
525
+ * Returns a flat array of file paths.
526
+ */
527
+ list: (version: string, options?: ListFilesOptions) => Promise<OperationResult<string[], StoreError>>;
528
+ /**
529
+ * Get the file tree structure for a Unicode version.
530
+ * Returns a hierarchical tree of files and directories.
531
+ */
532
+ tree: (version: string, options?: GetFileTreeOptions) => Promise<OperationResult<UnicodeFileTreeNode[], StoreError>>;
533
+ }
534
+ interface UCDStoreOperations {
535
+ /**
536
+ * Synchronizes the store lockfile with available versions from API and mirrors files.
537
+ * Updates lockfile with new versions, downloads missing files, and optionally removes orphaned files/unavailable versions.
538
+ *
539
+ * Example: Fetches available versions from API, updates lockfile, mirrors files, and optionally cleans up orphaned files.
540
+ */
541
+ sync: (options?: SyncOptions) => Promise<OperationResult<SyncResult, StoreError>>;
542
+ /**
543
+ * Mirrors Unicode data files from the API to local storage.
544
+ * This is a file-level operation that downloads actual Unicode data for specified versions.
545
+ *
546
+ * Example: Downloads all .txt files for version 16.0.0 to local storage.
547
+ */
548
+ mirror: (options?: MirrorOptions) => Promise<OperationResult<MirrorReport, StoreError>>;
549
+ /**
550
+ * Analyzes Unicode data in the store.
551
+ * Returns a report with per-version analysis including file categorization,
552
+ * counts, metrics, and errors.
553
+ */
554
+ analyze: (options?: AnalyzeOptions) => Promise<OperationResult<AnalysisReport, StoreError>>;
555
+ /**
556
+ * Compares two Unicode versions and returns a detailed diff report.
557
+ * Identifies added, removed, and modified files between versions.
558
+ * Uses content hashes (with Unicode header stripped) to detect actual changes.
559
+ */
560
+ compare: (options?: CompareOptions) => Promise<OperationResult<VersionComparison, StoreError>>;
561
+ /**
562
+ * File operations namespace
563
+ */
564
+ files: UCDStoreFileOperations;
565
+ }
566
+ interface ReportFile {
567
+ /**
568
+ * The normalized file name (without version prefix).
569
+ */
570
+ name: string;
571
+ /**
572
+ * The full local file path (including version prefix).
573
+ */
574
+ filePath: string;
575
+ }
576
+ interface ReportError extends ReportFile {
577
+ /**
578
+ * The error message or reason for failure.
579
+ */
580
+ reason: string;
581
+ }
582
+ interface OperationMetrics {
583
+ /**
584
+ * Success rate as a percentage (0-100).
585
+ */
586
+ successRate: number;
587
+ /**
588
+ * Cache hit rate (skipped) as a percentage (0-100).
589
+ */
590
+ cacheHitRate: number;
591
+ /**
592
+ * Failure rate as a percentage (0-100).
593
+ */
594
+ failureRate: number;
595
+ /**
596
+ * Average milliseconds per file processed.
597
+ */
598
+ averageTimePerFile: number;
599
+ }
600
+ interface StorageMetrics {
601
+ /**
602
+ * Human-readable total size of all processed files.
603
+ */
604
+ totalSize: string;
605
+ /**
606
+ * Average file size (human-readable).
607
+ */
608
+ averageFileSize: string;
609
+ }
610
+ interface FileCounts {
611
+ /**
612
+ * Total number of files queued/expected for processing.
613
+ */
614
+ total: number;
615
+ /**
616
+ * Number of files successfully processed (downloaded/present).
617
+ */
618
+ success: number;
619
+ /**
620
+ * Number of files skipped (already existed locally).
621
+ */
622
+ skipped: number;
623
+ /**
624
+ * Number of files that failed.
625
+ */
626
+ failed: number;
627
+ }
628
+ interface OperationSummary {
629
+ /**
630
+ * Total operation duration in milliseconds.
631
+ */
632
+ duration: number;
633
+ /**
634
+ * File counts.
635
+ */
636
+ counts: FileCounts;
637
+ /**
638
+ * Computed metrics (rates, averages).
639
+ */
640
+ metrics: OperationMetrics;
641
+ /**
642
+ * Storage metrics (sizes).
643
+ */
644
+ storage: StorageMetrics;
645
+ }
646
+ interface BaseOperationReport {
647
+ /**
648
+ * ISO timestamp when the operation completed.
649
+ */
650
+ timestamp: string;
651
+ /**
652
+ * Summary of the operation.
653
+ * Always present (use zeroed values when no work was done).
654
+ */
655
+ summary: OperationSummary;
656
+ }
657
+ interface BaseVersionReport {
658
+ /**
659
+ * The Unicode version this report is for.
660
+ */
661
+ version: string;
662
+ /**
663
+ * File counts for this version.
664
+ */
665
+ counts: FileCounts;
666
+ /**
667
+ * Computed metrics for this version.
668
+ */
669
+ metrics: OperationMetrics;
670
+ /**
671
+ * Errors encountered during processing.
672
+ * Always present (empty array when no errors).
673
+ */
674
+ errors: ReportError[];
675
+ }
676
+ //#endregion
677
+ //#region src/factory.d.ts
678
+ interface NodeUCDStoreOptions<BridgeOptionsSchema extends z.ZodType> extends Omit<UCDStoreOptions<BridgeOptionsSchema>, "fs" | "fsOptions"> {
679
+ basePath?: string;
680
+ }
681
+ /**
682
+ * Creates a UCD store backed by the Node.js FileSystemBridge.
683
+ * @template BridgeOptionsSchema extends z.ZodType
684
+ * @param {NodeUCDStoreOptions<BridgeOptionsSchema>} [options] Store options; provide basePath to set the filesystem root.
685
+ * @returns {Promise<UCDStore>} A ready-to-use store instance.
686
+ * @throws {Error} If the Node.js FileSystemBridge could not be loaded.
687
+ */
688
+ declare function createNodeUCDStore<BridgeOptionsSchema extends z.ZodType>(options?: NodeUCDStoreOptions<BridgeOptionsSchema>): Promise<UCDStore>;
689
+ interface HTTPUCDStoreOptions<BridgeOptionsSchema extends z.ZodType> extends Omit<UCDStoreOptions<BridgeOptionsSchema>, "fs" | "fsOptions"> {
690
+ bridgeBaseUrl?: string;
691
+ }
692
+ /**
693
+ * Creates a UCD store backed by the HTTP FileSystemBridge.
694
+ * @template BridgeOptionsSchema extends z.ZodType
695
+ * @param {HTTPUCDStoreOptions<BridgeOptionsSchema>} [options] Store options; provide baseUrl to override the default.
696
+ * @returns {Promise<UCDStore>} A ready-to-use store instance.
697
+ * @throws {Error} If the HTTP FileSystemBridge could not be loaded.
698
+ */
699
+ declare function createHTTPUCDStore<BridgeOptionsSchema extends z.ZodType>(options?: HTTPUCDStoreOptions<BridgeOptionsSchema>): Promise<UCDStore>;
700
+ //#endregion
701
+ //#region src/store.d.ts
702
+ declare function createUCDStore<BridgeOptionsSchema extends z.ZodType>(options: UCDStoreOptions<BridgeOptionsSchema>): Promise<UCDStore>;
703
+ //#endregion
704
+ //#region src/utils/validate.d.ts
705
+ interface ValidateVersionsOptions {
706
+ /**
707
+ * UCD Client instance to use for API requests.
708
+ */
709
+ client: UCDClient;
710
+ /**
711
+ * Versions to validate against the API.
712
+ */
713
+ versions: string[];
714
+ }
715
+ interface ValidateVersionsResult {
716
+ /**
717
+ * Whether all provided versions are valid (present in the API).
718
+ */
719
+ valid: boolean;
720
+ /**
721
+ * Versions that were validated.
722
+ */
723
+ validatedVersions: string[];
724
+ /**
725
+ * Versions available from the API.
726
+ */
727
+ availableVersions: string[];
728
+ /**
729
+ * Versions that are valid (present in the API).
730
+ */
731
+ validVersions: string[];
732
+ /**
733
+ * Versions that are invalid (not present in the API).
734
+ */
735
+ invalidVersions: string[];
736
+ }
737
+ /**
738
+ * Validates that the provided versions are available in the API.
739
+ * This is a pure validation function with no lockfile dependency.
740
+ *
741
+ * @param {ValidateVersionsOptions} options - Validation options
742
+ * @returns {Promise<ValidateVersionsResult>} Validation result
743
+ * @throws {UCDStoreGenericError} If API fetch fails
744
+ */
745
+ declare function validateVersions(options: ValidateVersionsOptions): Promise<ValidateVersionsResult>;
746
+ //#endregion
747
+ export { type AnalysisFilesReport, type AnalysisReport, type AnalysisVersionReport, type AnalyzeOptions, type BaseOperationReport, type BaseVersionReport, type CompareOptions, type ComparisonMode, type FileChangeInfo, type FileChangeType, type FileCounts, type InternalUCDStoreContext, type MirrorFilesReport, type MirrorOptions, type MirrorReport, type MirrorVersionReport, type OperationMetrics, type OperationSummary, type ReportError, type ReportFile, type SharedOperationOptions, type SingleModeType, type StorageMetrics, type StoreError, type SyncOptions, type SyncResult, type UCDStore, UCDStoreBaseError, UCDStoreBridgeUnsupportedOperation, type UCDStoreContext, UCDStoreFileNotFoundError, UCDStoreGenericError, type UCDStoreOperations, type UCDStoreOptions, UCDStoreVersionNotFoundError, type ValidateVersionsOptions, type ValidateVersionsResult, type VersionComparison, type VersionConflictStrategy, createHTTPUCDStore, createNodeUCDStore, createUCDStore, validateVersions };