@disconnectme/lightbox-sdk 0.1.3 → 0.1.5
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 +33 -2
- package/dist/index.d.cts +15 -7
- package/dist/index.d.ts +15 -7
- package/dist/index.js +33 -2
- package/package.json +1 -1
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.
|
|
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
|
/**
|
|
@@ -109,7 +140,7 @@ var LightboxClient = class {
|
|
|
109
140
|
/**
|
|
110
141
|
* Get detailed profile for a specific app bundle.
|
|
111
142
|
* Use `version` param to get a specific version, defaults to latest.
|
|
112
|
-
* Use `include` to specify which fields to include (frameworks, entitlements,
|
|
143
|
+
* Use `include` to specify which fields to include (frameworks, entitlements, all).
|
|
113
144
|
*/
|
|
114
145
|
get: (bundle, params) => {
|
|
115
146
|
const queryParams = {};
|
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 {
|
|
@@ -101,9 +103,6 @@ interface AppProfile {
|
|
|
101
103
|
created_at: string;
|
|
102
104
|
frameworks?: string[];
|
|
103
105
|
entitlements?: string[];
|
|
104
|
-
privacy?: unknown[];
|
|
105
|
-
urls?: unknown[];
|
|
106
|
-
files?: unknown[];
|
|
107
106
|
}
|
|
108
107
|
interface AppVersion {
|
|
109
108
|
version: string;
|
|
@@ -122,7 +121,6 @@ interface AppFile {
|
|
|
122
121
|
file_path: string | null;
|
|
123
122
|
file_size_bytes: number;
|
|
124
123
|
download_url: string | null;
|
|
125
|
-
expires_at: string | null;
|
|
126
124
|
}
|
|
127
125
|
interface AppSearchData {
|
|
128
126
|
type: "app_collection";
|
|
@@ -201,6 +199,11 @@ interface FileSearchParams extends PaginationParams {
|
|
|
201
199
|
min_size?: number;
|
|
202
200
|
max_size?: number;
|
|
203
201
|
}
|
|
202
|
+
interface FileDownloadParams {
|
|
203
|
+
bundle: string;
|
|
204
|
+
version: string;
|
|
205
|
+
file_path: string;
|
|
206
|
+
}
|
|
204
207
|
interface AppSearchParams extends PaginationParams {
|
|
205
208
|
framework?: string;
|
|
206
209
|
entitlement?: string;
|
|
@@ -371,6 +374,11 @@ declare class LightboxClient {
|
|
|
371
374
|
* Returns the apps containing this file and download URLs.
|
|
372
375
|
*/
|
|
373
376
|
get: (hash: string, params?: PaginationParams) => Promise<FileHashResponse>;
|
|
377
|
+
/**
|
|
378
|
+
* Resolve a signed download URL for a file path.
|
|
379
|
+
* Returns the signed URL and its expiration timestamp.
|
|
380
|
+
*/
|
|
381
|
+
download: (params: FileDownloadParams) => Promise<FileDownloadResult>;
|
|
374
382
|
};
|
|
375
383
|
/**
|
|
376
384
|
* App-related API methods (iOS apps)
|
|
@@ -384,7 +392,7 @@ declare class LightboxClient {
|
|
|
384
392
|
/**
|
|
385
393
|
* Get detailed profile for a specific app bundle.
|
|
386
394
|
* Use `version` param to get a specific version, defaults to latest.
|
|
387
|
-
* Use `include` to specify which fields to include (frameworks, entitlements,
|
|
395
|
+
* Use `include` to specify which fields to include (frameworks, entitlements, all).
|
|
388
396
|
*/
|
|
389
397
|
get: (bundle: string, params?: AppGetParams) => Promise<AppProfileResponse>;
|
|
390
398
|
/**
|
|
@@ -473,4 +481,4 @@ declare class LightboxClient {
|
|
|
473
481
|
};
|
|
474
482
|
}
|
|
475
483
|
|
|
476
|
-
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, 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 };
|
|
484
|
+
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 {
|
|
@@ -101,9 +103,6 @@ interface AppProfile {
|
|
|
101
103
|
created_at: string;
|
|
102
104
|
frameworks?: string[];
|
|
103
105
|
entitlements?: string[];
|
|
104
|
-
privacy?: unknown[];
|
|
105
|
-
urls?: unknown[];
|
|
106
|
-
files?: unknown[];
|
|
107
106
|
}
|
|
108
107
|
interface AppVersion {
|
|
109
108
|
version: string;
|
|
@@ -122,7 +121,6 @@ interface AppFile {
|
|
|
122
121
|
file_path: string | null;
|
|
123
122
|
file_size_bytes: number;
|
|
124
123
|
download_url: string | null;
|
|
125
|
-
expires_at: string | null;
|
|
126
124
|
}
|
|
127
125
|
interface AppSearchData {
|
|
128
126
|
type: "app_collection";
|
|
@@ -201,6 +199,11 @@ interface FileSearchParams extends PaginationParams {
|
|
|
201
199
|
min_size?: number;
|
|
202
200
|
max_size?: number;
|
|
203
201
|
}
|
|
202
|
+
interface FileDownloadParams {
|
|
203
|
+
bundle: string;
|
|
204
|
+
version: string;
|
|
205
|
+
file_path: string;
|
|
206
|
+
}
|
|
204
207
|
interface AppSearchParams extends PaginationParams {
|
|
205
208
|
framework?: string;
|
|
206
209
|
entitlement?: string;
|
|
@@ -371,6 +374,11 @@ declare class LightboxClient {
|
|
|
371
374
|
* Returns the apps containing this file and download URLs.
|
|
372
375
|
*/
|
|
373
376
|
get: (hash: string, params?: PaginationParams) => Promise<FileHashResponse>;
|
|
377
|
+
/**
|
|
378
|
+
* Resolve a signed download URL for a file path.
|
|
379
|
+
* Returns the signed URL and its expiration timestamp.
|
|
380
|
+
*/
|
|
381
|
+
download: (params: FileDownloadParams) => Promise<FileDownloadResult>;
|
|
374
382
|
};
|
|
375
383
|
/**
|
|
376
384
|
* App-related API methods (iOS apps)
|
|
@@ -384,7 +392,7 @@ declare class LightboxClient {
|
|
|
384
392
|
/**
|
|
385
393
|
* Get detailed profile for a specific app bundle.
|
|
386
394
|
* Use `version` param to get a specific version, defaults to latest.
|
|
387
|
-
* Use `include` to specify which fields to include (frameworks, entitlements,
|
|
395
|
+
* Use `include` to specify which fields to include (frameworks, entitlements, all).
|
|
388
396
|
*/
|
|
389
397
|
get: (bundle: string, params?: AppGetParams) => Promise<AppProfileResponse>;
|
|
390
398
|
/**
|
|
@@ -473,4 +481,4 @@ declare class LightboxClient {
|
|
|
473
481
|
};
|
|
474
482
|
}
|
|
475
483
|
|
|
476
|
-
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, 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 };
|
|
484
|
+
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.
|
|
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
|
/**
|
|
@@ -82,7 +113,7 @@ var LightboxClient = class {
|
|
|
82
113
|
/**
|
|
83
114
|
* Get detailed profile for a specific app bundle.
|
|
84
115
|
* Use `version` param to get a specific version, defaults to latest.
|
|
85
|
-
* Use `include` to specify which fields to include (frameworks, entitlements,
|
|
116
|
+
* Use `include` to specify which fields to include (frameworks, entitlements, all).
|
|
86
117
|
*/
|
|
87
118
|
get: (bundle, params) => {
|
|
88
119
|
const queryParams = {};
|