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
@@ -37,4 +37,10 @@ export declare const VIRTUAL_CDJ_NAME = "ProLink-Connect";
37
37
  * VirtualCDJFirmware is a string indicating the firmware version reported with
38
38
  * status packets.
39
39
  */
40
- export declare const VIRTUAL_CDJ_FIRMWARE = "1.43";
40
+ export declare const VIRTUAL_CDJ_FIRMWARE = "3.20";
41
+ /**
42
+ * CDJs use device IDs 1-6. Devices outside this range (e.g. Stagehand at 154)
43
+ * should not be queried for media slots or databases as they may crash.
44
+ */
45
+ export declare const MIN_CDJ_DEVICE_ID = 1;
46
+ export declare const MAX_CDJ_DEVICE_ID = 6;
@@ -1,4 +1,5 @@
1
1
  import { Track } from "../entities";
2
+ import { type Logger } from "../logger";
2
3
  import { Device, DeviceID, MediaSlot } from "../types";
3
4
  import { TelemetrySpan as Span } from "../utils/telemetry";
4
5
  export interface Options {
@@ -6,6 +7,7 @@ export interface Options {
6
7
  trackSlot: MediaSlot;
7
8
  track: Track;
8
9
  span?: Span;
10
+ logger?: Logger;
9
11
  }
10
12
  /**
11
13
  * Extract artwork directly from an audio file via NFS.
@@ -1,5 +1,6 @@
1
1
  import { Track } from "../entities";
2
2
  import LocalDatabase from "../localdb";
3
+ import { type Logger } from "../logger";
3
4
  import RemoteDatabase from "../remotedb";
4
5
  import { Device, DeviceID, MediaSlot, TrackType } from "../types";
5
6
  import { TelemetrySpan as Span } from "../utils/telemetry";
@@ -24,6 +25,10 @@ export interface Options {
24
25
  * The Sentry transaction span
25
26
  */
26
27
  span?: Span;
28
+ /**
29
+ * Logger instance for diagnostic output
30
+ */
31
+ logger?: Logger;
27
32
  }
28
- export declare function viaRemote(_remote: RemoteDatabase, _device: Device, _opts: Required<Options>): null;
29
- export declare function viaLocal(local: LocalDatabase, device: Device, opts: Required<Options>): Promise<Buffer<ArrayBuffer> | null>;
33
+ export declare function viaRemote(_remote: RemoteDatabase, _device: Device, _opts: Options): null;
34
+ export declare function viaLocal(local: LocalDatabase, device: Device, opts: Options): Promise<Buffer<ArrayBuffer> | null>;
@@ -1,3 +1,4 @@
1
+ import { Track } from "../entities";
1
2
  import LocalDatabase from "../localdb";
2
3
  import RemoteDatabase from "../remotedb";
3
4
  import { Device, DeviceID, MediaSlot, TrackType } from "../types";
@@ -24,5 +25,5 @@ export interface Options {
24
25
  */
25
26
  span?: Span;
26
27
  }
27
- export declare function viaRemote(remote: RemoteDatabase, opts: Required<Options>): Promise<import("../types").Track<import("..").EntityFK.WithRelations> | null>;
28
- export declare function viaLocal(local: LocalDatabase, device: Device, opts: Required<Options>): Promise<import("../types").Track | null>;
28
+ export declare function viaRemote(remote: RemoteDatabase, opts: Required<Options>): Promise<Track<import("../entities").EntityFK.WithRelations> | null>;
29
+ export declare function viaLocal(local: LocalDatabase, device: Device, opts: Required<Options>): Promise<Track | null>;
@@ -0,0 +1,28 @@
1
+ import { Track } from "../entities";
2
+ import LocalDatabase from "../localdb";
3
+ import { Device, DeviceID, ExtendedCue, MediaSlot, SongStructure, TrackType, VocalConfig, Waveform3BandDetail, Waveform3BandPreview, WaveformHD } from "../types";
4
+ import { TelemetrySpan as Span } from "../utils/telemetry";
5
+ export interface TrackAnalysis {
6
+ /** Extended cues with colors and comments (PCO2 tag) */
7
+ extendedCues: ExtendedCue[] | null;
8
+ /** Song structure / phrase analysis (PSSI tag) */
9
+ songStructure: SongStructure | null;
10
+ /** Color waveform preview (PWV4 tag) */
11
+ waveformColorPreview: Uint8Array | undefined;
12
+ /** HD waveform data (PWV5 tag) */
13
+ waveformHd: WaveformHD | null;
14
+ /** 3-band color waveform preview (PWV6 tag from .2EX) */
15
+ waveform3BandPreview: Waveform3BandPreview | null;
16
+ /** 3-band color detail waveform (PWV7 tag from .2EX) */
17
+ waveform3BandDetail: Waveform3BandDetail | null;
18
+ /** Vocal detection config (PWVC tag from .2EX) */
19
+ vocalConfig: VocalConfig | null;
20
+ }
21
+ export interface Options {
22
+ deviceId: DeviceID;
23
+ trackSlot: MediaSlot;
24
+ trackType: TrackType;
25
+ track: Track;
26
+ span?: Span;
27
+ }
28
+ export declare function viaLocal(local: LocalDatabase, device: Device, opts: Required<Options>): Promise<TrackAnalysis | null>;
package/lib/db/index.d.ts CHANGED
@@ -3,24 +3,19 @@ import { Track } from "../entities";
3
3
  import LocalDatabase from "../localdb";
4
4
  import { DatabaseType } from "../localdb/database-adapter";
5
5
  import RemoteDatabase from "../remotedb";
6
- import { Device, MediaSlot, PlaylistContents, Waveforms } from "../types";
6
+ import { MediaSlot, PlaylistContents, Waveforms } from "../types";
7
7
  import * as GetArtworkFromFile from './getArtworkFromFile';
8
8
  import * as GetArtworkThumbnail from './getArtworkThumbnail';
9
9
  import * as GetMetadata from './getMetadata';
10
10
  import * as GetPlaylist from './getPlaylist';
11
+ import * as GetTrackAnalysis from './getTrackAnalysis';
11
12
  /**
12
13
  * A Database is the central service used to query devices on the prolink
13
14
  * network for information from their databases.
14
15
  */
15
16
  declare class Database {
16
17
  #private;
17
- constructor(hostDevice: Device, local: LocalDatabase, remote: RemoteDatabase, deviceManager: DeviceManager);
18
- /**
19
- * Reports weather or not the CDJs can be communicated to over the remote
20
- * database protocol. This is important when trying to query for unanalyzed or
21
- * compact disc tracks.
22
- */
23
- get cdjSupportsRemotedb(): boolean;
18
+ constructor(local: LocalDatabase, remote: RemoteDatabase, deviceManager: DeviceManager);
24
19
  /**
25
20
  * Get the database type (oneLibrary or pdb) for a loaded device slot.
26
21
  * Returns null if the slot uses remote database or no database is loaded.
@@ -58,6 +53,11 @@ declare class Database {
58
53
  * Retrieves the waveforms for a track on a specific device slot.
59
54
  */
60
55
  getWaveforms(opts: GetArtworkThumbnail.Options): Promise<Waveforms | null>;
56
+ /**
57
+ * Retrieves all analysis data from the EXT file for a track.
58
+ * Returns extended cues, song structure, waveform color preview, and HD waveform.
59
+ */
60
+ getTrackAnalysis(opts: GetTrackAnalysis.Options): Promise<GetTrackAnalysis.TrackAnalysis | null>;
61
61
  /**
62
62
  * Retrieve folders, playlists, and tracks within the playlist tree. The id
63
63
  * may be left undefined to query the root of the playlist tree.
package/lib/entities.d.ts CHANGED
@@ -1,122 +1,24 @@
1
- import { BeatGrid, CueAndLoop, WaveformHD } from "./types";
1
+ import type { BeatGrid, WaveformHD } from "./types";
2
+ import type { Track as OneLibraryTrack } from 'onelibrary-connect';
2
3
  /**
3
- * Documentation type strictly for use with entities that have foreign key
4
- * attributes.
4
+ * Re-export entity types from onelibrary-connect.
5
+ * These types represent what is stored in the rekordbox database.
5
6
  */
6
- export declare enum EntityFK {
7
- WithFKs = 0,
8
- WithRelations = 1
9
- }
10
- export interface Artwork {
11
- id: number;
12
- path?: string;
13
- }
14
- export interface Key {
15
- id: number;
16
- name: string;
17
- }
18
- export interface Label {
19
- id: number;
20
- name: string;
21
- }
22
- export interface Color {
23
- id: number;
24
- name: string;
25
- }
26
- export interface Genre {
27
- id: number;
28
- name: string;
29
- }
30
- export interface Album {
31
- id: number;
32
- name: string;
33
- }
34
- export interface Artist {
35
- id: number;
36
- name: string;
37
- }
38
- export interface Playlist {
39
- id: number;
40
- name: string;
41
- isFolder: boolean;
42
- parentId: number | null;
43
- }
44
- interface PlaylistEntryRelations {
45
- track: Track;
46
- }
47
- interface PlaylistEntryFks {
48
- playlistId: number;
49
- trackId: number;
50
- }
51
- export type PlaylistEntry<withFKs extends EntityFK = EntityFK.WithRelations> = {
52
- id: number;
53
- sortIndex: number;
54
- } & (withFKs extends EntityFK.WithFKs ? PlaylistEntryFks : PlaylistEntryRelations);
55
- interface TrackRelations {
56
- artwork: Artwork | null;
57
- artist: Artist | null;
58
- originalArtist: Artist | null;
59
- remixer: Artist | null;
60
- composer: Artist | null;
61
- album: Album | null;
62
- label: Label | null;
63
- genre: Genre | null;
64
- color: Color | null;
65
- key: Key | null;
66
- }
67
- interface TrackFks {
68
- artworkId?: number;
69
- artistId?: number;
70
- originalArtistId?: number;
71
- remixerId?: number;
72
- composerId?: number;
73
- albumId?: number;
74
- labelId?: number;
75
- genreId?: number;
76
- colorId?: number;
77
- keyId?: number;
78
- }
7
+ export { EntityFK } from 'onelibrary-connect';
8
+ export type { Album, Artist, Artwork, Color, Genre, Key, Label, Playlist, PlaylistEntry, } from 'onelibrary-connect';
79
9
  /**
80
- * Represents a track.
10
+ * Represents a track with both database fields and ANLZ analysis data.
81
11
  *
82
- * Note, fields that are not optional will be set for all database request
83
- * methods.
12
+ * Extends the onelibrary-connect Track type with ANLZ-specific fields
13
+ * that are populated from .DAT/.EXT analysis files on the CDJ.
84
14
  */
85
- export type Track<withFKs extends EntityFK = EntityFK.WithRelations> = {
86
- id: number;
87
- title: string;
88
- duration: number;
89
- bitrate?: number;
90
- tempo: number;
91
- rating: number;
92
- comment: string;
93
- filePath: string;
94
- fileName: string;
95
- trackNumber?: number;
96
- discNumber?: number;
97
- sampleRate?: number;
98
- sampleDepth?: number;
99
- playCount?: number;
100
- year?: number;
101
- mixName?: string;
102
- autoloadHotcues?: boolean;
103
- kuvoPublic?: boolean;
104
- fileSize?: number;
105
- analyzePath?: string;
106
- releaseDate?: string;
107
- analyzeDate?: Date;
108
- dateAdded?: Date;
15
+ export type Track<withFKs extends import('onelibrary-connect').EntityFK = import('onelibrary-connect').EntityFK.WithRelations> = OneLibraryTrack<withFKs> & {
109
16
  /**
110
- * Embedded beat grid information
17
+ * Embedded beat grid information (from ANLZ files)
111
18
  */
112
19
  beatGrid: BeatGrid | null;
113
20
  /**
114
- * Embedded cue and loop information
115
- */
116
- cueAndLoops: CueAndLoop[] | null;
117
- /**
118
- * Embedded HD Waveform information
21
+ * Embedded HD Waveform information (from ANLZ files)
119
22
  */
120
23
  waveformHd: WaveformHD | null;
121
- } & (withFKs extends EntityFK.WithFKs ? TrackFks : TrackRelations);
122
- export {};
24
+ };
package/lib/index.d.ts CHANGED
@@ -5,6 +5,14 @@ export { default as PositionEmitter } from './status/position';
5
5
  export * from './passive';
6
6
  export { extractArtwork, extractArtworkFromDevice, isArtworkExtractionSupported, PictureType, } from './artwork';
7
7
  export type { ExtractedArtwork, FileReader as ArtworkFileReader } from './artwork';
8
- export type { DatabaseAdapter, DatabasePreference, DatabaseType, PlaylistQueryResult, } from './localdb/database-adapter';
9
- export { OneLibraryAdapter } from './localdb/onelibrary';
8
+ export { extractFullMetadata, extractMetadataFromDevice, isMetadataExtractionSupported, } from './metadata';
9
+ export type { ExtractedMetadata } from './metadata';
10
+ export { loadAnlz } from './localdb/rekordbox';
11
+ export { fetchFile } from './nfs';
12
+ export type { AnlzResolver, AnlzResponse, AnlzResponse2EX, AnlzResponseDAT, AnlzResponseEXT } from './localdb/rekordbox';
13
+ export type { DatabaseAdapter, DatabasePreference, DatabaseType, PlaylistQueryResult, } from 'onelibrary-connect';
14
+ export { OneLibraryAdapter } from 'onelibrary-connect';
15
+ export type { Category, DeviceProperty, HistorySession, HotCueBankList, MenuItem, MyTag, SortOption, } from 'onelibrary-connect';
16
+ export { noopLogger } from './logger';
17
+ export type { Logger } from './logger';
10
18
  export * from './types';