alphatheta-connect 0.15.0 → 0.18.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.
Files changed (44) 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 +1356 -1352
  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/adapter.d.ts +110 -0
  18. package/lib/localdb/onelibrary/connection.d.ts +8 -0
  19. package/lib/localdb/onelibrary/encryption.d.ts +10 -0
  20. package/lib/localdb/onelibrary/index.d.ts +5 -0
  21. package/lib/localdb/onelibrary/types.d.ts +67 -0
  22. package/lib/localdb/onelibrary.d.ts +3 -181
  23. package/lib/localdb/rekordbox/anlz-parsers.d.ts +37 -0
  24. package/lib/localdb/rekordbox/entity-creators.d.ts +27 -0
  25. package/lib/localdb/rekordbox/hydrator.d.ts +20 -0
  26. package/lib/localdb/rekordbox/index.d.ts +13 -0
  27. package/lib/localdb/rekordbox/table-mappings.d.ts +10 -0
  28. package/lib/localdb/rekordbox/types.d.ts +118 -0
  29. package/lib/localdb/rekordbox.d.ts +6 -110
  30. package/lib/logger.d.ts +13 -0
  31. package/lib/metadata.d.ts +45 -0
  32. package/lib/network.d.ts +25 -0
  33. package/lib/nfs/index.d.ts +35 -10
  34. package/lib/nfs/index.test.d.ts +1 -0
  35. package/lib/nfs/programs.d.ts +10 -1
  36. package/lib/passive/index.d.ts +1 -1
  37. package/lib/passive/remotedb.d.ts +12 -1
  38. package/lib/remotedb/queries.d.ts +2 -2
  39. package/lib/types.d.ts +55 -78
  40. package/lib/types.js +21 -38
  41. package/lib/types.js.map +1 -1
  42. package/lib/utils/index.d.ts +9 -0
  43. package/lib/virtualcdj/index.d.ts +7 -1
  44. package/package.json +23 -2
@@ -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,110 @@
1
+ /**
2
+ * OneLibrary Database Adapter
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
+ import { Album, Artist, Artwork, Color, EntityFK, Genre, Key, Label, Playlist, PlaylistEntry, Track } from "../../entities";
8
+ import { CueAndLoop } from "../../types";
9
+ import { DatabaseAdapter, DatabaseType } from '../database-adapter';
10
+ import type { Category, DeviceProperty, HistorySession, HotCueBankList, MenuItem, MyTag, SortOption } from './types';
11
+ /**
12
+ * Adapter for OneLibrary database that matches the ORM interface.
13
+ * Queries the SQLite file directly instead of hydrating into memory.
14
+ */
15
+ export declare class OneLibraryAdapter implements DatabaseAdapter {
16
+ #private;
17
+ readonly type: DatabaseType;
18
+ constructor(dbPath: string);
19
+ /**
20
+ * Close the database connection
21
+ */
22
+ close(): void;
23
+ /**
24
+ * Find a track by ID
25
+ */
26
+ findTrack(id: number): Track | null;
27
+ /**
28
+ * Find all tracks in the database
29
+ */
30
+ findAllTracks(): Track[];
31
+ /**
32
+ * Find cue points for a track
33
+ */
34
+ findCues(trackId: number): CueAndLoop[];
35
+ /**
36
+ * Find a playlist by ID
37
+ */
38
+ findPlaylistById(playlistId: number): Playlist | null;
39
+ /**
40
+ * Query for a list of {folders, playlists, tracks} given a playlist ID.
41
+ * If no ID is provided the root list is queried.
42
+ */
43
+ findPlaylist(playlistId?: number): {
44
+ folders: Playlist[];
45
+ playlists: Playlist[];
46
+ trackEntries: PlaylistEntry<EntityFK.WithFKs>[];
47
+ };
48
+ /**
49
+ * Get track IDs for a playlist in order
50
+ */
51
+ findPlaylistContents(playlistId: number): number[];
52
+ findArtist(artistId: number): Artist | null;
53
+ findAlbum(albumId: number): Album | null;
54
+ findGenre(genreId: number): Genre | null;
55
+ findKey(keyId: number): Key | null;
56
+ findColor(colorId: number): Color | null;
57
+ findLabel(labelId: number): Label | null;
58
+ findArtwork(imageId: number): Artwork | null;
59
+ /**
60
+ * Find all root-level MyTags (folders and tags with no parent)
61
+ */
62
+ findMyTags(parentId?: number): {
63
+ folders: MyTag[];
64
+ tags: MyTag[];
65
+ };
66
+ /**
67
+ * Find a MyTag by ID
68
+ */
69
+ findMyTagById(myTagId: number): MyTag | null;
70
+ /**
71
+ * Get track IDs for a MyTag
72
+ */
73
+ findMyTagContents(myTagId: number): number[];
74
+ /**
75
+ * Get all MyTags assigned to a track
76
+ */
77
+ findMyTagsForTrack(trackId: number): MyTag[];
78
+ /**
79
+ * Find all history sessions
80
+ */
81
+ findHistorySessions(): HistorySession[];
82
+ /**
83
+ * Get track IDs for a history session in order
84
+ */
85
+ findHistoryContents(historyId: number): number[];
86
+ /**
87
+ * Find all hot cue bank lists
88
+ */
89
+ findHotCueBankLists(): HotCueBankList[];
90
+ /**
91
+ * Get cue IDs for a hot cue bank list
92
+ */
93
+ findHotCueBankListCues(bankListId: number): number[];
94
+ /**
95
+ * Get all menu items (browse categories)
96
+ */
97
+ findMenuItems(): MenuItem[];
98
+ /**
99
+ * Get visible categories with their menu item info
100
+ */
101
+ findVisibleCategories(): Category[];
102
+ /**
103
+ * Get visible sort options
104
+ */
105
+ findVisibleSortOptions(): SortOption[];
106
+ /**
107
+ * Get device properties
108
+ */
109
+ getProperty(): DeviceProperty | null;
110
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * OneLibrary Database Connection
3
+ */
4
+ import Database from 'better-sqlite3-multiple-ciphers';
5
+ /**
6
+ * Open a OneLibrary database with SQLCipher decryption
7
+ */
8
+ export declare function openOneLibraryDb(dbPath: string): Database.Database;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * OneLibrary Database Encryption
3
+ *
4
+ * The database is encrypted with SQLCipher 4. The encryption key is derived from
5
+ * a hardcoded obfuscated blob.
6
+ */
7
+ /**
8
+ * Get the SQLCipher encryption key for OneLibrary databases
9
+ */
10
+ export declare function getEncryptionKey(): string;
@@ -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';
@@ -0,0 +1,67 @@
1
+ /**
2
+ * OneLibrary Entity Types
3
+ */
4
+ /**
5
+ * User-created tag (MyTag)
6
+ */
7
+ export interface MyTag {
8
+ id: number;
9
+ name: string;
10
+ isFolder: boolean;
11
+ parentId: number | null;
12
+ }
13
+ /**
14
+ * History session
15
+ */
16
+ export interface HistorySession {
17
+ id: number;
18
+ name: string;
19
+ parentId: number | null;
20
+ }
21
+ /**
22
+ * Hot cue bank list
23
+ */
24
+ export interface HotCueBankList {
25
+ id: number;
26
+ name: string;
27
+ parentId: number | null;
28
+ }
29
+ /**
30
+ * Menu item for browsing
31
+ */
32
+ export interface MenuItem {
33
+ id: number;
34
+ kind: number;
35
+ name: string;
36
+ }
37
+ /**
38
+ * Browse category
39
+ */
40
+ export interface Category {
41
+ id: number;
42
+ menuItemId: number;
43
+ name: string;
44
+ kind: number;
45
+ isVisible: boolean;
46
+ }
47
+ /**
48
+ * Sort option
49
+ */
50
+ export interface SortOption {
51
+ id: number;
52
+ menuItemId: number;
53
+ name: string;
54
+ kind: number;
55
+ isVisible: boolean;
56
+ isSelectedAsSubColumn: boolean;
57
+ }
58
+ /**
59
+ * Device property
60
+ */
61
+ export interface DeviceProperty {
62
+ deviceName: string;
63
+ dbVersion: string;
64
+ numberOfContents: number;
65
+ createdDate: string;
66
+ backgroundColorType: number;
67
+ }
@@ -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
+ }