alphatheta-connect 0.27.0 → 0.28.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.
@@ -158,8 +158,22 @@ declare const transformItem: {
158
158
  11: (a: ItemData) => {
159
159
  duration: number;
160
160
  };
161
- 47: (_: ItemData) => null;
162
- 42: (_: ItemData) => null;
161
+ 47: (a: ItemData) => {
162
+ parentId: number;
163
+ mainId: number;
164
+ label1: string;
165
+ label2: string;
166
+ type: ItemType;
167
+ artworkId: number;
168
+ };
169
+ 42: (a: ItemData) => {
170
+ parentId: number;
171
+ mainId: number;
172
+ label1: string;
173
+ label2: string;
174
+ type: ItemType;
175
+ artworkId: number;
176
+ };
163
177
  19: (a: ItemData) => {
164
178
  id: number;
165
179
  name: string;
@@ -1,6 +1,6 @@
1
1
  import * as entities from "../entities";
2
2
  import { TelemetrySpan as Span } from "../utils/telemetry";
3
- import { Item, ItemType } from './message/item';
3
+ import { Item, Items, ItemType } from './message/item';
4
4
  import { Connection, LookupDescriptor, Query } from '.';
5
5
  /**
6
6
  * This module contains logic for each type of query to understand what
@@ -19,10 +19,36 @@ type TrackQueryOpts = HandlerOpts<{
19
19
  */
20
20
  trackId: number;
21
21
  }>;
22
+ /**
23
+ * Everything a player sent back for a metadata query, before any of it is
24
+ * mapped onto a Track. Item types the Track has no field for are dropped by
25
+ * that mapping, so this is the only place they can still be seen.
26
+ */
27
+ export interface MetadataResponse {
28
+ /**
29
+ * How many items the player said it would send
30
+ */
31
+ itemsAvailable: number;
32
+ /**
33
+ * The items it sent, in order
34
+ */
35
+ items: Array<Items[ItemType]>;
36
+ }
37
+ type MetadataQueryOpts = HandlerOpts<{
38
+ /**
39
+ * The ID of the track to query for
40
+ */
41
+ trackId: number;
42
+ /**
43
+ * Receives the player's response as it came back, for callers that need to
44
+ * explain a lookup that produced no title or artist
45
+ */
46
+ onResponse?: (response: MetadataResponse) => void;
47
+ }>;
22
48
  /**
23
49
  * Lookup track metadata from rekordbox and coerce it into a Track entity
24
50
  */
25
- declare function getMetadata(opts: TrackQueryOpts): Promise<entities.Track<entities.EntityFK.WithRelations>>;
51
+ declare function getMetadata(opts: MetadataQueryOpts): Promise<entities.Track<entities.EntityFK.WithRelations>>;
26
52
  /**
27
53
  * Lookup generic metadata for an unanalyzed track
28
54
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alphatheta-connect",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "main": "lib/index.js",
5
5
  "author": "Evan Purkhiser <evanpurkhiser@gmail.com>",
6
6
  "contributors": [