@mediaviz/react-native-sdk 1.10.0-rc.7 → 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 +87 -14
- package/dist/sdk.d.cts +217 -186
- package/dist/sdk.d.ts +217 -186
- package/dist/sdk.esm.d.ts +217 -186
- package/dist/sdk.esm.js +86 -15
- package/package.json +1 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -1113,6 +1113,8 @@ class AiModelCredits {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
+
function stripUndef$a(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1117
|
+
|
|
1116
1118
|
class Admin {
|
|
1117
1119
|
constructor(ctx) { this._ctx = ctx; }
|
|
1118
1120
|
|
|
@@ -1122,6 +1124,16 @@ class Admin {
|
|
|
1122
1124
|
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1123
1125
|
return data;
|
|
1124
1126
|
}
|
|
1127
|
+
|
|
1128
|
+
async adminSetCompanyCanManageApiClients(companyId, canManageApiClients) {
|
|
1129
|
+
this._ctx.requireTokens();
|
|
1130
|
+
const path = `/api/v1/admin/companies/${encodeURIComponent(companyId)}/can_manage_api_clients`;
|
|
1131
|
+
const body = stripUndef$a({
|
|
1132
|
+
can_manage_api_clients: canManageApiClients,
|
|
1133
|
+
});
|
|
1134
|
+
const { data } = await this._ctx.client.request(path, 'PATCH', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1135
|
+
return data;
|
|
1136
|
+
}
|
|
1125
1137
|
}
|
|
1126
1138
|
|
|
1127
1139
|
class Company {
|
|
@@ -1147,7 +1159,7 @@ class Company {
|
|
|
1147
1159
|
}
|
|
1148
1160
|
}
|
|
1149
1161
|
|
|
1150
|
-
function stripUndef$
|
|
1162
|
+
function stripUndef$9(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1151
1163
|
|
|
1152
1164
|
class CuratedAlbums {
|
|
1153
1165
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1155,7 +1167,7 @@ class CuratedAlbums {
|
|
|
1155
1167
|
async createCuratedAlbum(projectTableName, name, description = undefined, confidenceValue = undefined) {
|
|
1156
1168
|
this._ctx.requireTokens();
|
|
1157
1169
|
const path = `/api/v1/curated_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1158
|
-
const body = stripUndef$
|
|
1170
|
+
const body = stripUndef$9({
|
|
1159
1171
|
name: name,
|
|
1160
1172
|
description: description,
|
|
1161
1173
|
confidence_value: confidenceValue,
|
|
@@ -1209,7 +1221,7 @@ class CuratedAlbums {
|
|
|
1209
1221
|
async updateCuratedAlbum(albumId, { name, description, confidenceValue } = {}) {
|
|
1210
1222
|
this._ctx.requireTokens();
|
|
1211
1223
|
const path = `/api/v1/curated_album/${encodeURIComponent(albumId)}`;
|
|
1212
|
-
const body = stripUndef$
|
|
1224
|
+
const body = stripUndef$9({
|
|
1213
1225
|
name: name,
|
|
1214
1226
|
description: description,
|
|
1215
1227
|
confidence_value: confidenceValue,
|
|
@@ -1233,7 +1245,7 @@ class CuratedAlbums {
|
|
|
1233
1245
|
}
|
|
1234
1246
|
}
|
|
1235
1247
|
|
|
1236
|
-
function stripUndef$
|
|
1248
|
+
function stripUndef$8(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1237
1249
|
|
|
1238
1250
|
class CustomAlbums {
|
|
1239
1251
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1281,7 +1293,7 @@ class CustomAlbums {
|
|
|
1281
1293
|
async createProjectCustomAlbum(projectTableName, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1282
1294
|
this._ctx.requireTokens();
|
|
1283
1295
|
const path = `/api/v1/custom_album/project/${encodeURIComponent(projectTableName)}`;
|
|
1284
|
-
const body = stripUndef$
|
|
1296
|
+
const body = stripUndef$8({
|
|
1285
1297
|
name: name,
|
|
1286
1298
|
description: description,
|
|
1287
1299
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1294,7 +1306,7 @@ class CustomAlbums {
|
|
|
1294
1306
|
async updateCustomAlbum(albumId, { name, description, photoIdInclusionList, photoIdRemovalList } = {}) {
|
|
1295
1307
|
this._ctx.requireTokens();
|
|
1296
1308
|
const path = `/api/v1/custom_album/${encodeURIComponent(albumId)}`;
|
|
1297
|
-
const body = stripUndef$
|
|
1309
|
+
const body = stripUndef$8({
|
|
1298
1310
|
name: name,
|
|
1299
1311
|
description: description,
|
|
1300
1312
|
photo_id_inclusion_list: photoIdInclusionList,
|
|
@@ -1394,7 +1406,7 @@ async function handleResponse(response) {
|
|
|
1394
1406
|
}
|
|
1395
1407
|
}
|
|
1396
1408
|
|
|
1397
|
-
function stripUndef$
|
|
1409
|
+
function stripUndef$7(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1398
1410
|
|
|
1399
1411
|
class EmailTokens {
|
|
1400
1412
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1425,7 +1437,7 @@ class EmailTokens {
|
|
|
1425
1437
|
}
|
|
1426
1438
|
|
|
1427
1439
|
async validateToken(token) {
|
|
1428
|
-
const body = stripUndef$
|
|
1440
|
+
const body = stripUndef$7({
|
|
1429
1441
|
token: token,
|
|
1430
1442
|
});
|
|
1431
1443
|
const resp = await fetch(this._ctx.baseUrl + `/api/v1/validate-token`, {
|
|
@@ -1437,7 +1449,7 @@ class EmailTokens {
|
|
|
1437
1449
|
}
|
|
1438
1450
|
|
|
1439
1451
|
async resetPassword(token, newPassword) {
|
|
1440
|
-
const body = stripUndef$
|
|
1452
|
+
const body = stripUndef$7({
|
|
1441
1453
|
token: token,
|
|
1442
1454
|
new_password: newPassword,
|
|
1443
1455
|
});
|
|
@@ -1476,7 +1488,7 @@ class Health {
|
|
|
1476
1488
|
}
|
|
1477
1489
|
}
|
|
1478
1490
|
|
|
1479
|
-
function stripUndef$
|
|
1491
|
+
function stripUndef$6(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1480
1492
|
|
|
1481
1493
|
class Keywords {
|
|
1482
1494
|
constructor(ctx) { this._ctx = ctx; }
|
|
@@ -1484,7 +1496,7 @@ class Keywords {
|
|
|
1484
1496
|
async createKeywordFilteringList(name, projectList = undefined) {
|
|
1485
1497
|
this._ctx.requireTokens();
|
|
1486
1498
|
const path = `/api/v1/keyword/`;
|
|
1487
|
-
const body = stripUndef$
|
|
1499
|
+
const body = stripUndef$6({
|
|
1488
1500
|
name: name,
|
|
1489
1501
|
project_list: projectList,
|
|
1490
1502
|
});
|
|
@@ -1537,7 +1549,7 @@ class Keywords {
|
|
|
1537
1549
|
async updateKeywordFilteringListLabels(keywordListId, listKeywordsToInclude, listKeywordsToExclude) {
|
|
1538
1550
|
this._ctx.requireTokens();
|
|
1539
1551
|
const path = `/api/v1/keyword/${encodeURIComponent(keywordListId)}`;
|
|
1540
|
-
const body = stripUndef$
|
|
1552
|
+
const body = stripUndef$6({
|
|
1541
1553
|
list_keywords_to_include: listKeywordsToInclude,
|
|
1542
1554
|
list_keywords_to_exclude: listKeywordsToExclude,
|
|
1543
1555
|
});
|
|
@@ -1548,7 +1560,7 @@ class Keywords {
|
|
|
1548
1560
|
async updateKeywordFilteringListDetails(keywordListId, { name, projectList } = {}) {
|
|
1549
1561
|
this._ctx.requireTokens();
|
|
1550
1562
|
const path = `/api/v1/keyword/details/${encodeURIComponent(keywordListId)}`;
|
|
1551
|
-
const body = stripUndef$
|
|
1563
|
+
const body = stripUndef$6({
|
|
1552
1564
|
name: name,
|
|
1553
1565
|
project_list: projectList,
|
|
1554
1566
|
});
|
|
@@ -1681,6 +1693,36 @@ class OauthAuthorization {
|
|
|
1681
1693
|
}
|
|
1682
1694
|
}
|
|
1683
1695
|
|
|
1696
|
+
function stripUndef$5(o) { const r = {}; for (const k in o) if (o[k] !== undefined) r[k] = o[k]; return r; }
|
|
1697
|
+
|
|
1698
|
+
class OauthClients {
|
|
1699
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
1700
|
+
|
|
1701
|
+
async createApiCredential(credentialName) {
|
|
1702
|
+
this._ctx.requireTokens();
|
|
1703
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1704
|
+
const body = stripUndef$5({
|
|
1705
|
+
credential_name: credentialName,
|
|
1706
|
+
});
|
|
1707
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken, body);
|
|
1708
|
+
return data;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
async getCompanyApiCredentials() {
|
|
1712
|
+
this._ctx.requireTokens();
|
|
1713
|
+
const path = `/oauth/clients/api-credentials`;
|
|
1714
|
+
const { data } = await this._ctx.client.request(path, 'GET', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1715
|
+
return data;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
async revokeApiCredential(clientId) {
|
|
1719
|
+
this._ctx.requireTokens();
|
|
1720
|
+
const path = `/oauth/clients/api-credentials/${encodeURIComponent(clientId)}/revoke`;
|
|
1721
|
+
const { data } = await this._ctx.client.request(path, 'POST', this._ctx.accessToken, this._ctx.refreshToken);
|
|
1722
|
+
return data;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1684
1726
|
class OauthToken {
|
|
1685
1727
|
constructor(ctx) { this._ctx = ctx; }
|
|
1686
1728
|
|
|
@@ -2020,7 +2062,7 @@ class Photoupload {
|
|
|
2020
2062
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2021
2063
|
}
|
|
2022
2064
|
|
|
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), 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 });
|
|
2065
|
+
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 });
|
|
2024
2066
|
|
|
2025
2067
|
return upload_result;
|
|
2026
2068
|
}
|
|
@@ -2434,6 +2476,32 @@ class Users {
|
|
|
2434
2476
|
}
|
|
2435
2477
|
}
|
|
2436
2478
|
|
|
2479
|
+
class Webhookreceiver {
|
|
2480
|
+
constructor(ctx) { this._ctx = ctx; }
|
|
2481
|
+
|
|
2482
|
+
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2483
|
+
this._ctx.requireTokens();
|
|
2484
|
+
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2485
|
+
const headers = {
|
|
2486
|
+
'Content-Type': 'application/json',
|
|
2487
|
+
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2488
|
+
};
|
|
2489
|
+
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2490
|
+
const query = new URLSearchParams();
|
|
2491
|
+
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2492
|
+
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2493
|
+
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2494
|
+
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2495
|
+
const qs = query.toString();
|
|
2496
|
+
if (qs) path += '?' + qs;
|
|
2497
|
+
const resp = await fetch(baseUrl + path, {
|
|
2498
|
+
method: 'GET',
|
|
2499
|
+
headers,
|
|
2500
|
+
});
|
|
2501
|
+
return handleResponse(resp);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2437
2505
|
// Auto-generated — do not edit
|
|
2438
2506
|
|
|
2439
2507
|
function _env(key) {
|
|
@@ -2480,6 +2548,7 @@ class MediaViz {
|
|
|
2480
2548
|
};
|
|
2481
2549
|
this._hosts = {
|
|
2482
2550
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2551
|
+
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2483
2552
|
...(config.hosts || {}),
|
|
2484
2553
|
};
|
|
2485
2554
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2504,6 +2573,7 @@ class MediaViz {
|
|
|
2504
2573
|
this.health = new Health(_ctx);
|
|
2505
2574
|
this.keywords = new Keywords(_ctx);
|
|
2506
2575
|
this.oAuthAuthorization = new OauthAuthorization(_ctx);
|
|
2576
|
+
this.oAuthClients = new OauthClients(_ctx);
|
|
2507
2577
|
this.oAuthToken = new OauthToken(_ctx);
|
|
2508
2578
|
this.oauthLogin = new OauthLogin(_ctx);
|
|
2509
2579
|
this.person = new Person(_ctx);
|
|
@@ -2513,6 +2583,7 @@ class MediaViz {
|
|
|
2513
2583
|
this.search = new Search(_ctx);
|
|
2514
2584
|
this.subscription = new Subscription(_ctx);
|
|
2515
2585
|
this.users = new Users(_ctx);
|
|
2586
|
+
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2516
2587
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2517
2588
|
}
|
|
2518
2589
|
|
|
@@ -2924,4 +2995,4 @@ var _react_native = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
|
2924
2995
|
// Auto-generated — do not edit
|
|
2925
2996
|
const { createCryptoProvider, MemoryTokenStore, createSecureTokenStore, createKeychainTokenStore, startAuthSession, parseRedirectUrl, AuthSessionError, createSession } = _react_native;
|
|
2926
2997
|
|
|
2927
|
-
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 };
|
|
2998
|
+
export { Admin, AiModelCredits, ApiError, AuthSessionError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords, MediaViz, MemoryTokenStore, NotFoundError, OAuthClient, OAuthError, OAuthErrorCode, OauthAuthorization, OauthClients, OauthLogin, OauthToken, Person, Photos, Photoupload, Projects, RateLimitError, Search, ServerError, Subscription, Users, ValidationError, WEBHOOK_MODEL_COLUMNS, WEBHOOK_OUTCOME_MODELS, WebhookConsumer, Webhookreceiver, configureCrypto, createCryptoProvider, createKeychainTokenStore, createSecureTokenStore, createSession, handleResponse, parseRedirectUrl, selectResultColumns, signWebhookPayload, startAuthSession, verifyWebhookSignature };
|
package/package.json
CHANGED