@mediaviz/sdk 1.10.0 → 1.11.0-dev.125
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 +89 -16
- package/dist/sdk.d.cts +213 -172
- package/dist/sdk.d.ts +213 -172
- package/dist/sdk.esm.d.ts +213 -172
- package/dist/sdk.esm.js +88 -17
- package/dist/sdk.umd.js +89 -16
- package/package.json +1 -1
package/dist/sdk.cjs
CHANGED
|
@@ -1115,6 +1115,8 @@ class AiModelCredits {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
1117
1117
|
|
|
1118
|
+
function stripUndef$a(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1119
|
+
|
|
1118
1120
|
class Admin {
|
|
1119
1121
|
constructor(ctx) { this._ctx = ctx; }
|
|
1120
1122
|
|
|
@@ -1124,6 +1126,16 @@ class Admin {
|
|
|
1124
1126
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1125
1127
|
return data;
|
|
1126
1128
|
}
|
|
1129
|
+
|
|
1130
|
+
async adminSetCompanyCanManageApiClients(companyId, canManageApiClients) {
|
|
1131
|
+
this._ctx.requireTokens();
|
|
1132
|
+
const path = `/api/v1/admin/companies/${encodeURIComponent(companyId)}/can_manage_api_clients`;
|
|
1133
|
+
const body = stripUndef$a({
|
|
1134
|
+
can_manage_api_clients: canManageApiClients,
|
|
1135
|
+
});
|
|
1136
|
+
const { data } = await this._ctx.client.request(path, 'PATCH', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1137
|
+
return data;
|
|
1138
|
+
}
|
|
1127
1139
|
}
|
|
1128
1140
|
|
|
1129
1141
|
class Company {
|
|
@@ -1149,7 +1161,7 @@ class Company {
|
|
|
1149
1161
|
}
|
|
1150
1162
|
}
|
|
1151
1163
|
|
|
1152
|
-
function stripUndef$
|
|
1164
|
+
function stripUndef$9(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1153
1165
|
|
|
1154
1166
|
class CuratedAlbums {
|
|
1155
1167
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1157,7 +1169,7 @@ class CuratedAlbums {
|
|
|
1157
1169
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
1158
1170
|
this._ctx.requireTokens();
|
|
1159
1171
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1160
|
-
const body = stripUndef$
|
|
1172
|
+
const body = stripUndef$9({
|
|
1161
1173
|
name: name,
|
|
1162
1174
|
description: description,
|
|
1163
1175
|
confidence_value: confidenceValue,
|
|
@@ -1211,7 +1223,7 @@ class CuratedAlbums {
|
|
|
1211
1223
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
1212
1224
|
this._ctx.requireTokens();
|
|
1213
1225
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
1214
|
-
const body = stripUndef$
|
|
1226
|
+
const body = stripUndef$9({
|
|
1215
1227
|
name: name,
|
|
1216
1228
|
description: description,
|
|
1217
1229
|
confidence_value: confidenceValue,
|
|
@@ -1235,7 +1247,7 @@ class CuratedAlbums {
|
|
|
1235
1247
|
}
|
|
1236
1248
|
}
|
|
1237
1249
|
|
|
1238
|
-
function stripUndef$
|
|
1250
|
+
function stripUndef$8(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1239
1251
|
|
|
1240
1252
|
class CustomAlbums {
|
|
1241
1253
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1283,7 +1295,7 @@ class CustomAlbums {
|
|
|
1283
1295
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1284
1296
|
this._ctx.requireTokens();
|
|
1285
1297
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1286
|
-
const body = stripUndef$
|
|
1298
|
+
const body = stripUndef$8({
|
|
1287
1299
|
name: name,
|
|
1288
1300
|
description: description,
|
|
1289
1301
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1296,7 +1308,7 @@ class CustomAlbums {
|
|
|
1296
1308
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1297
1309
|
this._ctx.requireTokens();
|
|
1298
1310
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
1299
|
-
const body = stripUndef$
|
|
1311
|
+
const body = stripUndef$8({
|
|
1300
1312
|
name: name,
|
|
1301
1313
|
description: description,
|
|
1302
1314
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1396,7 +1408,7 @@ async function handleResponse(response) {
|
|
|
1396
1408
|
}
|
|
1397
1409
|
}
|
|
1398
1410
|
|
|
1399
|
-
function stripUndef$
|
|
1411
|
+
function stripUndef$7(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1400
1412
|
|
|
1401
1413
|
class EmailTokens {
|
|
1402
1414
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1427,7 +1439,7 @@ class EmailTokens {
|
|
|
1427
1439
|
}
|
|
1428
1440
|
|
|
1429
1441
|
async validateToken(token) {
|
|
1430
|
-
const body = stripUndef$
|
|
1442
|
+
const body = stripUndef$7({
|
|
1431
1443
|
token: token,
|
|
1432
1444
|
});
|
|
1433
1445
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -1439,7 +1451,7 @@ class EmailTokens {
|
|
|
1439
1451
|
}
|
|
1440
1452
|
|
|
1441
1453
|
async resetPassword(token, newPassword) {
|
|
1442
|
-
const body = stripUndef$
|
|
1454
|
+
const body = stripUndef$7({
|
|
1443
1455
|
token: token,
|
|
1444
1456
|
new_password: newPassword,
|
|
1445
1457
|
});
|
|
@@ -1478,7 +1490,7 @@ class Health {
|
|
|
1478
1490
|
}
|
|
1479
1491
|
}
|
|
1480
1492
|
|
|
1481
|
-
function stripUndef$
|
|
1493
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1482
1494
|
|
|
1483
1495
|
class Keywords {
|
|
1484
1496
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1486,7 +1498,7 @@ class Keywords {
|
|
|
1486
1498
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
1487
1499
|
this._ctx.requireTokens();
|
|
1488
1500
|
const path = `/api/v1/keyword/`;
|
|
1489
|
-
const body = stripUndef$
|
|
1501
|
+
const body = stripUndef$6({
|
|
1490
1502
|
name: name,
|
|
1491
1503
|
project_list: projectList,
|
|
1492
1504
|
});
|
|
@@ -1539,7 +1551,7 @@ class Keywords {
|
|
|
1539
1551
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1540
1552
|
this._ctx.requireTokens();
|
|
1541
1553
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1542
|
-
const body = stripUndef$
|
|
1554
|
+
const body = stripUndef$6({
|
|
1543
1555
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1544
1556
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1545
1557
|
});
|
|
@@ -1550,7 +1562,7 @@ class Keywords {
|
|
|
1550
1562
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1551
1563
|
this._ctx.requireTokens();
|
|
1552
1564
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1553
|
-
const body = stripUndef$
|
|
1565
|
+
const body = stripUndef$6({
|
|
1554
1566
|
name: name,
|
|
1555
1567
|
project_list: projectList,
|
|
1556
1568
|
});
|
|
@@ -1683,6 +1695,36 @@ class OauthAuthorization {
|
|
|
1683
1695
|
}
|
|
1684
1696
|
}
|
|
1685
1697
|
|
|
1698
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1699
|
+
|
|
1700
|
+
class OauthClients {
|
|
1701
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
1702
|
+
|
|
1703
|
+
async createApiCredential(credentialName) {
|
|
1704
|
+
this._ctx.requireTokens();
|
|
1705
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1706
|
+
const body = stripUndef$5({
|
|
1707
|
+
credential_name: credentialName,
|
|
1708
|
+
});
|
|
1709
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1710
|
+
return data;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
async getCompanyApiCredentials() {
|
|
1714
|
+
this._ctx.requireTokens();
|
|
1715
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1716
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1717
|
+
return data;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
async revokeApiCredential(clientId) {
|
|
1721
|
+
this._ctx.requireTokens();
|
|
1722
|
+
const path = `/oauth/clients/api-credentials/${encodeURIComponent(clientId)}/revoke`;
|
|
1723
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1724
|
+
return data;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1686
1728
|
class OauthToken {
|
|
1687
1729
|
constructor(ctx) { this._ctx = ctx; }
|
|
1688
1730
|
|
|
@@ -1996,7 +2038,7 @@ class Projects {
|
|
|
1996
2038
|
class Photoupload {
|
|
1997
2039
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1998
2040
|
|
|
1999
|
-
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2041
|
+
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, judgment, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2000
2042
|
this._ctx.requireTokens();
|
|
2001
2043
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2002
2044
|
const headers = {
|
|
@@ -2006,7 +2048,7 @@ class Photoupload {
|
|
|
2006
2048
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2007
2049
|
method: 'POST',
|
|
2008
2050
|
headers,
|
|
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 }),
|
|
2051
|
+
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, judgment, client_side_id: clientSideId, format, size, source_resolution_x: sourceResolutionX, source_resolution_y: sourceResolutionY, date_taken: dateTaken, latitude, longitude }),
|
|
2010
2052
|
});
|
|
2011
2053
|
return handleResponse(resp);
|
|
2012
2054
|
}
|
|
@@ -2022,7 +2064,7 @@ class Photoupload {
|
|
|
2022
2064
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2023
2065
|
}
|
|
2024
2066
|
|
|
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 });
|
|
2067
|
+
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), (((template?.body?.['judgment'] ?? template?.headers?.['x-judgment']) === true || (template?.body?.['judgment'] ?? template?.headers?.['x-judgment']) === '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 });
|
|
2026
2068
|
|
|
2027
2069
|
return upload_result;
|
|
2028
2070
|
}
|
|
@@ -2436,6 +2478,32 @@ class Users {
|
|
|
2436
2478
|
}
|
|
2437
2479
|
}
|
|
2438
2480
|
|
|
2481
|
+
class Webhookreceiver {
|
|
2482
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
2483
|
+
|
|
2484
|
+
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2485
|
+
this._ctx.requireTokens();
|
|
2486
|
+
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2487
|
+
const headers = {
|
|
2488
|
+
'Content-Type': 'application/json',
|
|
2489
|
+
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2490
|
+
};
|
|
2491
|
+
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2492
|
+
const query = new URLSearchParams();
|
|
2493
|
+
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2494
|
+
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2495
|
+
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2496
|
+
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2497
|
+
const qs = query.toString();
|
|
2498
|
+
if (qs) path += '?' + qs;
|
|
2499
|
+
const resp = await fetch(baseUrl + path, {
|
|
2500
|
+
method: 'GET',
|
|
2501
|
+
headers,
|
|
2502
|
+
});
|
|
2503
|
+
return handleResponse(resp);
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2439
2507
|
// Auto-generated — do not edit
|
|
2440
2508
|
|
|
2441
2509
|
function _env(key) {
|
|
@@ -2482,6 +2550,7 @@ class MediaViz {
|
|
|
2482
2550
|
};
|
|
2483
2551
|
this._hosts = {
|
|
2484
2552
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2553
|
+
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2485
2554
|
...(config.hosts || {}),
|
|
2486
2555
|
};
|
|
2487
2556
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2506,6 +2575,7 @@ class MediaViz {
|
|
|
2506
2575
|
this.health = new Health(_ctx);
|
|
2507
2576
|
this.keywords = new Keywords(_ctx);
|
|
2508
2577
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
2578
|
+
this.oAuthClients = new OauthClients(_ctx);
|
|
2509
2579
|
this.oAuthToken = new OauthToken(_ctx);
|
|
2510
2580
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
2511
2581
|
this.person = new Person(_ctx);
|
|
@@ -2515,6 +2585,7 @@ class MediaViz {
|
|
|
2515
2585
|
this.search = new Search(_ctx);
|
|
2516
2586
|
this.subscription = new Subscription(_ctx);
|
|
2517
2587
|
this.users = new Users(_ctx);
|
|
2588
|
+
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2518
2589
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2519
2590
|
}
|
|
2520
2591
|
|
|
@@ -2561,6 +2632,7 @@ exports.OAuthClient = OAuthClient;
|
|
|
2561
2632
|
exports.OAuthError = OAuthError;
|
|
2562
2633
|
exports.OAuthErrorCode = OAuthErrorCode;
|
|
2563
2634
|
exports.OauthAuthorization = OauthAuthorization;
|
|
2635
|
+
exports.OauthClients = OauthClients;
|
|
2564
2636
|
exports.OauthLogin = OauthLogin;
|
|
2565
2637
|
exports.OauthToken = OauthToken;
|
|
2566
2638
|
exports.Person = Person;
|
|
@@ -2576,6 +2648,7 @@ exports.ValidationError = ValidationError;
|
|
|
2576
2648
|
exports.WEBHOOK_MODEL_COLUMNS = WEBHOOK_MODEL_COLUMNS;
|
|
2577
2649
|
exports.WEBHOOK_OUTCOME_MODELS = WEBHOOK_OUTCOME_MODELS;
|
|
2578
2650
|
exports.WebhookConsumer = WebhookConsumer;
|
|
2651
|
+
exports.Webhookreceiver = Webhookreceiver;
|
|
2579
2652
|
exports.configureCrypto = configureCrypto;
|
|
2580
2653
|
exports.handleResponse = handleResponse;
|
|
2581
2654
|
exports.selectResultColumns = selectResultColumns;
|