alphatheta-connect 0.15.0 → 0.19.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.
Files changed (41) hide show
  1. package/README.md +29 -3
  2. package/lib/artwork/index.d.ts +2 -1
  3. package/lib/cli.js +1122 -1332
  4. package/lib/cli.js.map +1 -1
  5. package/lib/constants.d.ts +7 -1
  6. package/lib/db/getArtworkFromFile.d.ts +2 -0
  7. package/lib/db/getFile.d.ts +7 -2
  8. package/lib/db/getMetadata.d.ts +3 -2
  9. package/lib/db/getTrackAnalysis.d.ts +28 -0
  10. package/lib/db/index.d.ts +8 -8
  11. package/lib/entities.d.ts +13 -111
  12. package/lib/index.d.ts +10 -2
  13. package/lib/index.js +1357 -1364
  14. package/lib/index.js.map +1 -1
  15. package/lib/localdb/database-adapter.d.ts +2 -47
  16. package/lib/localdb/index.d.ts +1 -1
  17. package/lib/localdb/onelibrary/index.d.ts +5 -0
  18. package/lib/localdb/onelibrary.d.ts +3 -181
  19. package/lib/localdb/rekordbox/anlz-parsers.d.ts +37 -0
  20. package/lib/localdb/rekordbox/entity-creators.d.ts +27 -0
  21. package/lib/localdb/rekordbox/hydrator.d.ts +20 -0
  22. package/lib/localdb/rekordbox/index.d.ts +13 -0
  23. package/lib/localdb/rekordbox/table-mappings.d.ts +10 -0
  24. package/lib/localdb/rekordbox/types.d.ts +118 -0
  25. package/lib/localdb/rekordbox.d.ts +6 -110
  26. package/lib/logger.d.ts +13 -0
  27. package/lib/metadata.d.ts +45 -0
  28. package/lib/network.d.ts +25 -0
  29. package/lib/nfs/index.d.ts +35 -10
  30. package/lib/nfs/index.test.d.ts +1 -0
  31. package/lib/nfs/programs.d.ts +10 -1
  32. package/lib/passive/index.d.ts +1 -1
  33. package/lib/passive/remotedb.d.ts +12 -1
  34. package/lib/remotedb/queries.d.ts +2 -2
  35. package/lib/types.d.ts +55 -78
  36. package/lib/types.js +21 -38
  37. package/lib/types.js.map +1 -1
  38. package/lib/utils/index.d.ts +9 -0
  39. package/lib/virtualcdj/index.d.ts +7 -1
  40. package/package.json +23 -2
  41. package/lib/localdb/onelibrary-schema.d.ts +0 -250
@@ -1,49 +1,4 @@
1
1
  /**
2
- * Common interface for database adapters.
3
- *
4
- * Both MetadataORM (for PDB files) and OneLibraryAdapter (for exportLibrary.db)
5
- * implement this interface, allowing LocalDatabase to use either transparently.
2
+ * Re-export database adapter types from onelibrary-connect.
6
3
  */
7
- import { EntityFK, Playlist, PlaylistEntry, Track } from "../entities";
8
- /**
9
- * Database format preference for loading rekordbox databases.
10
- *
11
- * - 'auto': Try OneLibrary first (rekordbox 7.x+), fall back to PDB (rekordbox 6.x)
12
- * - 'oneLibrary': Only use OneLibrary format (exportLibrary.db)
13
- * - 'pdb': Only use PDB format (export.pdb)
14
- */
15
- export type DatabasePreference = 'auto' | 'oneLibrary' | 'pdb';
16
- /**
17
- * Result of a playlist query
18
- */
19
- export interface PlaylistQueryResult {
20
- folders: Playlist[];
21
- playlists: Playlist[];
22
- trackEntries: PlaylistEntry<EntityFK.WithFKs>[];
23
- }
24
- /**
25
- * Database type identifier
26
- */
27
- export type DatabaseType = 'oneLibrary' | 'pdb';
28
- /**
29
- * Common interface for database adapters
30
- */
31
- export interface DatabaseAdapter {
32
- /**
33
- * The type of database (oneLibrary or pdb)
34
- */
35
- readonly type: DatabaseType;
36
- /**
37
- * Find a track by ID
38
- */
39
- findTrack(id: number): Track | null;
40
- /**
41
- * Query for a list of {folders, playlists, tracks} given a playlist ID.
42
- * If no ID is provided the root list is queried.
43
- */
44
- findPlaylist(playlistId?: number): PlaylistQueryResult;
45
- /**
46
- * Close the database connection
47
- */
48
- close(): void;
49
- }
4
+ export type { DatabaseAdapter, DatabasePreference, DatabaseType, PlaylistQueryResult, } from 'onelibrary-connect';
@@ -1,10 +1,10 @@
1
+ import { type DatabaseAdapter, type DatabasePreference, type DatabaseType } from 'onelibrary-connect';
1
2
  import StrictEventEmitter from 'strict-event-emitter-types';
2
3
  import { EventEmitter } from 'events';
3
4
  import DeviceManager from "../devices";
4
5
  import { FetchProgress } from "../nfs";
5
6
  import StatusEmitter from "../status";
6
7
  import { Device, DeviceID, MediaSlot } from "../types";
7
- import { DatabaseAdapter, DatabasePreference, DatabaseType } from './database-adapter';
8
8
  import { HydrationProgress } from './rekordbox';
9
9
  /**
10
10
  * Rekordbox databases will only exist within these two slots
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Re-exports from onelibrary-connect
3
+ */
4
+ export { getEncryptionKey, openOneLibraryDb, OneLibraryAdapter, } from 'onelibrary-connect';
5
+ export type { Category, DeviceProperty, HistorySession, HotCueBankList, MenuItem, MyTag, SortOption, } from 'onelibrary-connect';
@@ -1,185 +1,7 @@
1
1
  /**
2
2
  * OneLibrary Database Adapter
3
3
  *
4
- * Provides an interface for reading the OneLibrary (exportLibrary.db) SQLite database
5
- * used by modern rekordbox versions and Pioneer DJ devices.
6
- *
7
- * The database is encrypted with SQLCipher 4. The encryption key is derived from
8
- * a hardcoded obfuscated blob.
9
- */
10
- import Database from 'better-sqlite3-multiple-ciphers';
11
- import { Album, Artist, Artwork, Color, EntityFK, Genre, Key, Label, Playlist, PlaylistEntry, Track } from "../entities";
12
- import { CueAndLoop } from "../types";
13
- import { DatabaseAdapter, DatabaseType } from './database-adapter';
14
- /**
15
- * Get the SQLCipher encryption key for OneLibrary databases
16
- */
17
- export declare function getEncryptionKey(): string;
18
- /**
19
- * Open a OneLibrary database with SQLCipher decryption
20
- */
21
- export declare function openOneLibraryDb(dbPath: string): Database.Database;
22
- /**
23
- * Adapter for OneLibrary database that matches the ORM interface.
24
- * Queries the SQLite file directly instead of hydrating into memory.
25
- */
26
- export declare class OneLibraryAdapter implements DatabaseAdapter {
27
- #private;
28
- readonly type: DatabaseType;
29
- constructor(dbPath: string);
30
- /**
31
- * Close the database connection
32
- */
33
- close(): void;
34
- /**
35
- * Find a track by ID
36
- */
37
- findTrack(id: number): Track | null;
38
- /**
39
- * Find all tracks in the database
40
- */
41
- findAllTracks(): Track[];
42
- /**
43
- * Find cue points for a track
44
- */
45
- findCues(trackId: number): CueAndLoop[];
46
- /**
47
- * Find a playlist by ID
48
- */
49
- findPlaylistById(playlistId: number): Playlist | null;
50
- /**
51
- * Query for a list of {folders, playlists, tracks} given a playlist ID.
52
- * If no ID is provided the root list is queried.
53
- */
54
- findPlaylist(playlistId?: number): {
55
- folders: Playlist[];
56
- playlists: Playlist[];
57
- trackEntries: PlaylistEntry<EntityFK.WithFKs>[];
58
- };
59
- /**
60
- * Get track IDs for a playlist in order
61
- */
62
- findPlaylistContents(playlistId: number): number[];
63
- findArtist(artistId: number): Artist | null;
64
- findAlbum(albumId: number): Album | null;
65
- findGenre(genreId: number): Genre | null;
66
- findKey(keyId: number): Key | null;
67
- findColor(colorId: number): Color | null;
68
- findLabel(labelId: number): Label | null;
69
- findArtwork(imageId: number): Artwork | null;
70
- /**
71
- * Find all root-level MyTags (folders and tags with no parent)
72
- */
73
- findMyTags(parentId?: number): {
74
- folders: MyTag[];
75
- tags: MyTag[];
76
- };
77
- /**
78
- * Find a MyTag by ID
79
- */
80
- findMyTagById(myTagId: number): MyTag | null;
81
- /**
82
- * Get track IDs for a MyTag
83
- */
84
- findMyTagContents(myTagId: number): number[];
85
- /**
86
- * Get all MyTags assigned to a track
87
- */
88
- findMyTagsForTrack(trackId: number): MyTag[];
89
- /**
90
- * Find all history sessions
91
- */
92
- findHistorySessions(): HistorySession[];
93
- /**
94
- * Get track IDs for a history session in order
95
- */
96
- findHistoryContents(historyId: number): number[];
97
- /**
98
- * Find all hot cue bank lists
99
- */
100
- findHotCueBankLists(): HotCueBankList[];
101
- /**
102
- * Get cue IDs for a hot cue bank list
103
- */
104
- findHotCueBankListCues(bankListId: number): number[];
105
- /**
106
- * Get all menu items (browse categories)
107
- */
108
- findMenuItems(): MenuItem[];
109
- /**
110
- * Get visible categories with their menu item info
111
- */
112
- findVisibleCategories(): Category[];
113
- /**
114
- * Get visible sort options
115
- */
116
- findVisibleSortOptions(): SortOption[];
117
- /**
118
- * Get device properties
119
- */
120
- getProperty(): DeviceProperty | null;
121
- }
122
- /**
123
- * User-created tag (MyTag)
124
- */
125
- export interface MyTag {
126
- id: number;
127
- name: string;
128
- isFolder: boolean;
129
- parentId: number | null;
130
- }
131
- /**
132
- * History session
133
- */
134
- export interface HistorySession {
135
- id: number;
136
- name: string;
137
- parentId: number | null;
138
- }
139
- /**
140
- * Hot cue bank list
141
- */
142
- export interface HotCueBankList {
143
- id: number;
144
- name: string;
145
- parentId: number | null;
146
- }
147
- /**
148
- * Menu item for browsing
149
- */
150
- export interface MenuItem {
151
- id: number;
152
- kind: number;
153
- name: string;
154
- }
155
- /**
156
- * Browse category
157
- */
158
- export interface Category {
159
- id: number;
160
- menuItemId: number;
161
- name: string;
162
- kind: number;
163
- isVisible: boolean;
164
- }
165
- /**
166
- * Sort option
167
- */
168
- export interface SortOption {
169
- id: number;
170
- menuItemId: number;
171
- name: string;
172
- kind: number;
173
- isVisible: boolean;
174
- isSelectedAsSubColumn: boolean;
175
- }
176
- /**
177
- * Device property
4
+ * Re-exports from onelibrary-connect for backward compatibility.
178
5
  */
179
- export interface DeviceProperty {
180
- deviceName: string;
181
- dbVersion: string;
182
- numberOfContents: number;
183
- createdDate: string;
184
- backgroundColorType: number;
185
- }
6
+ export type { Category, DeviceProperty, HistorySession, HotCueBankList, MenuItem, MyTag, SortOption, } from 'onelibrary-connect';
7
+ export { getEncryptionKey, OneLibraryAdapter, openOneLibraryDb } from 'onelibrary-connect';
@@ -0,0 +1,37 @@
1
+ import { BeatGrid, CueAndLoop, ExtendedCue, SongStructure, VocalConfig, Waveform3BandDetail, Waveform3BandPreview, WaveformHD, WaveformPreviewData } from "../../types";
2
+ /**
3
+ * Fill beatgrid data from the ANLZ section
4
+ */
5
+ export declare function makeBeatGrid(data: any): BeatGrid;
6
+ /**
7
+ * Fill cue and loop data from the ANLZ section
8
+ */
9
+ export declare function makeCueAndLoop(data: any): CueAndLoop[];
10
+ /**
11
+ * Fill waveform HD data from the ANLZ section
12
+ */
13
+ export declare function makeWaveformHd(data: any): WaveformHD;
14
+ /**
15
+ * Parse extended cues (PCO2) with colors and comments
16
+ */
17
+ export declare function makeExtendedCues(data: any): ExtendedCue[];
18
+ /**
19
+ * Parse song structure (PSSI) with phrase analysis
20
+ */
21
+ export declare function makeSongStructure(data: any): SongStructure;
22
+ /**
23
+ * Parse waveform preview data (PWAV/PWV2)
24
+ */
25
+ export declare function makeWaveformPreview(data: any): WaveformPreviewData;
26
+ /**
27
+ * Parse 3-band color waveform preview (PWV6 from .2EX files)
28
+ */
29
+ export declare function makeWaveform3BandPreview(data: any): Waveform3BandPreview;
30
+ /**
31
+ * Parse 3-band color detail waveform (PWV7 from .2EX files)
32
+ */
33
+ export declare function makeWaveform3BandDetail(data: any): Waveform3BandDetail;
34
+ /**
35
+ * Parse vocal detection config (PWVC from .2EX files)
36
+ */
37
+ export declare function makeVocalConfig(data: any): VocalConfig;
@@ -0,0 +1,27 @@
1
+ import { Album, Artist, Artwork, Color, EntityFK, Genre, Key, Label, Playlist, PlaylistEntry, Track } from "../../entities";
2
+ interface IdAndNameEntity {
3
+ id: number;
4
+ name: string;
5
+ }
6
+ /**
7
+ * Utility to create a hydrator that hydrates the provided entity with the id
8
+ * and name properties from the row.
9
+ */
10
+ export declare const makeIdNameHydrator: <T extends IdAndNameEntity>() => (row: any) => T;
11
+ /**
12
+ * Translates a pdb track row entry to a {@link Track} entity.
13
+ */
14
+ export declare function createTrack(trackRow: any): Track<EntityFK.WithFKs>;
15
+ /**
16
+ * Translates a pdb playlist row entry into a {@link Playlist} entity.
17
+ */
18
+ export declare function createPlaylist(playlistRow: any): Playlist;
19
+ /**
20
+ * Translates a pdb playlist track entry into a {@link PlaylistTrack} entity.
21
+ */
22
+ export declare function createPlaylistEntry(playlistTrackRow: any): PlaylistEntry<EntityFK.WithFKs>;
23
+ /**
24
+ * Translates a pdb artwork entry into a {@link Artwork} entity.
25
+ */
26
+ export declare function createArtworkEntry(artworkRow: any): Artwork;
27
+ export type { Album, Artist, Color, Genre, Key, Label };
@@ -0,0 +1,20 @@
1
+ import { TelemetrySpan as Span } from "../../utils/telemetry";
2
+ import type { HydrationOptions } from './types';
3
+ /**
4
+ * This service provides utilities for translating rekordbox database (pdb_ and
5
+ * analysis (ANLZ) files into the common entity types used in this library.
6
+ */
7
+ export declare class RekordboxHydrator {
8
+ #private;
9
+ constructor({ orm, onProgress }: Omit<HydrationOptions, 'pdbData' | 'span'>);
10
+ /**
11
+ * Extract entries from a rekordbox pdb file and hydrate the passed database
12
+ * connection with entities derived from the rekordbox entries.
13
+ */
14
+ hydrateFromPdb(pdbData: Buffer, span?: Span): Promise<void>;
15
+ /**
16
+ * Hydrate the database with entities from the provided RekordboxPdb table.
17
+ * See pdbEntityCreators for how tables are mapped into database entities.
18
+ */
19
+ hydrateFromTable(table: any, span: Span): Promise<void>;
20
+ }
@@ -0,0 +1,13 @@
1
+ import { Track } from "../../entities";
2
+ import type { AnlzResolver, AnlzResponse, AnlzResponse2EX, AnlzResponseDAT, AnlzResponseEXT, HydrationOptions, HydrationProgress } from './types';
3
+ export type { AnlzResolver, AnlzResponse, AnlzResponse2EX, AnlzResponseDAT, AnlzResponseEXT, HydrationOptions, HydrationProgress, };
4
+ /**
5
+ * Given a rekordbox pdb file contents. This function will hydrate the provided
6
+ * database with all entities from the Rekordbox database. This includes all
7
+ * track metadata, including analyzed metadata (such as beatgrids and waveforms).
8
+ */
9
+ export declare function hydrateDatabase({ pdbData, span, ...options }: HydrationOptions): Promise<void>;
10
+ /**
11
+ * Loads the ANLZ data of a Track entity from the analyzePath.
12
+ */
13
+ export declare function loadAnlz<T extends keyof AnlzResponse>(track: Pick<Track, 'analyzePath'>, type: T, anlzResolver: AnlzResolver): Promise<AnlzResponse[T]>;
@@ -0,0 +1,10 @@
1
+ import { Table } from "../orm";
2
+ /**
3
+ * Maps rekordbox pdb table types to orm table names.
4
+ */
5
+ export declare const pdbTables: Record<number, Table>;
6
+ /**
7
+ * Maps rekordbox pdb table types to functions that create entity objects for
8
+ * the passed pdb row.
9
+ */
10
+ export declare const pdbEntityCreators: Record<number, (row: any) => any>;
@@ -0,0 +1,118 @@
1
+ import { MetadataORM } from "../orm";
2
+ import { BeatGrid, CueAndLoop, ExtendedCue, SongStructure, VocalConfig, Waveform3BandDetail, Waveform3BandPreview, WaveformHD, WaveformPreviewData } from "../../types";
3
+ import { TelemetrySpan as Span } from "../../utils/telemetry";
4
+ /**
5
+ * The provided function should resolve ANLZ files into buffers. Typically
6
+ * you would just read the file, but in the case of the prolink network, this
7
+ * would handle loading the file over NFS.
8
+ */
9
+ export type AnlzResolver = (path: string) => Promise<Buffer>;
10
+ /**
11
+ * Data returned from loading DAT anlz files
12
+ */
13
+ export interface AnlzResponseDAT {
14
+ /**
15
+ * Embedded beat grid information
16
+ */
17
+ beatGrid: BeatGrid | null;
18
+ /**
19
+ * Embedded cue and loop information
20
+ */
21
+ cueAndLoops: CueAndLoop[] | null;
22
+ /**
23
+ * Standard waveform preview (400 bytes, PWAV tag)
24
+ */
25
+ waveformPreview: WaveformPreviewData | null;
26
+ /**
27
+ * Tiny waveform preview (100 bytes, PWV2 tag)
28
+ */
29
+ waveformTiny: WaveformPreviewData | null;
30
+ }
31
+ /**
32
+ * Data returned from loading EXT anlz files
33
+ */
34
+ export interface AnlzResponseEXT {
35
+ /**
36
+ * HD Waveform information (PWV5 tag)
37
+ */
38
+ waveformHd: WaveformHD | null;
39
+ /**
40
+ * Extended cues with colors and comments (PCO2 tag)
41
+ */
42
+ extendedCues: ExtendedCue[] | null;
43
+ /**
44
+ * Song structure / phrase analysis (PSSI tag)
45
+ */
46
+ songStructure: SongStructure | null;
47
+ /**
48
+ * Monochrome detailed waveform (PWV3 tag)
49
+ */
50
+ waveformDetail: Uint8Array | null;
51
+ /**
52
+ * Color waveform preview (PWV4 tag, 7200 bytes = 1200 columns × 6 bytes)
53
+ */
54
+ waveformColorPreview: Uint8Array | null;
55
+ }
56
+ /**
57
+ * Data returned from loading 2EX anlz files
58
+ */
59
+ export interface AnlzResponse2EX {
60
+ /**
61
+ * 3-band color waveform preview (PWV6 tag)
62
+ */
63
+ waveform3BandPreview: Waveform3BandPreview | null;
64
+ /**
65
+ * 3-band color detail waveform (PWV7 tag)
66
+ */
67
+ waveform3BandDetail: Waveform3BandDetail | null;
68
+ /**
69
+ * Vocal detection config (PWVC tag)
70
+ */
71
+ vocalConfig: VocalConfig | null;
72
+ }
73
+ export interface AnlzResponse {
74
+ DAT: AnlzResponseDAT;
75
+ EXT: AnlzResponseEXT;
76
+ '2EX': AnlzResponse2EX;
77
+ }
78
+ /**
79
+ * Details about the current state of the hydtration task
80
+ */
81
+ export interface HydrationProgress {
82
+ /**
83
+ * The specific table that progress is being reported for
84
+ */
85
+ table: string;
86
+ /**
87
+ * The total progress steps for this table
88
+ */
89
+ total: number;
90
+ /**
91
+ * The completed number of progress steps
92
+ */
93
+ complete: number;
94
+ }
95
+ /**
96
+ * Options to hydrate the database
97
+ */
98
+ export interface HydrationOptions {
99
+ /**
100
+ * The metadata ORM of which the tables will be hydrated
101
+ */
102
+ orm: MetadataORM;
103
+ /**
104
+ * This buffer should contain the Rekordbox pdb file contents. It will be
105
+ * used to do the hydration
106
+ */
107
+ pdbData: Buffer;
108
+ /**
109
+ * Sentry tracing span for the parent transaction
110
+ */
111
+ span?: Span;
112
+ /**
113
+ * For larger music collections, it may take some time to load everything,
114
+ * especially when limited by IO. When hydration progresses this function
115
+ * will be called.
116
+ */
117
+ onProgress?: (progress: HydrationProgress) => void;
118
+ }
@@ -1,112 +1,8 @@
1
- import { Track } from "../entities";
2
- import { MetadataORM } from "./orm";
3
- import { BeatGrid, CueAndLoop, ExtendedCue, SongStructure, WaveformHD, WaveformPreviewData } from "../types";
4
- import { TelemetrySpan as Span } from "../utils/telemetry";
5
1
  /**
6
- * The provided function should resolve ANLZ files into buffers. Typically
7
- * you would just read the file, but in the case of the prolink network, this
8
- * would handle loading the file over NFS.
2
+ * Rekordbox Database Utilities
3
+ *
4
+ * Re-exports from the rekordbox/ folder for backward compatibility.
5
+ * @see ./rekordbox/index.ts for the implementation
9
6
  */
10
- type AnlzResolver = (path: string) => Promise<Buffer>;
11
- /**
12
- * Data returned from loading DAT anlz files
13
- */
14
- interface AnlzResponseDAT {
15
- /**
16
- * Embedded beat grid information
17
- */
18
- beatGrid: BeatGrid | null;
19
- /**
20
- * Embedded cue and loop information
21
- */
22
- cueAndLoops: CueAndLoop[] | null;
23
- /**
24
- * Standard waveform preview (400 bytes, PWAV tag)
25
- */
26
- waveformPreview: WaveformPreviewData | null;
27
- /**
28
- * Tiny waveform preview (100 bytes, PWV2 tag)
29
- */
30
- waveformTiny: WaveformPreviewData | null;
31
- }
32
- /**
33
- * Data returned from loading EXT anlz files
34
- */
35
- interface AnlzResponseEXT {
36
- /**
37
- * HD Waveform information (PWV5 tag)
38
- */
39
- waveformHd: WaveformHD | null;
40
- /**
41
- * Extended cues with colors and comments (PCO2 tag)
42
- */
43
- extendedCues: ExtendedCue[] | null;
44
- /**
45
- * Song structure / phrase analysis (PSSI tag)
46
- */
47
- songStructure: SongStructure | null;
48
- /**
49
- * Monochrome detailed waveform (PWV3 tag)
50
- */
51
- waveformDetail: Uint8Array | null;
52
- /**
53
- * Color waveform preview (PWV4 tag, 7200 bytes = 1200 columns × 6 bytes)
54
- */
55
- waveformColorPreview: Uint8Array | null;
56
- }
57
- interface AnlzResponse {
58
- DAT: AnlzResponseDAT;
59
- EXT: AnlzResponseEXT;
60
- }
61
- /**
62
- * Details about the current state of the hydtration task
63
- */
64
- export interface HydrationProgress {
65
- /**
66
- * The specific table that progress is being reported for
67
- */
68
- table: string;
69
- /**
70
- * The total progress steps for this table
71
- */
72
- total: number;
73
- /**
74
- * The completed number of progress steps
75
- */
76
- complete: number;
77
- }
78
- /**
79
- * Options to hydrate the database
80
- */
81
- interface Options {
82
- /**
83
- * The metadata ORM of which the tables will be hydrated
84
- */
85
- orm: MetadataORM;
86
- /**
87
- * This buffer should contain the Rekordbox pdb file contents. It will be
88
- * used to do the hydration
89
- */
90
- pdbData: Buffer;
91
- /**
92
- * Sentry tracing span for the parent transaction
93
- */
94
- span?: Span;
95
- /**
96
- * For larger music collections, it may take some time to load everything,
97
- * especially when limited by IO. When hydration progresses this function
98
- * will be called.
99
- */
100
- onProgress?: (progress: HydrationProgress) => void;
101
- }
102
- /**
103
- * Given a rekordbox pdb file contents. This function will hydrate the provided
104
- * database with all entities from the Rekordbox database. This includes all
105
- * track metadata, including analyzed metadata (such as beatgrids and waveforms).
106
- */
107
- export declare function hydrateDatabase({ pdbData, span, ...options }: Options): Promise<void>;
108
- /**
109
- * Loads the ANLZ data of a Track entity from the analyzePath.
110
- */
111
- export declare function loadAnlz<T extends keyof AnlzResponse>(track: Track, type: T, anlzResolver: AnlzResolver): Promise<AnlzResponse[T]>;
112
- export {};
7
+ export type { AnlzResolver, AnlzResponse, AnlzResponse2EX, AnlzResponseDAT, AnlzResponseEXT, HydrationOptions, HydrationProgress, } from './rekordbox/index';
8
+ export { hydrateDatabase, loadAnlz } from './rekordbox/index';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Logger interface for alphatheta-connect package.
3
+ * Consumers can supply their own logger implementation.
4
+ * If no logger is provided, a no-op logger is used (silent).
5
+ */
6
+ export interface Logger {
7
+ trace(msg: string, ...args: unknown[]): void;
8
+ debug(msg: string, ...args: unknown[]): void;
9
+ info(msg: string, ...args: unknown[]): void;
10
+ warn(msg: string, ...args: unknown[]): void;
11
+ error(msg: string, ...args: unknown[]): void;
12
+ }
13
+ export declare const noopLogger: Logger;
@@ -0,0 +1,45 @@
1
+ import type { ExtractedMetadata, FileReader } from 'metadata-connect';
2
+ import { NfsMediaSlot } from './nfs';
3
+ import { Device } from './types';
4
+ export type { ExtractedMetadata } from 'metadata-connect';
5
+ /**
6
+ * Extract full metadata from an audio file using a FileReader.
7
+ *
8
+ * This is the low-level API that works with any FileReader implementation.
9
+ * For extracting from a Pro DJ Link device, use extractMetadataFromDevice.
10
+ *
11
+ * @param reader - FileReader interface for reading file data
12
+ * @returns Extracted metadata, or null if extraction fails
13
+ */
14
+ export declare function extractFullMetadata(reader: FileReader): Promise<ExtractedMetadata | null>;
15
+ /**
16
+ * Check if metadata extraction is supported for a file extension.
17
+ *
18
+ * @param extension - File extension (with or without leading dot)
19
+ * @returns true if the extension is supported
20
+ */
21
+ export declare function isMetadataExtractionSupported(extension: string): boolean;
22
+ /**
23
+ * Extract full metadata from an audio file on a Pro DJ Link device.
24
+ *
25
+ * This function reads only the necessary bytes from the file header,
26
+ * avoiding the need to transfer entire audio files over the network.
27
+ *
28
+ * @param device - The Pro DJ Link device
29
+ * @param slot - The media slot containing the file (USB, SD, etc.)
30
+ * @param filePath - The file path on the device
31
+ * @returns Extracted metadata, or null if extraction fails
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Extract metadata when a track is loaded
36
+ * const metadata = await extractMetadataFromDevice(device, slot, filePath);
37
+ * if (metadata) {
38
+ * console.log(metadata.title, metadata.artist, metadata.bpm);
39
+ * if (metadata.artwork) {
40
+ * // Display artwork
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ export declare function extractMetadataFromDevice(device: Device, slot: NfsMediaSlot, filePath: string): Promise<ExtractedMetadata | null>;