vidnavigator 3.0.0 → 3.0.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.
package/README.md CHANGED
@@ -939,7 +939,7 @@ if (usage) {
939
939
  }
940
940
  ```
941
941
 
942
- `service_type` is one of: `standard_request`, `residential_request`, `transcription_hour`, `frame_analysis`, `analysis_request`, `search_request`, `scene_analysis_hour`. LLM token counts (for `/extract/*` and `/youtube/search`) are nested inside the `analysis_request` charge — read them via the `analysis_tokens` accessor rather than expecting flat `total_tokens`. When a charge is waived via a cache-hit sponsorship, the entry carries `waived: true` + `credits_saved`, and the block carries a top-level `waived.credits_saved`.
942
+ `service_type` is one of: `standard_request`, `residential_request`, `transcription_hour`, `frame_analysis`, `analysis_request`, `search_request`, `scene_analysis_hour`. LLM token counts (for `/extract/*` and `/youtube/search`) are nested inside the `analysis_request` charge — read them via the `analysis_tokens` accessor rather than expecting flat `total_tokens`. When a charge is waived, the entry carries `waived: true` + `credits_saved`, and the block carries a top-level `waived.credits_saved`.
943
943
 
944
944
  ---
945
945
 
@@ -1151,6 +1151,10 @@ All API responses are parsed into typed classes with static `fromJSON()` constru
1151
1151
  | `TikTokLiveRoomDetail` | A `TikTokLiveRoom` from `getTikTokLiveRoom`: `status` / `isLive`, `ended_at`, `stats.new_followers`, `author.bio`, `share_url`, `chat_enabled`, `subscribers_only`, `products` |
1152
1152
  | `TweetStatement` | Structured X/Twitter claim analysis, topics, entities, tone, intent, and source text; with `include_scenes`, `frames_analyzed` and `scenes_error` |
1153
1153
 
1154
+ ## What's new in 3.0.1
1155
+
1156
+ - **`people`, `places` and `key_subjects` of search results can be read with `.name`.** The API sends them as lists of names (`["Sam Altman"]`), while the types promised objects, so `result.people[0].name` was `undefined`. `VideoSearchResult` and `FileSearchResult` now turn each name into `{ name }`, as the Python SDK does.
1157
+
1154
1158
  ## What's new in 3.0.0
1155
1159
 
1156
1160
  **Breaking:** the analysis methods are removed, with the API endpoints they called. Ask the same questions with extraction, `extractVideoData()` / `vn.extractVideo()` for an online video and `extractFileData()` for an uploaded file, with `what_to_extract` in plain words and/or a JSON Schema. `include_scenes` works there too, and each value comes with the moments of the video it was taken from (`evidence`).
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export * from './webhooks';
7
7
  export { Job } from './jobs';
8
8
  export type { TaskStatus, PollableTask, PollOptions, JobOperation, SubmitOptions, RunOptions, JobInfo } from './jobs';
9
9
  /** SDK version (keep in sync with package.json) */
10
- export declare const SDK_VERSION = "3.0.0";
10
+ export declare const SDK_VERSION = "3.0.1";
11
11
  export interface SDKConfig {
12
12
  apiKey: string;
13
13
  baseURL?: string;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ __exportStar(require("./webhooks"), exports);
31
31
  var jobs_2 = require("./jobs");
32
32
  Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return jobs_2.Job; } });
33
33
  /** SDK version (keep in sync with package.json) */
34
- exports.SDK_VERSION = '3.0.0';
34
+ exports.SDK_VERSION = '3.0.1';
35
35
  /**
36
36
  * A LIVE room usually answers in 1-5 s, up to ~30 s when the API has to open a TikTok page, and two
37
37
  * minutes at worst. A shorter configured axios timeout is raised to this for that call only.
@@ -1,6 +1,6 @@
1
1
  import { FileInfo, FileInfoJSON } from './FileInfo';
2
2
  import { VideoInfo, VideoInfoJSON } from './VideoInfo';
3
- /** A person or a place a search result mentions, with the context it appears in. */
3
+ /** A person or a place a search result mentions. */
4
4
  export interface NamedEntity {
5
5
  name?: string;
6
6
  context?: string;
@@ -14,18 +14,20 @@ export interface BaseSearchResult {
14
14
  transcript_summary?: string;
15
15
  }
16
16
  export interface VideoSearchResultJSON extends VideoInfoJSON, BaseSearchResult {
17
- people?: NamedEntity[];
18
- places?: NamedEntity[];
19
- key_subjects?: SearchKeySubject[];
17
+ /** Names, as the API sends them. */
18
+ people?: Array<string | NamedEntity>;
19
+ places?: Array<string | NamedEntity>;
20
+ key_subjects?: Array<string | SearchKeySubject>;
20
21
  timestamp?: number;
21
22
  relevant_text?: string;
22
23
  query_relevance?: string;
23
24
  }
24
25
  export interface FileSearchResultJSON extends FileInfoJSON, BaseSearchResult {
25
26
  file_url?: string;
26
- people?: NamedEntity[];
27
- places?: NamedEntity[];
28
- key_subjects?: SearchKeySubject[];
27
+ /** Names, as the API sends them. */
28
+ people?: Array<string | NamedEntity>;
29
+ places?: Array<string | NamedEntity>;
30
+ key_subjects?: Array<string | SearchKeySubject>;
29
31
  timestamps?: number[];
30
32
  relevant_text?: string;
31
33
  query_answer?: string;
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileSearchResult = exports.VideoSearchResult = void 0;
4
4
  const FileInfo_1 = require("./FileInfo");
5
5
  const VideoInfo_1 = require("./VideoInfo");
6
+ /**
7
+ * The API sends `people`, `places` and `key_subjects` as lists of names
8
+ * (`["Sam Altman"]`). Each name is turned into `{ name }`, so `.name` reads the
9
+ * same whatever the API sent; an entry that is already an object is kept.
10
+ */
11
+ function toNamed(values) {
12
+ if (!Array.isArray(values))
13
+ return undefined;
14
+ return values.map((value) => (typeof value === 'string' ? { name: value } : value));
15
+ }
6
16
  /**
7
17
  * Represents a single video result from a search query.
8
18
  */
@@ -11,9 +21,9 @@ class VideoSearchResult extends VideoInfo_1.VideoInfo {
11
21
  super(data);
12
22
  this.relevance_score = data.relevance_score;
13
23
  this.transcript_summary = data.transcript_summary;
14
- this.people = data.people;
15
- this.places = data.places;
16
- this.key_subjects = data.key_subjects;
24
+ this.people = toNamed(data.people);
25
+ this.places = toNamed(data.places);
26
+ this.key_subjects = toNamed(data.key_subjects);
17
27
  this.timestamp = data.timestamp;
18
28
  this.relevant_text = data.relevant_text;
19
29
  this.query_relevance = data.query_relevance;
@@ -32,9 +42,9 @@ class FileSearchResult extends FileInfo_1.FileInfo {
32
42
  this.relevance_score = data.relevance_score;
33
43
  this.transcript_summary = data.transcript_summary;
34
44
  this.file_url = data.file_url;
35
- this.people = data.people;
36
- this.places = data.places;
37
- this.key_subjects = data.key_subjects;
45
+ this.people = toNamed(data.people);
46
+ this.places = toNamed(data.places);
47
+ this.key_subjects = toNamed(data.key_subjects);
38
48
  this.timestamps = data.timestamps;
39
49
  this.relevant_text = data.relevant_text;
40
50
  this.query_answer = data.query_answer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidnavigator",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Official JavaScript SDK for the VidNavigator Developer API",
5
5
  "author": "VidNavigator",
6
6
  "license": "Apache-2.0",
package/src/index.ts CHANGED
@@ -71,7 +71,7 @@ export { Job } from './jobs';
71
71
  export type { TaskStatus, PollableTask, PollOptions, JobOperation, SubmitOptions, RunOptions, JobInfo } from './jobs';
72
72
 
73
73
  /** SDK version (keep in sync with package.json) */
74
- export const SDK_VERSION = '3.0.0';
74
+ export const SDK_VERSION = '3.0.1';
75
75
 
76
76
  /**
77
77
  * A LIVE room usually answers in 1-5 s, up to ~30 s when the API has to open a TikTok page, and two
@@ -1,7 +1,7 @@
1
1
  import { FileInfo, FileInfoJSON } from './FileInfo';
2
2
  import { VideoInfo, VideoInfoJSON } from './VideoInfo';
3
3
 
4
- /** A person or a place a search result mentions, with the context it appears in. */
4
+ /** A person or a place a search result mentions. */
5
5
  export interface NamedEntity {
6
6
  name?: string;
7
7
  context?: string;
@@ -17,10 +17,21 @@ export interface BaseSearchResult {
17
17
  transcript_summary?: string;
18
18
  }
19
19
 
20
+ /**
21
+ * The API sends `people`, `places` and `key_subjects` as lists of names
22
+ * (`["Sam Altman"]`). Each name is turned into `{ name }`, so `.name` reads the
23
+ * same whatever the API sent; an entry that is already an object is kept.
24
+ */
25
+ function toNamed<T extends { name?: string }>(values?: Array<T | string> | null): T[] | undefined {
26
+ if (!Array.isArray(values)) return undefined;
27
+ return values.map((value) => (typeof value === 'string' ? ({ name: value } as T) : value));
28
+ }
29
+
20
30
  export interface VideoSearchResultJSON extends VideoInfoJSON, BaseSearchResult {
21
- people?: NamedEntity[];
22
- places?: NamedEntity[];
23
- key_subjects?: SearchKeySubject[];
31
+ /** Names, as the API sends them. */
32
+ people?: Array<string | NamedEntity>;
33
+ places?: Array<string | NamedEntity>;
34
+ key_subjects?: Array<string | SearchKeySubject>;
24
35
  timestamp?: number;
25
36
  relevant_text?: string;
26
37
  query_relevance?: string;
@@ -28,9 +39,10 @@ export interface VideoSearchResultJSON extends VideoInfoJSON, BaseSearchResult {
28
39
 
29
40
  export interface FileSearchResultJSON extends FileInfoJSON, BaseSearchResult {
30
41
  file_url?: string;
31
- people?: NamedEntity[];
32
- places?: NamedEntity[];
33
- key_subjects?: SearchKeySubject[];
42
+ /** Names, as the API sends them. */
43
+ people?: Array<string | NamedEntity>;
44
+ places?: Array<string | NamedEntity>;
45
+ key_subjects?: Array<string | SearchKeySubject>;
34
46
  timestamps?: number[];
35
47
  relevant_text?: string;
36
48
  query_answer?: string;
@@ -53,9 +65,9 @@ export class VideoSearchResult extends VideoInfo implements BaseSearchResult {
53
65
  super(data);
54
66
  this.relevance_score = data.relevance_score;
55
67
  this.transcript_summary = data.transcript_summary;
56
- this.people = data.people;
57
- this.places = data.places;
58
- this.key_subjects = data.key_subjects;
68
+ this.people = toNamed<NamedEntity>(data.people);
69
+ this.places = toNamed<NamedEntity>(data.places);
70
+ this.key_subjects = toNamed<SearchKeySubject>(data.key_subjects);
59
71
  this.timestamp = data.timestamp;
60
72
  this.relevant_text = data.relevant_text;
61
73
  this.query_relevance = data.query_relevance;
@@ -85,9 +97,9 @@ export class FileSearchResult extends FileInfo implements BaseSearchResult {
85
97
  this.relevance_score = data.relevance_score;
86
98
  this.transcript_summary = data.transcript_summary;
87
99
  this.file_url = data.file_url;
88
- this.people = data.people;
89
- this.places = data.places;
90
- this.key_subjects = data.key_subjects;
100
+ this.people = toNamed<NamedEntity>(data.people);
101
+ this.places = toNamed<NamedEntity>(data.places);
102
+ this.key_subjects = toNamed<SearchKeySubject>(data.key_subjects);
91
103
  this.timestamps = data.timestamps;
92
104
  this.relevant_text = data.relevant_text;
93
105
  this.query_answer = data.query_answer;
@@ -96,4 +108,4 @@ export class FileSearchResult extends FileInfo implements BaseSearchResult {
96
108
  static fromJSON(json: FileSearchResultJSON): FileSearchResult {
97
109
  return new FileSearchResult(json);
98
110
  }
99
- }
111
+ }