@sorisdk/matcher 0.5.1 → 0.6.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.
package/README.md CHANGED
@@ -72,7 +72,9 @@ If you want campaign events and browser recognition flow on top of matching, use
72
72
  ## Metadata lookup
73
73
 
74
74
  Audiopack footer metadata is available through explicit lookup rather than being
75
- embedded in `MatchResult`.
75
+ embedded in `MatchResult`. Segment timing is the exception: when a pack provides
76
+ valid `matcherSegments` metadata, `MatchResult.position` is segment-local and
77
+ `MatchResult.durationMillis` contains the matched segment duration.
76
78
 
77
79
  ```ts
78
80
  const best = await session.bestMatch(queryBytes);
Binary file
package/dist/index.d.ts CHANGED
@@ -98,6 +98,7 @@ interface MatchResult {
98
98
  name: string;
99
99
  score: number;
100
100
  position: number;
101
+ durationMillis?: number;
101
102
  afpType: AudioFingerprintType;
102
103
  }
103
104
  interface VariantMatch {
package/dist/index.js CHANGED
@@ -511,12 +511,17 @@ var WrappedMatcher = class {
511
511
  };
512
512
  function normalizeResult(raw) {
513
513
  const afpType = Number(raw.afpType ?? raw.afp_type);
514
- return {
514
+ const durationMillis = raw.durationMillis ?? raw.duration_millis;
515
+ const result = {
515
516
  name: String(raw.name),
516
517
  score: Number(raw.score),
517
518
  position: Number(raw.position),
518
519
  afpType
519
520
  };
521
+ if (durationMillis != null) {
522
+ result.durationMillis = Number(durationMillis);
523
+ }
524
+ return result;
520
525
  }
521
526
  function normalizeVariantMatch(raw) {
522
527
  const rawMatch = raw.matchResult ?? raw.match;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sorisdk/matcher",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Browser WASM SDK for audio fingerprint matching",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",