@disconnectme/lightbox-sdk 0.1.2 → 0.1.4

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/dist/index.cjs CHANGED
@@ -50,7 +50,7 @@ var LightboxClient = class {
50
50
  apiKey;
51
51
  constructor(config) {
52
52
  this.apiKey = config.apiKey;
53
- this.baseUrl = config.baseUrl ?? "https://api.datafin.ai";
53
+ this.baseUrl = config.baseUrl ?? "https://api.lightbox.dev";
54
54
  }
55
55
  async request(path, params) {
56
56
  const url = new URL(path, this.baseUrl);
@@ -93,6 +93,37 @@ var LightboxClient = class {
93
93
  */
94
94
  get: (hash, params) => {
95
95
  return this.request(`/v1/files/${hash}`, params);
96
+ },
97
+ /**
98
+ * Resolve a signed download URL for a file path.
99
+ * Returns the signed URL and its expiration timestamp.
100
+ */
101
+ download: async (params) => {
102
+ const url = new URL("/v1/files/download", this.baseUrl);
103
+ url.searchParams.set("bundle", params.bundle);
104
+ url.searchParams.set("version", params.version);
105
+ url.searchParams.set("file_path", params.file_path);
106
+ const response = await fetch(url.toString(), {
107
+ headers: {
108
+ Authorization: `Bearer ${this.apiKey}`
109
+ },
110
+ redirect: "manual"
111
+ });
112
+ if (response.status === 302) {
113
+ const location = response.headers.get("Location");
114
+ if (!location) {
115
+ throw new Error("Missing Location header on download redirect");
116
+ }
117
+ return {
118
+ download_url: location,
119
+ expires_at: response.headers.get("X-Download-Expires-At")
120
+ };
121
+ }
122
+ const data = await response.json();
123
+ if (!response.ok) {
124
+ throw LightboxError.fromAPIError(data);
125
+ }
126
+ throw new Error("Unexpected response from download endpoint");
96
127
  }
97
128
  };
98
129
  /**
@@ -216,6 +247,48 @@ var LightboxClient = class {
216
247
  params
217
248
  );
218
249
  }
250
+ },
251
+ /**
252
+ * JavaScript API symbol tracking methods
253
+ */
254
+ javascript: {
255
+ /**
256
+ * Get the catalog of all JavaScript symbols available for querying.
257
+ * This is a static list of browser APIs monitored during web crawls.
258
+ */
259
+ catalog: (params) => {
260
+ return this.request(
261
+ "/v1/web/javascript/symbols",
262
+ params
263
+ );
264
+ },
265
+ /**
266
+ * Get all scripts that access a specific JavaScript API symbol.
267
+ */
268
+ symbols: (symbol, params) => {
269
+ return this.request(
270
+ `/v1/web/javascript/symbols/${encodeURIComponent(symbol)}`,
271
+ params
272
+ );
273
+ },
274
+ /**
275
+ * Get JavaScript API accesses by scripts from a specific domain.
276
+ */
277
+ scripts: (domain, params) => {
278
+ return this.request(
279
+ `/v1/web/javascript/scripts/${encodeURIComponent(domain)}`,
280
+ params
281
+ );
282
+ },
283
+ /**
284
+ * Get JavaScript API accesses observed when visiting a specific site.
285
+ */
286
+ sites: (site, params) => {
287
+ return this.request(
288
+ `/v1/web/javascript/sites/${encodeURIComponent(site)}`,
289
+ params
290
+ );
291
+ }
219
292
  }
220
293
  };
221
294
  };
package/dist/index.d.cts CHANGED
@@ -37,7 +37,6 @@ interface FileSearchResult {
37
37
  file_path: string | null;
38
38
  file_size_bytes: number;
39
39
  download_url: string | null;
40
- expires_at: string | null;
41
40
  }
42
41
  interface FileHashResult {
43
42
  bundle: string;
@@ -48,6 +47,9 @@ interface FileHashResult {
48
47
  file_path: string | null;
49
48
  file_size: number;
50
49
  download_url: string | null;
50
+ }
51
+ interface FileDownloadResult {
52
+ download_url: string;
51
53
  expires_at: string | null;
52
54
  }
53
55
  interface FileSearchData {
@@ -122,7 +124,6 @@ interface AppFile {
122
124
  file_path: string | null;
123
125
  file_size_bytes: number;
124
126
  download_url: string | null;
125
- expires_at: string | null;
126
127
  }
127
128
  interface AppSearchData {
128
129
  type: "app_collection";
@@ -201,6 +202,11 @@ interface FileSearchParams extends PaginationParams {
201
202
  min_size?: number;
202
203
  max_size?: number;
203
204
  }
205
+ interface FileDownloadParams {
206
+ bundle: string;
207
+ version: string;
208
+ file_path: string;
209
+ }
204
210
  interface AppSearchParams extends PaginationParams {
205
211
  framework?: string;
206
212
  entitlement?: string;
@@ -281,6 +287,53 @@ interface MetadataSearchParams extends PaginationParams {
281
287
  search?: string;
282
288
  sort?: "popularity" | "name";
283
289
  }
290
+ type JavaScriptSymbolCategory = "canvas" | "audio" | "webrtc" | "navigator" | "screen" | "storage" | "cookie" | "referrer";
291
+ interface JavaScriptSymbolCatalogItem {
292
+ symbol: string;
293
+ category: JavaScriptSymbolCategory;
294
+ description: string;
295
+ }
296
+ interface JavaScriptSymbolCatalogData {
297
+ type: "javascript_symbol_catalog";
298
+ total_symbols: number;
299
+ categories: string[];
300
+ note: string;
301
+ symbols: JavaScriptSymbolCatalogItem[];
302
+ }
303
+ interface JavaScriptSymbolObservation {
304
+ id: string;
305
+ script_etld1: string;
306
+ site_etld1: string;
307
+ script_url: string;
308
+ symbol: string;
309
+ symbol_category: string;
310
+ operation: string | null;
311
+ arguments: string | null;
312
+ value: string | null;
313
+ timestamp: string;
314
+ }
315
+ interface JavaScriptSymbolCollectionData {
316
+ type: "javascript_symbol_collection";
317
+ summary: {
318
+ returned: number;
319
+ };
320
+ symbols: JavaScriptSymbolObservation[];
321
+ }
322
+ interface JavaScriptCatalogParams {
323
+ category?: JavaScriptSymbolCategory;
324
+ }
325
+ interface JavaScriptSymbolParams extends PaginationParams {
326
+ }
327
+ interface JavaScriptScriptsParams extends PaginationParams {
328
+ symbol?: string;
329
+ category?: JavaScriptSymbolCategory;
330
+ }
331
+ interface JavaScriptSitesParams extends PaginationParams {
332
+ symbol?: string;
333
+ category?: JavaScriptSymbolCategory;
334
+ }
335
+ type JavaScriptCatalogResponse = APIResponse<JavaScriptSymbolCatalogData>;
336
+ type JavaScriptSymbolCollectionResponse = APIResponse<JavaScriptSymbolCollectionData>;
284
337
  type FileSearchResponse = APIResponse<FileSearchData>;
285
338
  type FileHashResponse = APIResponse<FileHashData>;
286
339
  type AppSearchResponse = APIResponse<AppSearchData>;
@@ -324,6 +377,11 @@ declare class LightboxClient {
324
377
  * Returns the apps containing this file and download URLs.
325
378
  */
326
379
  get: (hash: string, params?: PaginationParams) => Promise<FileHashResponse>;
380
+ /**
381
+ * Resolve a signed download URL for a file path.
382
+ * Returns the signed URL and its expiration timestamp.
383
+ */
384
+ download: (params: FileDownloadParams) => Promise<FileDownloadResult>;
327
385
  };
328
386
  /**
329
387
  * App-related API methods (iOS apps)
@@ -401,7 +459,29 @@ declare class LightboxClient {
401
459
  */
402
460
  cookies: (domain: string, params?: WebDomainCookiesParams) => Promise<WebCookieCollectionResponse>;
403
461
  };
462
+ /**
463
+ * JavaScript API symbol tracking methods
464
+ */
465
+ javascript: {
466
+ /**
467
+ * Get the catalog of all JavaScript symbols available for querying.
468
+ * This is a static list of browser APIs monitored during web crawls.
469
+ */
470
+ catalog: (params?: JavaScriptCatalogParams) => Promise<JavaScriptCatalogResponse>;
471
+ /**
472
+ * Get all scripts that access a specific JavaScript API symbol.
473
+ */
474
+ symbols: (symbol: string, params?: JavaScriptSymbolParams) => Promise<JavaScriptSymbolCollectionResponse>;
475
+ /**
476
+ * Get JavaScript API accesses by scripts from a specific domain.
477
+ */
478
+ scripts: (domain: string, params?: JavaScriptScriptsParams) => Promise<JavaScriptSymbolCollectionResponse>;
479
+ /**
480
+ * Get JavaScript API accesses observed when visiting a specific site.
481
+ */
482
+ sites: (site: string, params?: JavaScriptSitesParams) => Promise<JavaScriptSymbolCollectionResponse>;
483
+ };
404
484
  };
405
485
  }
406
486
 
407
- export { type APIError, type APIMetadata, type APIResponse, type AppFile, type AppFilesData, type AppFilesParams, type AppFilesResponse, type AppGetParams, type AppProfile, type AppProfileData, type AppProfileResponse, type AppSearchData, type AppSearchParams, type AppSearchResponse, type AppSummary, type AppVersion, type AppVersionsData, type AppVersionsResponse, type EntitlementItem, type EntitlementListData, type EntitlementListResponse, type FileHashData, type FileHashResponse, type FileHashResult, type FileSearchData, type FileSearchParams, type FileSearchResponse, type FileSearchResult, type FrameworkItem, type FrameworkListData, type FrameworkListResponse, type GenreItem, type GenreListData, type GenreListResponse, LightboxClient, type LightboxClientConfig, LightboxError, type MetadataSearchParams, type Pagination, type PaginationParams, type ScopeMode, type WebCookie, type WebCookieCollectionData, type WebCookieCollectionResponse, type WebDomainCookiesParams, type WebDomainRequestsParams, type WebRequest, type WebRequestCollectionData, type WebRequestCollectionResponse, type WebSiteCookiesParams, type WebSiteRequestsParams };
487
+ export { type APIError, type APIMetadata, type APIResponse, type AppFile, type AppFilesData, type AppFilesParams, type AppFilesResponse, type AppGetParams, type AppProfile, type AppProfileData, type AppProfileResponse, type AppSearchData, type AppSearchParams, type AppSearchResponse, type AppSummary, type AppVersion, type AppVersionsData, type AppVersionsResponse, type EntitlementItem, type EntitlementListData, type EntitlementListResponse, type FileDownloadParams, type FileDownloadResult, type FileHashData, type FileHashResponse, type FileHashResult, type FileSearchData, type FileSearchParams, type FileSearchResponse, type FileSearchResult, type FrameworkItem, type FrameworkListData, type FrameworkListResponse, type GenreItem, type GenreListData, type GenreListResponse, type JavaScriptCatalogParams, type JavaScriptCatalogResponse, type JavaScriptScriptsParams, type JavaScriptSitesParams, type JavaScriptSymbolCatalogData, type JavaScriptSymbolCatalogItem, type JavaScriptSymbolCategory, type JavaScriptSymbolCollectionData, type JavaScriptSymbolCollectionResponse, type JavaScriptSymbolObservation, type JavaScriptSymbolParams, LightboxClient, type LightboxClientConfig, LightboxError, type MetadataSearchParams, type Pagination, type PaginationParams, type ScopeMode, type WebCookie, type WebCookieCollectionData, type WebCookieCollectionResponse, type WebDomainCookiesParams, type WebDomainRequestsParams, type WebRequest, type WebRequestCollectionData, type WebRequestCollectionResponse, type WebSiteCookiesParams, type WebSiteRequestsParams };
package/dist/index.d.ts CHANGED
@@ -37,7 +37,6 @@ interface FileSearchResult {
37
37
  file_path: string | null;
38
38
  file_size_bytes: number;
39
39
  download_url: string | null;
40
- expires_at: string | null;
41
40
  }
42
41
  interface FileHashResult {
43
42
  bundle: string;
@@ -48,6 +47,9 @@ interface FileHashResult {
48
47
  file_path: string | null;
49
48
  file_size: number;
50
49
  download_url: string | null;
50
+ }
51
+ interface FileDownloadResult {
52
+ download_url: string;
51
53
  expires_at: string | null;
52
54
  }
53
55
  interface FileSearchData {
@@ -122,7 +124,6 @@ interface AppFile {
122
124
  file_path: string | null;
123
125
  file_size_bytes: number;
124
126
  download_url: string | null;
125
- expires_at: string | null;
126
127
  }
127
128
  interface AppSearchData {
128
129
  type: "app_collection";
@@ -201,6 +202,11 @@ interface FileSearchParams extends PaginationParams {
201
202
  min_size?: number;
202
203
  max_size?: number;
203
204
  }
205
+ interface FileDownloadParams {
206
+ bundle: string;
207
+ version: string;
208
+ file_path: string;
209
+ }
204
210
  interface AppSearchParams extends PaginationParams {
205
211
  framework?: string;
206
212
  entitlement?: string;
@@ -281,6 +287,53 @@ interface MetadataSearchParams extends PaginationParams {
281
287
  search?: string;
282
288
  sort?: "popularity" | "name";
283
289
  }
290
+ type JavaScriptSymbolCategory = "canvas" | "audio" | "webrtc" | "navigator" | "screen" | "storage" | "cookie" | "referrer";
291
+ interface JavaScriptSymbolCatalogItem {
292
+ symbol: string;
293
+ category: JavaScriptSymbolCategory;
294
+ description: string;
295
+ }
296
+ interface JavaScriptSymbolCatalogData {
297
+ type: "javascript_symbol_catalog";
298
+ total_symbols: number;
299
+ categories: string[];
300
+ note: string;
301
+ symbols: JavaScriptSymbolCatalogItem[];
302
+ }
303
+ interface JavaScriptSymbolObservation {
304
+ id: string;
305
+ script_etld1: string;
306
+ site_etld1: string;
307
+ script_url: string;
308
+ symbol: string;
309
+ symbol_category: string;
310
+ operation: string | null;
311
+ arguments: string | null;
312
+ value: string | null;
313
+ timestamp: string;
314
+ }
315
+ interface JavaScriptSymbolCollectionData {
316
+ type: "javascript_symbol_collection";
317
+ summary: {
318
+ returned: number;
319
+ };
320
+ symbols: JavaScriptSymbolObservation[];
321
+ }
322
+ interface JavaScriptCatalogParams {
323
+ category?: JavaScriptSymbolCategory;
324
+ }
325
+ interface JavaScriptSymbolParams extends PaginationParams {
326
+ }
327
+ interface JavaScriptScriptsParams extends PaginationParams {
328
+ symbol?: string;
329
+ category?: JavaScriptSymbolCategory;
330
+ }
331
+ interface JavaScriptSitesParams extends PaginationParams {
332
+ symbol?: string;
333
+ category?: JavaScriptSymbolCategory;
334
+ }
335
+ type JavaScriptCatalogResponse = APIResponse<JavaScriptSymbolCatalogData>;
336
+ type JavaScriptSymbolCollectionResponse = APIResponse<JavaScriptSymbolCollectionData>;
284
337
  type FileSearchResponse = APIResponse<FileSearchData>;
285
338
  type FileHashResponse = APIResponse<FileHashData>;
286
339
  type AppSearchResponse = APIResponse<AppSearchData>;
@@ -324,6 +377,11 @@ declare class LightboxClient {
324
377
  * Returns the apps containing this file and download URLs.
325
378
  */
326
379
  get: (hash: string, params?: PaginationParams) => Promise<FileHashResponse>;
380
+ /**
381
+ * Resolve a signed download URL for a file path.
382
+ * Returns the signed URL and its expiration timestamp.
383
+ */
384
+ download: (params: FileDownloadParams) => Promise<FileDownloadResult>;
327
385
  };
328
386
  /**
329
387
  * App-related API methods (iOS apps)
@@ -401,7 +459,29 @@ declare class LightboxClient {
401
459
  */
402
460
  cookies: (domain: string, params?: WebDomainCookiesParams) => Promise<WebCookieCollectionResponse>;
403
461
  };
462
+ /**
463
+ * JavaScript API symbol tracking methods
464
+ */
465
+ javascript: {
466
+ /**
467
+ * Get the catalog of all JavaScript symbols available for querying.
468
+ * This is a static list of browser APIs monitored during web crawls.
469
+ */
470
+ catalog: (params?: JavaScriptCatalogParams) => Promise<JavaScriptCatalogResponse>;
471
+ /**
472
+ * Get all scripts that access a specific JavaScript API symbol.
473
+ */
474
+ symbols: (symbol: string, params?: JavaScriptSymbolParams) => Promise<JavaScriptSymbolCollectionResponse>;
475
+ /**
476
+ * Get JavaScript API accesses by scripts from a specific domain.
477
+ */
478
+ scripts: (domain: string, params?: JavaScriptScriptsParams) => Promise<JavaScriptSymbolCollectionResponse>;
479
+ /**
480
+ * Get JavaScript API accesses observed when visiting a specific site.
481
+ */
482
+ sites: (site: string, params?: JavaScriptSitesParams) => Promise<JavaScriptSymbolCollectionResponse>;
483
+ };
404
484
  };
405
485
  }
406
486
 
407
- export { type APIError, type APIMetadata, type APIResponse, type AppFile, type AppFilesData, type AppFilesParams, type AppFilesResponse, type AppGetParams, type AppProfile, type AppProfileData, type AppProfileResponse, type AppSearchData, type AppSearchParams, type AppSearchResponse, type AppSummary, type AppVersion, type AppVersionsData, type AppVersionsResponse, type EntitlementItem, type EntitlementListData, type EntitlementListResponse, type FileHashData, type FileHashResponse, type FileHashResult, type FileSearchData, type FileSearchParams, type FileSearchResponse, type FileSearchResult, type FrameworkItem, type FrameworkListData, type FrameworkListResponse, type GenreItem, type GenreListData, type GenreListResponse, LightboxClient, type LightboxClientConfig, LightboxError, type MetadataSearchParams, type Pagination, type PaginationParams, type ScopeMode, type WebCookie, type WebCookieCollectionData, type WebCookieCollectionResponse, type WebDomainCookiesParams, type WebDomainRequestsParams, type WebRequest, type WebRequestCollectionData, type WebRequestCollectionResponse, type WebSiteCookiesParams, type WebSiteRequestsParams };
487
+ export { type APIError, type APIMetadata, type APIResponse, type AppFile, type AppFilesData, type AppFilesParams, type AppFilesResponse, type AppGetParams, type AppProfile, type AppProfileData, type AppProfileResponse, type AppSearchData, type AppSearchParams, type AppSearchResponse, type AppSummary, type AppVersion, type AppVersionsData, type AppVersionsResponse, type EntitlementItem, type EntitlementListData, type EntitlementListResponse, type FileDownloadParams, type FileDownloadResult, type FileHashData, type FileHashResponse, type FileHashResult, type FileSearchData, type FileSearchParams, type FileSearchResponse, type FileSearchResult, type FrameworkItem, type FrameworkListData, type FrameworkListResponse, type GenreItem, type GenreListData, type GenreListResponse, type JavaScriptCatalogParams, type JavaScriptCatalogResponse, type JavaScriptScriptsParams, type JavaScriptSitesParams, type JavaScriptSymbolCatalogData, type JavaScriptSymbolCatalogItem, type JavaScriptSymbolCategory, type JavaScriptSymbolCollectionData, type JavaScriptSymbolCollectionResponse, type JavaScriptSymbolObservation, type JavaScriptSymbolParams, LightboxClient, type LightboxClientConfig, LightboxError, type MetadataSearchParams, type Pagination, type PaginationParams, type ScopeMode, type WebCookie, type WebCookieCollectionData, type WebCookieCollectionResponse, type WebDomainCookiesParams, type WebDomainRequestsParams, type WebRequest, type WebRequestCollectionData, type WebRequestCollectionResponse, type WebSiteCookiesParams, type WebSiteRequestsParams };
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ var LightboxClient = class {
23
23
  apiKey;
24
24
  constructor(config) {
25
25
  this.apiKey = config.apiKey;
26
- this.baseUrl = config.baseUrl ?? "https://api.datafin.ai";
26
+ this.baseUrl = config.baseUrl ?? "https://api.lightbox.dev";
27
27
  }
28
28
  async request(path, params) {
29
29
  const url = new URL(path, this.baseUrl);
@@ -66,6 +66,37 @@ var LightboxClient = class {
66
66
  */
67
67
  get: (hash, params) => {
68
68
  return this.request(`/v1/files/${hash}`, params);
69
+ },
70
+ /**
71
+ * Resolve a signed download URL for a file path.
72
+ * Returns the signed URL and its expiration timestamp.
73
+ */
74
+ download: async (params) => {
75
+ const url = new URL("/v1/files/download", this.baseUrl);
76
+ url.searchParams.set("bundle", params.bundle);
77
+ url.searchParams.set("version", params.version);
78
+ url.searchParams.set("file_path", params.file_path);
79
+ const response = await fetch(url.toString(), {
80
+ headers: {
81
+ Authorization: `Bearer ${this.apiKey}`
82
+ },
83
+ redirect: "manual"
84
+ });
85
+ if (response.status === 302) {
86
+ const location = response.headers.get("Location");
87
+ if (!location) {
88
+ throw new Error("Missing Location header on download redirect");
89
+ }
90
+ return {
91
+ download_url: location,
92
+ expires_at: response.headers.get("X-Download-Expires-At")
93
+ };
94
+ }
95
+ const data = await response.json();
96
+ if (!response.ok) {
97
+ throw LightboxError.fromAPIError(data);
98
+ }
99
+ throw new Error("Unexpected response from download endpoint");
69
100
  }
70
101
  };
71
102
  /**
@@ -189,6 +220,48 @@ var LightboxClient = class {
189
220
  params
190
221
  );
191
222
  }
223
+ },
224
+ /**
225
+ * JavaScript API symbol tracking methods
226
+ */
227
+ javascript: {
228
+ /**
229
+ * Get the catalog of all JavaScript symbols available for querying.
230
+ * This is a static list of browser APIs monitored during web crawls.
231
+ */
232
+ catalog: (params) => {
233
+ return this.request(
234
+ "/v1/web/javascript/symbols",
235
+ params
236
+ );
237
+ },
238
+ /**
239
+ * Get all scripts that access a specific JavaScript API symbol.
240
+ */
241
+ symbols: (symbol, params) => {
242
+ return this.request(
243
+ `/v1/web/javascript/symbols/${encodeURIComponent(symbol)}`,
244
+ params
245
+ );
246
+ },
247
+ /**
248
+ * Get JavaScript API accesses by scripts from a specific domain.
249
+ */
250
+ scripts: (domain, params) => {
251
+ return this.request(
252
+ `/v1/web/javascript/scripts/${encodeURIComponent(domain)}`,
253
+ params
254
+ );
255
+ },
256
+ /**
257
+ * Get JavaScript API accesses observed when visiting a specific site.
258
+ */
259
+ sites: (site, params) => {
260
+ return this.request(
261
+ `/v1/web/javascript/sites/${encodeURIComponent(site)}`,
262
+ params
263
+ );
264
+ }
192
265
  }
193
266
  };
194
267
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disconnectme/lightbox-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "TypeScript SDK for the Lightbox Data API by Disconnect",
5
5
  "type": "module",
6
6
  "engines": {