@mediaviz/react-native-sdk 1.9.0-dev.116 → 1.9.0-rc.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/sdk.cjs +29 -91
- package/dist/sdk.d.cts +6 -34
- package/dist/sdk.d.ts +6 -34
- package/dist/sdk.esm.d.ts +6 -34
- package/dist/sdk.esm.js +30 -91
- package/package.json +1 -1
package/dist/sdk.cjs
CHANGED
|
@@ -1149,7 +1149,7 @@ class Company {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
1151
|
|
|
1152
|
-
function stripUndef$
|
|
1152
|
+
function stripUndef$7(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1153
1153
|
|
|
1154
1154
|
class CuratedAlbums {
|
|
1155
1155
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1157,7 +1157,7 @@ class CuratedAlbums {
|
|
|
1157
1157
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
1158
1158
|
this._ctx.requireTokens();
|
|
1159
1159
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1160
|
-
const body = stripUndef$
|
|
1160
|
+
const body = stripUndef$7({
|
|
1161
1161
|
name: name,
|
|
1162
1162
|
description: description,
|
|
1163
1163
|
confidence_value: confidenceValue,
|
|
@@ -1211,7 +1211,7 @@ class CuratedAlbums {
|
|
|
1211
1211
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
1212
1212
|
this._ctx.requireTokens();
|
|
1213
1213
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
1214
|
-
const body = stripUndef$
|
|
1214
|
+
const body = stripUndef$7({
|
|
1215
1215
|
name: name,
|
|
1216
1216
|
description: description,
|
|
1217
1217
|
confidence_value: confidenceValue,
|
|
@@ -1235,7 +1235,7 @@ class CuratedAlbums {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
|
|
1238
|
-
function stripUndef$
|
|
1238
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1239
1239
|
|
|
1240
1240
|
class CustomAlbums {
|
|
1241
1241
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1283,7 +1283,7 @@ class CustomAlbums {
|
|
|
1283
1283
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1284
1284
|
this._ctx.requireTokens();
|
|
1285
1285
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1286
|
-
const body = stripUndef$
|
|
1286
|
+
const body = stripUndef$6({
|
|
1287
1287
|
name: name,
|
|
1288
1288
|
description: description,
|
|
1289
1289
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1296,7 +1296,7 @@ class CustomAlbums {
|
|
|
1296
1296
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1297
1297
|
this._ctx.requireTokens();
|
|
1298
1298
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
1299
|
-
const body = stripUndef$
|
|
1299
|
+
const body = stripUndef$6({
|
|
1300
1300
|
name: name,
|
|
1301
1301
|
description: description,
|
|
1302
1302
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1396,7 +1396,7 @@ async function handleResponse(response) {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
1398
|
|
|
1399
|
-
function stripUndef$
|
|
1399
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1400
1400
|
|
|
1401
1401
|
class EmailTokens {
|
|
1402
1402
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1427,7 +1427,7 @@ class EmailTokens {
|
|
|
1427
1427
|
}
|
|
1428
1428
|
|
|
1429
1429
|
async validateToken(token) {
|
|
1430
|
-
const body = stripUndef$
|
|
1430
|
+
const body = stripUndef$5({
|
|
1431
1431
|
token: token,
|
|
1432
1432
|
});
|
|
1433
1433
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -1439,7 +1439,7 @@ class EmailTokens {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
|
|
1441
1441
|
async resetPassword(token, newPassword) {
|
|
1442
|
-
const body = stripUndef$
|
|
1442
|
+
const body = stripUndef$5({
|
|
1443
1443
|
token: token,
|
|
1444
1444
|
new_password: newPassword,
|
|
1445
1445
|
});
|
|
@@ -1478,7 +1478,7 @@ class Health {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
|
-
function stripUndef$
|
|
1481
|
+
function stripUndef$4(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1482
1482
|
|
|
1483
1483
|
class Keywords {
|
|
1484
1484
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1486,7 +1486,7 @@ class Keywords {
|
|
|
1486
1486
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
1487
1487
|
this._ctx.requireTokens();
|
|
1488
1488
|
const path = `/api/v1/keyword/`;
|
|
1489
|
-
const body = stripUndef$
|
|
1489
|
+
const body = stripUndef$4({
|
|
1490
1490
|
name: name,
|
|
1491
1491
|
project_list: projectList,
|
|
1492
1492
|
});
|
|
@@ -1539,7 +1539,7 @@ class Keywords {
|
|
|
1539
1539
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1540
1540
|
this._ctx.requireTokens();
|
|
1541
1541
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1542
|
-
const body = stripUndef$
|
|
1542
|
+
const body = stripUndef$4({
|
|
1543
1543
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1544
1544
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1545
1545
|
});
|
|
@@ -1550,7 +1550,7 @@ class Keywords {
|
|
|
1550
1550
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1551
1551
|
this._ctx.requireTokens();
|
|
1552
1552
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1553
|
-
const body = stripUndef$
|
|
1553
|
+
const body = stripUndef$4({
|
|
1554
1554
|
name: name,
|
|
1555
1555
|
project_list: projectList,
|
|
1556
1556
|
});
|
|
@@ -1631,17 +1631,6 @@ class Keywords {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
}
|
|
1633
1633
|
|
|
1634
|
-
class Media {
|
|
1635
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
1636
|
-
|
|
1637
|
-
async getProjectAccessQuery(projectTableName) {
|
|
1638
|
-
this._ctx.requireTokens();
|
|
1639
|
-
const path = `/api/v1/media/project/${encodeURIComponent(projectTableName)}/access_query`;
|
|
1640
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1641
|
-
return data;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
1634
|
class OauthAuthorization {
|
|
1646
1635
|
constructor(ctx) { this._ctx = ctx; }
|
|
1647
1636
|
|
|
@@ -1826,7 +1815,7 @@ class Person {
|
|
|
1826
1815
|
}
|
|
1827
1816
|
}
|
|
1828
1817
|
|
|
1829
|
-
function stripUndef$
|
|
1818
|
+
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1830
1819
|
|
|
1831
1820
|
class Projects {
|
|
1832
1821
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1839,7 +1828,7 @@ class Projects {
|
|
|
1839
1828
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1840
1829
|
const qs = query.toString();
|
|
1841
1830
|
if (qs) path += '?' + qs;
|
|
1842
|
-
const body = stripUndef$
|
|
1831
|
+
const body = stripUndef$3({
|
|
1843
1832
|
name: name,
|
|
1844
1833
|
private: private_,
|
|
1845
1834
|
type: type,
|
|
@@ -1909,7 +1898,7 @@ class Projects {
|
|
|
1909
1898
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1910
1899
|
this._ctx.requireTokens();
|
|
1911
1900
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1912
|
-
const body = stripUndef$
|
|
1901
|
+
const body = stripUndef$3({
|
|
1913
1902
|
private: private_,
|
|
1914
1903
|
type: type,
|
|
1915
1904
|
description: description,
|
|
@@ -1988,7 +1977,7 @@ class Projects {
|
|
|
1988
1977
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1989
1978
|
this._ctx.requireTokens();
|
|
1990
1979
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1991
|
-
const body = stripUndef$
|
|
1980
|
+
const body = stripUndef$3({
|
|
1992
1981
|
event: event,
|
|
1993
1982
|
detail: detail,
|
|
1994
1983
|
});
|
|
@@ -2007,7 +1996,7 @@ class Projects {
|
|
|
2007
1996
|
class Photoupload {
|
|
2008
1997
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
2009
1998
|
|
|
2010
|
-
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr,
|
|
1999
|
+
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2011
2000
|
this._ctx.requireTokens();
|
|
2012
2001
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2013
2002
|
const headers = {
|
|
@@ -2017,7 +2006,7 @@ class Photoupload {
|
|
|
2017
2006
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2018
2007
|
method: 'POST',
|
|
2019
2008
|
headers,
|
|
2020
|
-
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr,
|
|
2009
|
+
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2021
2010
|
});
|
|
2022
2011
|
return handleResponse(resp);
|
|
2023
2012
|
}
|
|
@@ -2033,14 +2022,12 @@ class Photoupload {
|
|
|
2033
2022
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2034
2023
|
}
|
|
2035
2024
|
|
|
2036
|
-
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined),
|
|
2025
|
+
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined), { clientSideId: photo.clientSideId, format: photo.format, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
2037
2026
|
|
|
2038
2027
|
return upload_result;
|
|
2039
2028
|
}
|
|
2040
2029
|
}
|
|
2041
2030
|
|
|
2042
|
-
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
2043
|
-
|
|
2044
2031
|
class Photos {
|
|
2045
2032
|
constructor(ctx) { this._ctx = ctx; }
|
|
2046
2033
|
|
|
@@ -2102,16 +2089,16 @@ class Photos {
|
|
|
2102
2089
|
return data;
|
|
2103
2090
|
}
|
|
2104
2091
|
|
|
2105
|
-
async updatePhotoInProject(tableName, photoId,
|
|
2092
|
+
async updatePhotoInProject({ tableName, photoId, photoData } = {}) {
|
|
2106
2093
|
this._ctx.requireTokens();
|
|
2107
|
-
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken
|
|
2094
|
+
let path = `/api/v1/photos_update`;
|
|
2095
|
+
const query = new URLSearchParams();
|
|
2096
|
+
if (tableName !== undefined) (Array.isArray(tableName) ? tableName : [tableName]).forEach(v => query.append('table_name', v));
|
|
2097
|
+
if (photoId !== undefined) (Array.isArray(photoId) ? photoId : [photoId]).forEach(v => query.append('photo_id', v));
|
|
2098
|
+
if (photoData !== undefined) (Array.isArray(photoData) ? photoData : [photoData]).forEach(v => query.append('photo_data', v));
|
|
2099
|
+
const qs = query.toString();
|
|
2100
|
+
if (qs) path += '?' + qs;
|
|
2101
|
+
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken);
|
|
2115
2102
|
return data;
|
|
2116
2103
|
}
|
|
2117
2104
|
|
|
@@ -2461,7 +2448,6 @@ class _Context {
|
|
|
2461
2448
|
get refreshToken() { return this._mv._refreshToken; }
|
|
2462
2449
|
get baseUrl() { return this._mv._config.baseUrl; }
|
|
2463
2450
|
get hosts() { return this._mv._hosts; }
|
|
2464
|
-
get utils() { return this._mv.utils; }
|
|
2465
2451
|
requireHost(key) {
|
|
2466
2452
|
const url = this._mv._hosts[key];
|
|
2467
2453
|
if (!url) throw new Error(`Host '${key}' not configured. Pass hosts.${key} in MediaViz constructor or set the corresponding env var.`);
|
|
@@ -2484,51 +2470,6 @@ class _TokenTrackingClient {
|
|
|
2484
2470
|
}
|
|
2485
2471
|
}
|
|
2486
2472
|
|
|
2487
|
-
class _Utils {
|
|
2488
|
-
constructor(mv) { this._mv = mv; }
|
|
2489
|
-
async getMediaAccessQuery(projectTableName) {
|
|
2490
|
-
if (!this._mv._accessToken) throw new Error('Not authenticated. Call authenticate(), handleCallback(), or setTokens() first.');
|
|
2491
|
-
// Memo lives on the _Utils instance, so it is scoped to one MediaViz client
|
|
2492
|
-
// (one authenticated user) — keying on project alone cannot leak across users.
|
|
2493
|
-
if (!this._mediaQueryMemo) this._mediaQueryMemo = new Map();
|
|
2494
|
-
const _nowSec = Date.now() / 1000;
|
|
2495
|
-
const _memo = this._mediaQueryMemo.get(projectTableName);
|
|
2496
|
-
// Re-mint 60s early: an <img> load that starts just before expiry must not race
|
|
2497
|
-
// the policy going stale and 403 mid-flight.
|
|
2498
|
-
if (_memo && _memo.expiresEpoch - 60 > _nowSec) return _memo.result;
|
|
2499
|
-
|
|
2500
|
-
// Through the generated endpoint method, not a bare fetch: this inherits the
|
|
2501
|
-
// oauth client's 401-refresh-and-retry. Errors propagate — without a query
|
|
2502
|
-
// string there is nothing to render.
|
|
2503
|
-
const _result = await this._mv.media.getProjectAccessQuery(projectTableName);
|
|
2504
|
-
|
|
2505
|
-
const _expiresEpoch = Date.parse(_result.expires_at) / 1000;
|
|
2506
|
-
// Skip the memo on an unparseable expiry rather than cache something that can
|
|
2507
|
-
// never be invalidated.
|
|
2508
|
-
if (!Number.isNaN(_expiresEpoch)) {
|
|
2509
|
-
this._mediaQueryMemo.set(projectTableName, { expiresEpoch: _expiresEpoch, result: _result });
|
|
2510
|
-
}
|
|
2511
|
-
return _result;
|
|
2512
|
-
}
|
|
2513
|
-
async authorizeMediaUrl(photoUrl, projectTableName) {
|
|
2514
|
-
if (!this._mv._accessToken) throw new Error('Not authenticated. Call authenticate(), handleCallback(), or setTokens() first.');
|
|
2515
|
-
// Memoized upstream, so calling this once per tile in a grid still costs one
|
|
2516
|
-
// round trip for the whole project.
|
|
2517
|
-
const _access = await this.getMediaAccessQuery(projectTableName);
|
|
2518
|
-
|
|
2519
|
-
// Already signed: return untouched. Appending a second policy yields duplicate
|
|
2520
|
-
// Policy/Signature params and an opaque 403 at the edge, and the caller almost
|
|
2521
|
-
// certainly passed a URL this function already authorized.
|
|
2522
|
-
//
|
|
2523
|
-
// Keyed on Key-Pair-Id, not Policy: the query-string params are Policy /
|
|
2524
|
-
// Signature / Key-Pair-Id (NOT the CloudFront-* spelling the cookie path used),
|
|
2525
|
-
// and 'Policy' alone is generic enough to collide with an unrelated param.
|
|
2526
|
-
if (/[?&]Key-Pair-Id=/.test(photoUrl)) return photoUrl;
|
|
2527
|
-
|
|
2528
|
-
return photoUrl + (photoUrl.includes('?') ? '&' : '?') + _access.query_string;
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
|
|
2532
2473
|
class MediaViz {
|
|
2533
2474
|
constructor(config = {}) {
|
|
2534
2475
|
this._config = {
|
|
@@ -2562,7 +2503,6 @@ class MediaViz {
|
|
|
2562
2503
|
this.emailTokens = new EmailTokens(_ctx);
|
|
2563
2504
|
this.health = new Health(_ctx);
|
|
2564
2505
|
this.keywords = new Keywords(_ctx);
|
|
2565
|
-
this.media = new Media(_ctx);
|
|
2566
2506
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
2567
2507
|
this.oAuthToken = new OauthToken(_ctx);
|
|
2568
2508
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
@@ -2574,7 +2514,6 @@ class MediaViz {
|
|
|
2574
2514
|
this.subscription = new Subscription(_ctx);
|
|
2575
2515
|
this.users = new Users(_ctx);
|
|
2576
2516
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2577
|
-
this.utils = new _Utils(this);
|
|
2578
2517
|
}
|
|
2579
2518
|
|
|
2580
2519
|
async authenticate() {
|
|
@@ -2996,7 +2935,6 @@ exports.EmailTokens = EmailTokens;
|
|
|
2996
2935
|
exports.Health = Health;
|
|
2997
2936
|
exports.InMemoryWebhookStore = InMemoryWebhookStore;
|
|
2998
2937
|
exports.Keywords = Keywords;
|
|
2999
|
-
exports.Media = Media;
|
|
3000
2938
|
exports.MediaViz = MediaViz;
|
|
3001
2939
|
exports.MemoryTokenStore = MemoryTokenStore;
|
|
3002
2940
|
exports.NotFoundError = NotFoundError;
|
package/dist/sdk.d.cts
CHANGED
|
@@ -216,15 +216,8 @@ export interface KeywordListDisplayWithProjects {
|
|
|
216
216
|
list_projects_associated?: string[];
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export interface MediaAccessQueryDisplay {
|
|
220
|
-
query_string: string;
|
|
221
|
-
url_prefix: string;
|
|
222
|
-
expires_at: string;
|
|
223
|
-
project_table_name: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
219
|
export interface PhotoDisplay {
|
|
227
|
-
photo_s3_link
|
|
220
|
+
photo_s3_link: string;
|
|
228
221
|
client_side_id?: string;
|
|
229
222
|
moment_id?: number;
|
|
230
223
|
file_path?: string;
|
|
@@ -275,15 +268,6 @@ export interface PhotoDisplay {
|
|
|
275
268
|
hue_values?: number[];
|
|
276
269
|
light_values?: number[];
|
|
277
270
|
saturation_values?: number[];
|
|
278
|
-
aesthetic_appeal?: number;
|
|
279
|
-
lighting?: number;
|
|
280
|
-
subject_significance?: number;
|
|
281
|
-
emotional_intensity?: number;
|
|
282
|
-
positive_emotion?: number;
|
|
283
|
-
universal_relatability?: number;
|
|
284
|
-
memorability?: number;
|
|
285
|
-
composition?: number;
|
|
286
|
-
judgment_overall_score?: number;
|
|
287
271
|
user_id: number;
|
|
288
272
|
company_id: number;
|
|
289
273
|
id: number;
|
|
@@ -336,7 +320,7 @@ export interface PhotoPersonWithS3Link {
|
|
|
336
320
|
bounding_box: Record<string, any>;
|
|
337
321
|
confidence: number;
|
|
338
322
|
person_name: string;
|
|
339
|
-
photo_s3_link
|
|
323
|
+
photo_s3_link: string;
|
|
340
324
|
}
|
|
341
325
|
|
|
342
326
|
export interface ProjectRunDisplay {
|
|
@@ -372,7 +356,6 @@ export interface ProjectRunDisplay {
|
|
|
372
356
|
image_comparison_model?: boolean;
|
|
373
357
|
image_describe_model?: boolean;
|
|
374
358
|
ocr_model?: boolean;
|
|
375
|
-
judgment_model?: boolean;
|
|
376
359
|
similarity_model?: boolean;
|
|
377
360
|
personhood_model?: boolean;
|
|
378
361
|
evidence_model?: boolean;
|
|
@@ -448,7 +431,7 @@ export class Admin {
|
|
|
448
431
|
|
|
449
432
|
export class Company {
|
|
450
433
|
getCompanyById(companyId: number): Promise<CompanyDisplay>;
|
|
451
|
-
confirmCompanyCreditBalance(companyId: number, options?: { photoCount?: number | number[], modelsList?:
|
|
434
|
+
confirmCompanyCreditBalance(companyId: number, options?: { photoCount?: number | number[], modelsList?: string[] | string[][] }): Promise<CreditBalanceOutput>;
|
|
452
435
|
}
|
|
453
436
|
|
|
454
437
|
export class CuratedAlbums {
|
|
@@ -507,10 +490,6 @@ export class Keywords {
|
|
|
507
490
|
deleteKeywordFilteringListById(keywordListId: number): Promise<Record<string, any>>;
|
|
508
491
|
}
|
|
509
492
|
|
|
510
|
-
export class Media {
|
|
511
|
-
getProjectAccessQuery(projectTableName: string): Promise<MediaAccessQueryDisplay>;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
493
|
export class OauthAuthorization {
|
|
515
494
|
authorize(options?: { responseType?: string | string[], clientId?: string | string[], redirectUri?: string | string[], state?: string | string[], codeChallenge?: string | string[], codeChallengeMethod?: string | string[] }): Promise<any>;
|
|
516
495
|
getConsent(sessionId: string): Promise<any>;
|
|
@@ -543,7 +522,7 @@ export class Person {
|
|
|
543
522
|
}
|
|
544
523
|
|
|
545
524
|
export class Photoupload {
|
|
546
|
-
uploadPhotoToMediaviz(fileContent: string, filePath: string, mimetype: string, companyId: string, userId: string, projectTableName: string, blur: boolean | string, colors: boolean | string, faceRecognition: boolean | string, imageClassification: boolean | string, imageComparison: boolean | string, imageDescribe: boolean | string, ocr: boolean | string,
|
|
525
|
+
uploadPhotoToMediaviz(fileContent: string, filePath: string, mimetype: string, companyId: string, userId: string, projectTableName: string, blur: boolean | string, colors: boolean | string, faceRecognition: boolean | string, imageClassification: boolean | string, imageComparison: boolean | string, imageDescribe: boolean | string, ocr: boolean | string, options?: { clientSideId?: string, format?: string, size?: string, sourceResolutionX?: number | string, sourceResolutionY?: number | string, dateTaken?: string, latitude?: number | string, longitude?: number | string }): Promise<any>;
|
|
547
526
|
uploadPhoto(companyId: string, userId: string, projectTableName: string, photo: Record<string, any>): Promise<any>;
|
|
548
527
|
}
|
|
549
528
|
|
|
@@ -553,7 +532,7 @@ export class Photos {
|
|
|
553
532
|
getProjectPhotoIdsByTableName(tableName: string, options?: { ascOrDesc?: string | string[], lastId?: number | number[], limit?: number | number[], includeAll?: boolean | boolean[], startDate?: string | string[], endDate?: string | string[], noDateTaken?: boolean | boolean[] }): Promise<any>;
|
|
554
533
|
getRankedProjectPhotoIdsByTableName(tableName: string, options?: { ascOrDesc?: string | string[], lastId?: number | number[], limit?: number | number[], startDate?: string | string[], endDate?: string | string[], noDateTaken?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
555
534
|
getProjectMonthYearsWithPhotos(tableName: string): Promise<any>;
|
|
556
|
-
updatePhotoInProject(tableName
|
|
535
|
+
updatePhotoInProject(options?: { tableName?: string | string[], photoId?: number | number[], photoData?: Record<string, any> | Record<string, any>[] }): Promise<PhotoDisplay>;
|
|
557
536
|
updatePhotoRanking(tableName: string, photoId: number, newCategory: string): Promise<Record<string, any>>;
|
|
558
537
|
deletePhotoFromProject(tableName: string, options?: { photoIds?: any }): Promise<Record<string, any>>;
|
|
559
538
|
}
|
|
@@ -568,7 +547,7 @@ export class Projects {
|
|
|
568
547
|
getProjectById(projectId: string): Promise<ProjectRunDisplay>;
|
|
569
548
|
getProjectByDirectory(directory: string): Promise<ProjectRunDisplay>;
|
|
570
549
|
updateProject(projectId: string, body?: { private?: boolean, type?: number, description?: string, directory?: string, name?: string, thumbnail?: string }): Promise<ProjectRunDisplay>;
|
|
571
|
-
updateProjectPhotoCount(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<
|
|
550
|
+
updateProjectPhotoCount(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<any>;
|
|
572
551
|
updateProjectCreateUploadReport(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<any>;
|
|
573
552
|
requestProjectSimilarityQueue(projectTableName: string, level: string): Promise<Record<string, any>>;
|
|
574
553
|
requestProjectEvidenceQueue(projectTableName: string): Promise<Record<string, any>>;
|
|
@@ -612,11 +591,6 @@ export class Users {
|
|
|
612
591
|
deleteUser(userId: number, options?: { newCompanyOwnerId?: number | number[] }): Promise<Record<string, any>>;
|
|
613
592
|
}
|
|
614
593
|
|
|
615
|
-
export interface MediaVizUtils {
|
|
616
|
-
getMediaAccessQuery(projectTableName: string): Promise<any>;
|
|
617
|
-
authorizeMediaUrl(photoUrl: string, projectTableName: string): Promise<any>;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
594
|
export class MediaViz {
|
|
621
595
|
constructor(config?: MediaVizConfig);
|
|
622
596
|
authenticate(): Promise<TokenResponse>;
|
|
@@ -633,7 +607,6 @@ export class MediaViz {
|
|
|
633
607
|
readonly emailTokens: EmailTokens;
|
|
634
608
|
readonly health: Health;
|
|
635
609
|
readonly keywords: Keywords;
|
|
636
|
-
readonly media: Media;
|
|
637
610
|
readonly oAuthAuthorization: OauthAuthorization;
|
|
638
611
|
readonly oAuthToken: OauthToken;
|
|
639
612
|
readonly oauthLogin: OauthLogin;
|
|
@@ -645,6 +618,5 @@ export class MediaViz {
|
|
|
645
618
|
readonly subscription: Subscription;
|
|
646
619
|
readonly users: Users;
|
|
647
620
|
readonly webhooks: WebhookConsumer;
|
|
648
|
-
readonly utils: MediaVizUtils;
|
|
649
621
|
}
|
|
650
622
|
|
package/dist/sdk.d.ts
CHANGED
|
@@ -216,15 +216,8 @@ export interface KeywordListDisplayWithProjects {
|
|
|
216
216
|
list_projects_associated?: string[];
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export interface MediaAccessQueryDisplay {
|
|
220
|
-
query_string: string;
|
|
221
|
-
url_prefix: string;
|
|
222
|
-
expires_at: string;
|
|
223
|
-
project_table_name: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
219
|
export interface PhotoDisplay {
|
|
227
|
-
photo_s3_link
|
|
220
|
+
photo_s3_link: string;
|
|
228
221
|
client_side_id?: string;
|
|
229
222
|
moment_id?: number;
|
|
230
223
|
file_path?: string;
|
|
@@ -275,15 +268,6 @@ export interface PhotoDisplay {
|
|
|
275
268
|
hue_values?: number[];
|
|
276
269
|
light_values?: number[];
|
|
277
270
|
saturation_values?: number[];
|
|
278
|
-
aesthetic_appeal?: number;
|
|
279
|
-
lighting?: number;
|
|
280
|
-
subject_significance?: number;
|
|
281
|
-
emotional_intensity?: number;
|
|
282
|
-
positive_emotion?: number;
|
|
283
|
-
universal_relatability?: number;
|
|
284
|
-
memorability?: number;
|
|
285
|
-
composition?: number;
|
|
286
|
-
judgment_overall_score?: number;
|
|
287
271
|
user_id: number;
|
|
288
272
|
company_id: number;
|
|
289
273
|
id: number;
|
|
@@ -336,7 +320,7 @@ export interface PhotoPersonWithS3Link {
|
|
|
336
320
|
bounding_box: Record<string, any>;
|
|
337
321
|
confidence: number;
|
|
338
322
|
person_name: string;
|
|
339
|
-
photo_s3_link
|
|
323
|
+
photo_s3_link: string;
|
|
340
324
|
}
|
|
341
325
|
|
|
342
326
|
export interface ProjectRunDisplay {
|
|
@@ -372,7 +356,6 @@ export interface ProjectRunDisplay {
|
|
|
372
356
|
image_comparison_model?: boolean;
|
|
373
357
|
image_describe_model?: boolean;
|
|
374
358
|
ocr_model?: boolean;
|
|
375
|
-
judgment_model?: boolean;
|
|
376
359
|
similarity_model?: boolean;
|
|
377
360
|
personhood_model?: boolean;
|
|
378
361
|
evidence_model?: boolean;
|
|
@@ -448,7 +431,7 @@ export class Admin {
|
|
|
448
431
|
|
|
449
432
|
export class Company {
|
|
450
433
|
getCompanyById(companyId: number): Promise<CompanyDisplay>;
|
|
451
|
-
confirmCompanyCreditBalance(companyId: number, options?: { photoCount?: number | number[], modelsList?:
|
|
434
|
+
confirmCompanyCreditBalance(companyId: number, options?: { photoCount?: number | number[], modelsList?: string[] | string[][] }): Promise<CreditBalanceOutput>;
|
|
452
435
|
}
|
|
453
436
|
|
|
454
437
|
export class CuratedAlbums {
|
|
@@ -507,10 +490,6 @@ export class Keywords {
|
|
|
507
490
|
deleteKeywordFilteringListById(keywordListId: number): Promise<Record<string, any>>;
|
|
508
491
|
}
|
|
509
492
|
|
|
510
|
-
export class Media {
|
|
511
|
-
getProjectAccessQuery(projectTableName: string): Promise<MediaAccessQueryDisplay>;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
493
|
export class OauthAuthorization {
|
|
515
494
|
authorize(options?: { responseType?: string | string[], clientId?: string | string[], redirectUri?: string | string[], state?: string | string[], codeChallenge?: string | string[], codeChallengeMethod?: string | string[] }): Promise<any>;
|
|
516
495
|
getConsent(sessionId: string): Promise<any>;
|
|
@@ -543,7 +522,7 @@ export class Person {
|
|
|
543
522
|
}
|
|
544
523
|
|
|
545
524
|
export class Photoupload {
|
|
546
|
-
uploadPhotoToMediaviz(fileContent: string, filePath: string, mimetype: string, companyId: string, userId: string, projectTableName: string, blur: boolean | string, colors: boolean | string, faceRecognition: boolean | string, imageClassification: boolean | string, imageComparison: boolean | string, imageDescribe: boolean | string, ocr: boolean | string,
|
|
525
|
+
uploadPhotoToMediaviz(fileContent: string, filePath: string, mimetype: string, companyId: string, userId: string, projectTableName: string, blur: boolean | string, colors: boolean | string, faceRecognition: boolean | string, imageClassification: boolean | string, imageComparison: boolean | string, imageDescribe: boolean | string, ocr: boolean | string, options?: { clientSideId?: string, format?: string, size?: string, sourceResolutionX?: number | string, sourceResolutionY?: number | string, dateTaken?: string, latitude?: number | string, longitude?: number | string }): Promise<any>;
|
|
547
526
|
uploadPhoto(companyId: string, userId: string, projectTableName: string, photo: Record<string, any>): Promise<any>;
|
|
548
527
|
}
|
|
549
528
|
|
|
@@ -553,7 +532,7 @@ export class Photos {
|
|
|
553
532
|
getProjectPhotoIdsByTableName(tableName: string, options?: { ascOrDesc?: string | string[], lastId?: number | number[], limit?: number | number[], includeAll?: boolean | boolean[], startDate?: string | string[], endDate?: string | string[], noDateTaken?: boolean | boolean[] }): Promise<any>;
|
|
554
533
|
getRankedProjectPhotoIdsByTableName(tableName: string, options?: { ascOrDesc?: string | string[], lastId?: number | number[], limit?: number | number[], startDate?: string | string[], endDate?: string | string[], noDateTaken?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
555
534
|
getProjectMonthYearsWithPhotos(tableName: string): Promise<any>;
|
|
556
|
-
updatePhotoInProject(tableName
|
|
535
|
+
updatePhotoInProject(options?: { tableName?: string | string[], photoId?: number | number[], photoData?: Record<string, any> | Record<string, any>[] }): Promise<PhotoDisplay>;
|
|
557
536
|
updatePhotoRanking(tableName: string, photoId: number, newCategory: string): Promise<Record<string, any>>;
|
|
558
537
|
deletePhotoFromProject(tableName: string, options?: { photoIds?: any }): Promise<Record<string, any>>;
|
|
559
538
|
}
|
|
@@ -568,7 +547,7 @@ export class Projects {
|
|
|
568
547
|
getProjectById(projectId: string): Promise<ProjectRunDisplay>;
|
|
569
548
|
getProjectByDirectory(directory: string): Promise<ProjectRunDisplay>;
|
|
570
549
|
updateProject(projectId: string, body?: { private?: boolean, type?: number, description?: string, directory?: string, name?: string, thumbnail?: string }): Promise<ProjectRunDisplay>;
|
|
571
|
-
updateProjectPhotoCount(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<
|
|
550
|
+
updateProjectPhotoCount(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<any>;
|
|
572
551
|
updateProjectCreateUploadReport(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<any>;
|
|
573
552
|
requestProjectSimilarityQueue(projectTableName: string, level: string): Promise<Record<string, any>>;
|
|
574
553
|
requestProjectEvidenceQueue(projectTableName: string): Promise<Record<string, any>>;
|
|
@@ -612,11 +591,6 @@ export class Users {
|
|
|
612
591
|
deleteUser(userId: number, options?: { newCompanyOwnerId?: number | number[] }): Promise<Record<string, any>>;
|
|
613
592
|
}
|
|
614
593
|
|
|
615
|
-
export interface MediaVizUtils {
|
|
616
|
-
getMediaAccessQuery(projectTableName: string): Promise<any>;
|
|
617
|
-
authorizeMediaUrl(photoUrl: string, projectTableName: string): Promise<any>;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
594
|
export class MediaViz {
|
|
621
595
|
constructor(config?: MediaVizConfig);
|
|
622
596
|
authenticate(): Promise<TokenResponse>;
|
|
@@ -633,7 +607,6 @@ export class MediaViz {
|
|
|
633
607
|
readonly emailTokens: EmailTokens;
|
|
634
608
|
readonly health: Health;
|
|
635
609
|
readonly keywords: Keywords;
|
|
636
|
-
readonly media: Media;
|
|
637
610
|
readonly oAuthAuthorization: OauthAuthorization;
|
|
638
611
|
readonly oAuthToken: OauthToken;
|
|
639
612
|
readonly oauthLogin: OauthLogin;
|
|
@@ -645,6 +618,5 @@ export class MediaViz {
|
|
|
645
618
|
readonly subscription: Subscription;
|
|
646
619
|
readonly users: Users;
|
|
647
620
|
readonly webhooks: WebhookConsumer;
|
|
648
|
-
readonly utils: MediaVizUtils;
|
|
649
621
|
}
|
|
650
622
|
|
package/dist/sdk.esm.d.ts
CHANGED
|
@@ -216,15 +216,8 @@ export interface KeywordListDisplayWithProjects {
|
|
|
216
216
|
list_projects_associated?: string[];
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export interface MediaAccessQueryDisplay {
|
|
220
|
-
query_string: string;
|
|
221
|
-
url_prefix: string;
|
|
222
|
-
expires_at: string;
|
|
223
|
-
project_table_name: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
219
|
export interface PhotoDisplay {
|
|
227
|
-
photo_s3_link
|
|
220
|
+
photo_s3_link: string;
|
|
228
221
|
client_side_id?: string;
|
|
229
222
|
moment_id?: number;
|
|
230
223
|
file_path?: string;
|
|
@@ -275,15 +268,6 @@ export interface PhotoDisplay {
|
|
|
275
268
|
hue_values?: number[];
|
|
276
269
|
light_values?: number[];
|
|
277
270
|
saturation_values?: number[];
|
|
278
|
-
aesthetic_appeal?: number;
|
|
279
|
-
lighting?: number;
|
|
280
|
-
subject_significance?: number;
|
|
281
|
-
emotional_intensity?: number;
|
|
282
|
-
positive_emotion?: number;
|
|
283
|
-
universal_relatability?: number;
|
|
284
|
-
memorability?: number;
|
|
285
|
-
composition?: number;
|
|
286
|
-
judgment_overall_score?: number;
|
|
287
271
|
user_id: number;
|
|
288
272
|
company_id: number;
|
|
289
273
|
id: number;
|
|
@@ -336,7 +320,7 @@ export interface PhotoPersonWithS3Link {
|
|
|
336
320
|
bounding_box: Record<string, any>;
|
|
337
321
|
confidence: number;
|
|
338
322
|
person_name: string;
|
|
339
|
-
photo_s3_link
|
|
323
|
+
photo_s3_link: string;
|
|
340
324
|
}
|
|
341
325
|
|
|
342
326
|
export interface ProjectRunDisplay {
|
|
@@ -372,7 +356,6 @@ export interface ProjectRunDisplay {
|
|
|
372
356
|
image_comparison_model?: boolean;
|
|
373
357
|
image_describe_model?: boolean;
|
|
374
358
|
ocr_model?: boolean;
|
|
375
|
-
judgment_model?: boolean;
|
|
376
359
|
similarity_model?: boolean;
|
|
377
360
|
personhood_model?: boolean;
|
|
378
361
|
evidence_model?: boolean;
|
|
@@ -448,7 +431,7 @@ export class Admin {
|
|
|
448
431
|
|
|
449
432
|
export class Company {
|
|
450
433
|
getCompanyById(companyId: number): Promise<CompanyDisplay>;
|
|
451
|
-
confirmCompanyCreditBalance(companyId: number, options?: { photoCount?: number | number[], modelsList?:
|
|
434
|
+
confirmCompanyCreditBalance(companyId: number, options?: { photoCount?: number | number[], modelsList?: string[] | string[][] }): Promise<CreditBalanceOutput>;
|
|
452
435
|
}
|
|
453
436
|
|
|
454
437
|
export class CuratedAlbums {
|
|
@@ -507,10 +490,6 @@ export class Keywords {
|
|
|
507
490
|
deleteKeywordFilteringListById(keywordListId: number): Promise<Record<string, any>>;
|
|
508
491
|
}
|
|
509
492
|
|
|
510
|
-
export class Media {
|
|
511
|
-
getProjectAccessQuery(projectTableName: string): Promise<MediaAccessQueryDisplay>;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
493
|
export class OauthAuthorization {
|
|
515
494
|
authorize(options?: { responseType?: string | string[], clientId?: string | string[], redirectUri?: string | string[], state?: string | string[], codeChallenge?: string | string[], codeChallengeMethod?: string | string[] }): Promise<any>;
|
|
516
495
|
getConsent(sessionId: string): Promise<any>;
|
|
@@ -543,7 +522,7 @@ export class Person {
|
|
|
543
522
|
}
|
|
544
523
|
|
|
545
524
|
export class Photoupload {
|
|
546
|
-
uploadPhotoToMediaviz(fileContent: string, filePath: string, mimetype: string, companyId: string, userId: string, projectTableName: string, blur: boolean | string, colors: boolean | string, faceRecognition: boolean | string, imageClassification: boolean | string, imageComparison: boolean | string, imageDescribe: boolean | string, ocr: boolean | string,
|
|
525
|
+
uploadPhotoToMediaviz(fileContent: string, filePath: string, mimetype: string, companyId: string, userId: string, projectTableName: string, blur: boolean | string, colors: boolean | string, faceRecognition: boolean | string, imageClassification: boolean | string, imageComparison: boolean | string, imageDescribe: boolean | string, ocr: boolean | string, options?: { clientSideId?: string, format?: string, size?: string, sourceResolutionX?: number | string, sourceResolutionY?: number | string, dateTaken?: string, latitude?: number | string, longitude?: number | string }): Promise<any>;
|
|
547
526
|
uploadPhoto(companyId: string, userId: string, projectTableName: string, photo: Record<string, any>): Promise<any>;
|
|
548
527
|
}
|
|
549
528
|
|
|
@@ -553,7 +532,7 @@ export class Photos {
|
|
|
553
532
|
getProjectPhotoIdsByTableName(tableName: string, options?: { ascOrDesc?: string | string[], lastId?: number | number[], limit?: number | number[], includeAll?: boolean | boolean[], startDate?: string | string[], endDate?: string | string[], noDateTaken?: boolean | boolean[] }): Promise<any>;
|
|
554
533
|
getRankedProjectPhotoIdsByTableName(tableName: string, options?: { ascOrDesc?: string | string[], lastId?: number | number[], limit?: number | number[], startDate?: string | string[], endDate?: string | string[], noDateTaken?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
555
534
|
getProjectMonthYearsWithPhotos(tableName: string): Promise<any>;
|
|
556
|
-
updatePhotoInProject(tableName
|
|
535
|
+
updatePhotoInProject(options?: { tableName?: string | string[], photoId?: number | number[], photoData?: Record<string, any> | Record<string, any>[] }): Promise<PhotoDisplay>;
|
|
557
536
|
updatePhotoRanking(tableName: string, photoId: number, newCategory: string): Promise<Record<string, any>>;
|
|
558
537
|
deletePhotoFromProject(tableName: string, options?: { photoIds?: any }): Promise<Record<string, any>>;
|
|
559
538
|
}
|
|
@@ -568,7 +547,7 @@ export class Projects {
|
|
|
568
547
|
getProjectById(projectId: string): Promise<ProjectRunDisplay>;
|
|
569
548
|
getProjectByDirectory(directory: string): Promise<ProjectRunDisplay>;
|
|
570
549
|
updateProject(projectId: string, body?: { private?: boolean, type?: number, description?: string, directory?: string, name?: string, thumbnail?: string }): Promise<ProjectRunDisplay>;
|
|
571
|
-
updateProjectPhotoCount(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<
|
|
550
|
+
updateProjectPhotoCount(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<any>;
|
|
572
551
|
updateProjectCreateUploadReport(tableName: string, options?: { filesFailedCount?: number | number[] }): Promise<any>;
|
|
573
552
|
requestProjectSimilarityQueue(projectTableName: string, level: string): Promise<Record<string, any>>;
|
|
574
553
|
requestProjectEvidenceQueue(projectTableName: string): Promise<Record<string, any>>;
|
|
@@ -612,11 +591,6 @@ export class Users {
|
|
|
612
591
|
deleteUser(userId: number, options?: { newCompanyOwnerId?: number | number[] }): Promise<Record<string, any>>;
|
|
613
592
|
}
|
|
614
593
|
|
|
615
|
-
export interface MediaVizUtils {
|
|
616
|
-
getMediaAccessQuery(projectTableName: string): Promise<any>;
|
|
617
|
-
authorizeMediaUrl(photoUrl: string, projectTableName: string): Promise<any>;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
594
|
export class MediaViz {
|
|
621
595
|
constructor(config?: MediaVizConfig);
|
|
622
596
|
authenticate(): Promise<TokenResponse>;
|
|
@@ -633,7 +607,6 @@ export class MediaViz {
|
|
|
633
607
|
readonly emailTokens: EmailTokens;
|
|
634
608
|
readonly health: Health;
|
|
635
609
|
readonly keywords: Keywords;
|
|
636
|
-
readonly media: Media;
|
|
637
610
|
readonly oAuthAuthorization: OauthAuthorization;
|
|
638
611
|
readonly oAuthToken: OauthToken;
|
|
639
612
|
readonly oauthLogin: OauthLogin;
|
|
@@ -645,6 +618,5 @@ export class MediaViz {
|
|
|
645
618
|
readonly subscription: Subscription;
|
|
646
619
|
readonly users: Users;
|
|
647
620
|
readonly webhooks: WebhookConsumer;
|
|
648
|
-
readonly utils: MediaVizUtils;
|
|
649
621
|
}
|
|
650
622
|
|
package/dist/sdk.esm.js
CHANGED
|
@@ -1147,7 +1147,7 @@ class Company {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
1149
|
|
|
1150
|
-
function stripUndef$
|
|
1150
|
+
function stripUndef$7(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1151
1151
|
|
|
1152
1152
|
class CuratedAlbums {
|
|
1153
1153
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1155,7 +1155,7 @@ class CuratedAlbums {
|
|
|
1155
1155
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
1156
1156
|
this._ctx.requireTokens();
|
|
1157
1157
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1158
|
-
const body = stripUndef$
|
|
1158
|
+
const body = stripUndef$7({
|
|
1159
1159
|
name: name,
|
|
1160
1160
|
description: description,
|
|
1161
1161
|
confidence_value: confidenceValue,
|
|
@@ -1209,7 +1209,7 @@ class CuratedAlbums {
|
|
|
1209
1209
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
1210
1210
|
this._ctx.requireTokens();
|
|
1211
1211
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
1212
|
-
const body = stripUndef$
|
|
1212
|
+
const body = stripUndef$7({
|
|
1213
1213
|
name: name,
|
|
1214
1214
|
description: description,
|
|
1215
1215
|
confidence_value: confidenceValue,
|
|
@@ -1233,7 +1233,7 @@ class CuratedAlbums {
|
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
|
-
function stripUndef$
|
|
1236
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1237
1237
|
|
|
1238
1238
|
class CustomAlbums {
|
|
1239
1239
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1281,7 +1281,7 @@ class CustomAlbums {
|
|
|
1281
1281
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1282
1282
|
this._ctx.requireTokens();
|
|
1283
1283
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1284
|
-
const body = stripUndef$
|
|
1284
|
+
const body = stripUndef$6({
|
|
1285
1285
|
name: name,
|
|
1286
1286
|
description: description,
|
|
1287
1287
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1294,7 +1294,7 @@ class CustomAlbums {
|
|
|
1294
1294
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1295
1295
|
this._ctx.requireTokens();
|
|
1296
1296
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
1297
|
-
const body = stripUndef$
|
|
1297
|
+
const body = stripUndef$6({
|
|
1298
1298
|
name: name,
|
|
1299
1299
|
description: description,
|
|
1300
1300
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1394,7 +1394,7 @@ async function handleResponse(response) {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
1396
|
|
|
1397
|
-
function stripUndef$
|
|
1397
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1398
1398
|
|
|
1399
1399
|
class EmailTokens {
|
|
1400
1400
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1425,7 +1425,7 @@ class EmailTokens {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
|
|
1427
1427
|
async validateToken(token) {
|
|
1428
|
-
const body = stripUndef$
|
|
1428
|
+
const body = stripUndef$5({
|
|
1429
1429
|
token: token,
|
|
1430
1430
|
});
|
|
1431
1431
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -1437,7 +1437,7 @@ class EmailTokens {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
|
|
1439
1439
|
async resetPassword(token, newPassword) {
|
|
1440
|
-
const body = stripUndef$
|
|
1440
|
+
const body = stripUndef$5({
|
|
1441
1441
|
token: token,
|
|
1442
1442
|
new_password: newPassword,
|
|
1443
1443
|
});
|
|
@@ -1476,7 +1476,7 @@ class Health {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
-
function stripUndef$
|
|
1479
|
+
function stripUndef$4(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1480
1480
|
|
|
1481
1481
|
class Keywords {
|
|
1482
1482
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1484,7 +1484,7 @@ class Keywords {
|
|
|
1484
1484
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
1485
1485
|
this._ctx.requireTokens();
|
|
1486
1486
|
const path = `/api/v1/keyword/`;
|
|
1487
|
-
const body = stripUndef$
|
|
1487
|
+
const body = stripUndef$4({
|
|
1488
1488
|
name: name,
|
|
1489
1489
|
project_list: projectList,
|
|
1490
1490
|
});
|
|
@@ -1537,7 +1537,7 @@ class Keywords {
|
|
|
1537
1537
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1538
1538
|
this._ctx.requireTokens();
|
|
1539
1539
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1540
|
-
const body = stripUndef$
|
|
1540
|
+
const body = stripUndef$4({
|
|
1541
1541
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1542
1542
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1543
1543
|
});
|
|
@@ -1548,7 +1548,7 @@ class Keywords {
|
|
|
1548
1548
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1549
1549
|
this._ctx.requireTokens();
|
|
1550
1550
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1551
|
-
const body = stripUndef$
|
|
1551
|
+
const body = stripUndef$4({
|
|
1552
1552
|
name: name,
|
|
1553
1553
|
project_list: projectList,
|
|
1554
1554
|
});
|
|
@@ -1629,17 +1629,6 @@ class Keywords {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
1631
|
|
|
1632
|
-
class Media {
|
|
1633
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
1634
|
-
|
|
1635
|
-
async getProjectAccessQuery(projectTableName) {
|
|
1636
|
-
this._ctx.requireTokens();
|
|
1637
|
-
const path = `/api/v1/media/project/${encodeURIComponent(projectTableName)}/access_query`;
|
|
1638
|
-
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1639
|
-
return data;
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
1632
|
class OauthAuthorization {
|
|
1644
1633
|
constructor(ctx) { this._ctx = ctx; }
|
|
1645
1634
|
|
|
@@ -1824,7 +1813,7 @@ class Person {
|
|
|
1824
1813
|
}
|
|
1825
1814
|
}
|
|
1826
1815
|
|
|
1827
|
-
function stripUndef$
|
|
1816
|
+
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1828
1817
|
|
|
1829
1818
|
class Projects {
|
|
1830
1819
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1837,7 +1826,7 @@ class Projects {
|
|
|
1837
1826
|
if (models !== undefined) (Array.isArray(models) ? models : [models]).forEach(v => query.append('models', v));
|
|
1838
1827
|
const qs = query.toString();
|
|
1839
1828
|
if (qs) path += '?' + qs;
|
|
1840
|
-
const body = stripUndef$
|
|
1829
|
+
const body = stripUndef$3({
|
|
1841
1830
|
name: name,
|
|
1842
1831
|
private: private_,
|
|
1843
1832
|
type: type,
|
|
@@ -1907,7 +1896,7 @@ class Projects {
|
|
|
1907
1896
|
async updateProject(projectId, { private: private_, type, description, directory, name, thumbnail } = {}) {
|
|
1908
1897
|
this._ctx.requireTokens();
|
|
1909
1898
|
const path = `/api/v1/projects/${encodeURIComponent(projectId)}`;
|
|
1910
|
-
const body = stripUndef$
|
|
1899
|
+
const body = stripUndef$3({
|
|
1911
1900
|
private: private_,
|
|
1912
1901
|
type: type,
|
|
1913
1902
|
description: description,
|
|
@@ -1986,7 +1975,7 @@ class Projects {
|
|
|
1986
1975
|
async addProjectEvent(projectTableName, event, detail = undefined) {
|
|
1987
1976
|
this._ctx.requireTokens();
|
|
1988
1977
|
const path = `/api/v1/projects/${encodeURIComponent(projectTableName)}/event`;
|
|
1989
|
-
const body = stripUndef$
|
|
1978
|
+
const body = stripUndef$3({
|
|
1990
1979
|
event: event,
|
|
1991
1980
|
detail: detail,
|
|
1992
1981
|
});
|
|
@@ -2005,7 +1994,7 @@ class Projects {
|
|
|
2005
1994
|
class Photoupload {
|
|
2006
1995
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
2007
1996
|
|
|
2008
|
-
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr,
|
|
1997
|
+
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2009
1998
|
this._ctx.requireTokens();
|
|
2010
1999
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2011
2000
|
const headers = {
|
|
@@ -2015,7 +2004,7 @@ class Photoupload {
|
|
|
2015
2004
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2016
2005
|
method: 'POST',
|
|
2017
2006
|
headers,
|
|
2018
|
-
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr,
|
|
2007
|
+
body: JSON.stringify({ file_content: fileContent, file_path: filePath, mimetype, company_id: companyId, user_id: userId, project_table_name: projectTableName, blur, colors, face_recognition: faceRecognition, image_classification: imageClassification, image_comparison: imageComparison, image_describe: imageDescribe, ocr, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2019
2008
|
});
|
|
2020
2009
|
return handleResponse(resp);
|
|
2021
2010
|
}
|
|
@@ -2031,14 +2020,12 @@ class Photoupload {
|
|
|
2031
2020
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2032
2021
|
}
|
|
2033
2022
|
|
|
2034
|
-
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined),
|
|
2023
|
+
const upload_result = await this.uploadPhotoToMediaviz(photo.fileContent, photo.filePath, photo.mimetype, companyId, userId, projectTableName, (((template?.body?.['blur'] ?? template?.headers?.['x-blur']) === true || (template?.body?.['blur'] ?? template?.headers?.['x-blur']) === 'true') ? 'true' : undefined), (((template?.body?.['colors'] ?? template?.headers?.['x-colors']) === true || (template?.body?.['colors'] ?? template?.headers?.['x-colors']) === 'true') ? 'true' : undefined), (((template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === true || (template?.body?.['face_recognition'] ?? template?.headers?.['x-face-recognition']) === 'true') ? 'true' : undefined), (((template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === true || (template?.body?.['image_classification'] ?? template?.headers?.['x-image-classification']) === 'true') ? 'true' : undefined), (((template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === true || (template?.body?.['image_comparison'] ?? template?.headers?.['x-image-comparison']) === 'true') ? 'true' : undefined), (((template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === true || (template?.body?.['image_describe'] ?? template?.headers?.['x-image-describe']) === 'true') ? 'true' : undefined), (((template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === true || (template?.body?.['ocr'] ?? template?.headers?.['x-ocr']) === 'true') ? 'true' : undefined), { clientSideId: photo.clientSideId, format: photo.format, size: photo.size, sourceResolutionX: photo.sourceResolutionX, sourceResolutionY: photo.sourceResolutionY, dateTaken: photo.dateTaken, latitude: photo.latitude, longitude: photo.longitude });
|
|
2035
2024
|
|
|
2036
2025
|
return upload_result;
|
|
2037
2026
|
}
|
|
2038
2027
|
}
|
|
2039
2028
|
|
|
2040
|
-
function stripUndef$3(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
2041
|
-
|
|
2042
2029
|
class Photos {
|
|
2043
2030
|
constructor(ctx) { this._ctx = ctx; }
|
|
2044
2031
|
|
|
@@ -2100,16 +2087,16 @@ class Photos {
|
|
|
2100
2087
|
return data;
|
|
2101
2088
|
}
|
|
2102
2089
|
|
|
2103
|
-
async updatePhotoInProject(tableName, photoId,
|
|
2090
|
+
async updatePhotoInProject({ tableName, photoId, photoData } = {}) {
|
|
2104
2091
|
this._ctx.requireTokens();
|
|
2105
|
-
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken
|
|
2092
|
+
let path = `/api/v1/photos_update`;
|
|
2093
|
+
const query = new URLSearchParams();
|
|
2094
|
+
if (tableName !== undefined) (Array.isArray(tableName) ? tableName : [tableName]).forEach(v => query.append('table_name', v));
|
|
2095
|
+
if (photoId !== undefined) (Array.isArray(photoId) ? photoId : [photoId]).forEach(v => query.append('photo_id', v));
|
|
2096
|
+
if (photoData !== undefined) (Array.isArray(photoData) ? photoData : [photoData]).forEach(v => query.append('photo_data', v));
|
|
2097
|
+
const qs = query.toString();
|
|
2098
|
+
if (qs) path += '?' + qs;
|
|
2099
|
+
const { data } = await this._ctx.client.request(path, 'PUT', this._ctx.accessToken, this._ctx.refreshToken);
|
|
2113
2100
|
return data;
|
|
2114
2101
|
}
|
|
2115
2102
|
|
|
@@ -2459,7 +2446,6 @@ class _Context {
|
|
|
2459
2446
|
get refreshToken() { return this._mv._refreshToken; }
|
|
2460
2447
|
get baseUrl() { return this._mv._config.baseUrl; }
|
|
2461
2448
|
get hosts() { return this._mv._hosts; }
|
|
2462
|
-
get utils() { return this._mv.utils; }
|
|
2463
2449
|
requireHost(key) {
|
|
2464
2450
|
const url = this._mv._hosts[key];
|
|
2465
2451
|
if (!url) throw new Error(`Host '${key}' not configured. Pass hosts.${key} in MediaViz constructor or set the corresponding env var.`);
|
|
@@ -2482,51 +2468,6 @@ class _TokenTrackingClient {
|
|
|
2482
2468
|
}
|
|
2483
2469
|
}
|
|
2484
2470
|
|
|
2485
|
-
class _Utils {
|
|
2486
|
-
constructor(mv) { this._mv = mv; }
|
|
2487
|
-
async getMediaAccessQuery(projectTableName) {
|
|
2488
|
-
if (!this._mv._accessToken) throw new Error('Not authenticated. Call authenticate(), handleCallback(), or setTokens() first.');
|
|
2489
|
-
// Memo lives on the _Utils instance, so it is scoped to one MediaViz client
|
|
2490
|
-
// (one authenticated user) — keying on project alone cannot leak across users.
|
|
2491
|
-
if (!this._mediaQueryMemo) this._mediaQueryMemo = new Map();
|
|
2492
|
-
const _nowSec = Date.now() / 1000;
|
|
2493
|
-
const _memo = this._mediaQueryMemo.get(projectTableName);
|
|
2494
|
-
// Re-mint 60s early: an <img> load that starts just before expiry must not race
|
|
2495
|
-
// the policy going stale and 403 mid-flight.
|
|
2496
|
-
if (_memo && _memo.expiresEpoch - 60 > _nowSec) return _memo.result;
|
|
2497
|
-
|
|
2498
|
-
// Through the generated endpoint method, not a bare fetch: this inherits the
|
|
2499
|
-
// oauth client's 401-refresh-and-retry. Errors propagate — without a query
|
|
2500
|
-
// string there is nothing to render.
|
|
2501
|
-
const _result = await this._mv.media.getProjectAccessQuery(projectTableName);
|
|
2502
|
-
|
|
2503
|
-
const _expiresEpoch = Date.parse(_result.expires_at) / 1000;
|
|
2504
|
-
// Skip the memo on an unparseable expiry rather than cache something that can
|
|
2505
|
-
// never be invalidated.
|
|
2506
|
-
if (!Number.isNaN(_expiresEpoch)) {
|
|
2507
|
-
this._mediaQueryMemo.set(projectTableName, { expiresEpoch: _expiresEpoch, result: _result });
|
|
2508
|
-
}
|
|
2509
|
-
return _result;
|
|
2510
|
-
}
|
|
2511
|
-
async authorizeMediaUrl(photoUrl, projectTableName) {
|
|
2512
|
-
if (!this._mv._accessToken) throw new Error('Not authenticated. Call authenticate(), handleCallback(), or setTokens() first.');
|
|
2513
|
-
// Memoized upstream, so calling this once per tile in a grid still costs one
|
|
2514
|
-
// round trip for the whole project.
|
|
2515
|
-
const _access = await this.getMediaAccessQuery(projectTableName);
|
|
2516
|
-
|
|
2517
|
-
// Already signed: return untouched. Appending a second policy yields duplicate
|
|
2518
|
-
// Policy/Signature params and an opaque 403 at the edge, and the caller almost
|
|
2519
|
-
// certainly passed a URL this function already authorized.
|
|
2520
|
-
//
|
|
2521
|
-
// Keyed on Key-Pair-Id, not Policy: the query-string params are Policy /
|
|
2522
|
-
// Signature / Key-Pair-Id (NOT the CloudFront-* spelling the cookie path used),
|
|
2523
|
-
// and 'Policy' alone is generic enough to collide with an unrelated param.
|
|
2524
|
-
if (/[?&]Key-Pair-Id=/.test(photoUrl)) return photoUrl;
|
|
2525
|
-
|
|
2526
|
-
return photoUrl + (photoUrl.includes('?') ? '&' : '?') + _access.query_string;
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
2471
|
class MediaViz {
|
|
2531
2472
|
constructor(config = {}) {
|
|
2532
2473
|
this._config = {
|
|
@@ -2560,7 +2501,6 @@ class MediaViz {
|
|
|
2560
2501
|
this.emailTokens = new EmailTokens(_ctx);
|
|
2561
2502
|
this.health = new Health(_ctx);
|
|
2562
2503
|
this.keywords = new Keywords(_ctx);
|
|
2563
|
-
this.media = new Media(_ctx);
|
|
2564
2504
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
2565
2505
|
this.oAuthToken = new OauthToken(_ctx);
|
|
2566
2506
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
@@ -2572,7 +2512,6 @@ class MediaViz {
|
|
|
2572
2512
|
this.subscription = new Subscription(_ctx);
|
|
2573
2513
|
this.users = new Users(_ctx);
|
|
2574
2514
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2575
|
-
this.utils = new _Utils(this);
|
|
2576
2515
|
}
|
|
2577
2516
|
|
|
2578
2517
|
async authenticate() {
|
|
@@ -2983,4 +2922,4 @@ var _react_native = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
|
2983
2922
|
// Auto-generated — do not edit
|
|
2984
2923
|
const { createCryptoProvider, MemoryTokenStore, createSecureTokenStore, createKeychainTokenStore, startAuthSession, parseRedirectUrl, AuthSessionError, createSession } = _react_native;
|
|
2985
2924
|
|
|
2986
|
-
export { Admin, AiModelCredits, ApiError, AuthSessionError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords,
|
|
2925
|
+
export { Admin, AiModelCredits, ApiError, AuthSessionError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords, MediaViz, MemoryTokenStore, NotFoundError, OAuthClient, OAuthError, OAuthErrorCode, OauthAuthorization, OauthLogin, OauthToken, Person, Photos, Photoupload, Projects, RateLimitError, Search, ServerError, Subscription, Users, ValidationError, WEBHOOK_MODEL_COLUMNS, WEBHOOK_OUTCOME_MODELS, WebhookConsumer, configureCrypto, createCryptoProvider, createKeychainTokenStore, createSecureTokenStore, createSession, handleResponse, parseRedirectUrl, selectResultColumns, signWebhookPayload, startAuthSession, verifyWebhookSignature };
|
package/package.json
CHANGED