@mediaviz/sdk 1.10.0-rc.8 → 1.10.0
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 +3 -32
- package/dist/sdk.d.cts +1 -16
- package/dist/sdk.d.ts +1 -16
- package/dist/sdk.esm.d.ts +1 -16
- package/dist/sdk.esm.js +4 -32
- package/dist/sdk.umd.js +3 -32
- package/package.json +1 -1
package/dist/sdk.cjs
CHANGED
|
@@ -1996,7 +1996,7 @@ class Projects {
|
|
|
1996
1996
|
class Photoupload {
|
|
1997
1997
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1998
1998
|
|
|
1999
|
-
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 } = {}) {
|
|
2000
2000
|
this._ctx.requireTokens();
|
|
2001
2001
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2002
2002
|
const headers = {
|
|
@@ -2006,7 +2006,7 @@ class Photoupload {
|
|
|
2006
2006
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2007
2007
|
method: 'POST',
|
|
2008
2008
|
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,
|
|
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 }),
|
|
2010
2010
|
});
|
|
2011
2011
|
return handleResponse(resp);
|
|
2012
2012
|
}
|
|
@@ -2022,7 +2022,7 @@ class Photoupload {
|
|
|
2022
2022
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2023
2023
|
}
|
|
2024
2024
|
|
|
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),
|
|
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 });
|
|
2026
2026
|
|
|
2027
2027
|
return upload_result;
|
|
2028
2028
|
}
|
|
@@ -2436,32 +2436,6 @@ class Users {
|
|
|
2436
2436
|
}
|
|
2437
2437
|
}
|
|
2438
2438
|
|
|
2439
|
-
class Webhookreceiver {
|
|
2440
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
2441
|
-
|
|
2442
|
-
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2443
|
-
this._ctx.requireTokens();
|
|
2444
|
-
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2445
|
-
const headers = {
|
|
2446
|
-
'Content-Type': 'application/json',
|
|
2447
|
-
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2448
|
-
};
|
|
2449
|
-
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2450
|
-
const query = new URLSearchParams();
|
|
2451
|
-
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2452
|
-
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2453
|
-
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2454
|
-
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2455
|
-
const qs = query.toString();
|
|
2456
|
-
if (qs) path += '?' + qs;
|
|
2457
|
-
const resp = await fetch(baseUrl + path, {
|
|
2458
|
-
method: 'GET',
|
|
2459
|
-
headers,
|
|
2460
|
-
});
|
|
2461
|
-
return handleResponse(resp);
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
2439
|
// Auto-generated — do not edit
|
|
2466
2440
|
|
|
2467
2441
|
function _env(key) {
|
|
@@ -2508,7 +2482,6 @@ class MediaViz {
|
|
|
2508
2482
|
};
|
|
2509
2483
|
this._hosts = {
|
|
2510
2484
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2511
|
-
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2512
2485
|
...(config.hosts || {}),
|
|
2513
2486
|
};
|
|
2514
2487
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2542,7 +2515,6 @@ class MediaViz {
|
|
|
2542
2515
|
this.search = new Search(_ctx);
|
|
2543
2516
|
this.subscription = new Subscription(_ctx);
|
|
2544
2517
|
this.users = new Users(_ctx);
|
|
2545
|
-
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2546
2518
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2547
2519
|
}
|
|
2548
2520
|
|
|
@@ -2604,7 +2576,6 @@ exports.ValidationError = ValidationError;
|
|
|
2604
2576
|
exports.WEBHOOK_MODEL_COLUMNS = WEBHOOK_MODEL_COLUMNS;
|
|
2605
2577
|
exports.WEBHOOK_OUTCOME_MODELS = WEBHOOK_OUTCOME_MODELS;
|
|
2606
2578
|
exports.WebhookConsumer = WebhookConsumer;
|
|
2607
|
-
exports.Webhookreceiver = Webhookreceiver;
|
|
2608
2579
|
exports.configureCrypto = configureCrypto;
|
|
2609
2580
|
exports.handleResponse = handleResponse;
|
|
2610
2581
|
exports.selectResultColumns = selectResultColumns;
|
package/dist/sdk.d.cts
CHANGED
|
@@ -268,15 +268,6 @@ export interface PhotoDisplay {
|
|
|
268
268
|
hue_values?: number[];
|
|
269
269
|
light_values?: number[];
|
|
270
270
|
saturation_values?: number[];
|
|
271
|
-
aesthetic_appeal?: number;
|
|
272
|
-
lighting?: number;
|
|
273
|
-
subject_significance?: number;
|
|
274
|
-
emotional_intensity?: number;
|
|
275
|
-
positive_emotion?: number;
|
|
276
|
-
universal_relatability?: number;
|
|
277
|
-
memorability?: number;
|
|
278
|
-
composition?: number;
|
|
279
|
-
judgment_overall_score?: number;
|
|
280
271
|
user_id: number;
|
|
281
272
|
company_id: number;
|
|
282
273
|
id: number;
|
|
@@ -375,7 +366,6 @@ export interface ProjectRunDisplay {
|
|
|
375
366
|
image_comparison_model?: boolean;
|
|
376
367
|
image_describe_model?: boolean;
|
|
377
368
|
ocr_model?: boolean;
|
|
378
|
-
judgment_model?: boolean;
|
|
379
369
|
similarity_model?: boolean;
|
|
380
370
|
personhood_model?: boolean;
|
|
381
371
|
evidence_model?: boolean;
|
|
@@ -542,7 +532,7 @@ export class Person {
|
|
|
542
532
|
}
|
|
543
533
|
|
|
544
534
|
export class Photoupload {
|
|
545
|
-
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,
|
|
535
|
+
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>;
|
|
546
536
|
uploadPhoto(companyId: string, userId: string, projectTableName: string, photo: Record<string, any>): Promise<any>;
|
|
547
537
|
}
|
|
548
538
|
|
|
@@ -611,10 +601,6 @@ export class Users {
|
|
|
611
601
|
deleteUser(userId: number, options?: { newCompanyOwnerId?: number | number[] }): Promise<Record<string, any>>;
|
|
612
602
|
}
|
|
613
603
|
|
|
614
|
-
export class Webhookreceiver {
|
|
615
|
-
listSubscriptionEvents(subscriptionId: string, options?: { since?: string | string[], limit?: number | number[], wait?: number | number[], includeHeavy?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
604
|
export class MediaViz {
|
|
619
605
|
constructor(config?: MediaVizConfig);
|
|
620
606
|
authenticate(): Promise<TokenResponse>;
|
|
@@ -641,7 +627,6 @@ export class MediaViz {
|
|
|
641
627
|
readonly search: Search;
|
|
642
628
|
readonly subscription: Subscription;
|
|
643
629
|
readonly users: Users;
|
|
644
|
-
readonly webhookReceiver: Webhookreceiver;
|
|
645
630
|
readonly webhooks: WebhookConsumer;
|
|
646
631
|
}
|
|
647
632
|
|
package/dist/sdk.d.ts
CHANGED
|
@@ -268,15 +268,6 @@ export interface PhotoDisplay {
|
|
|
268
268
|
hue_values?: number[];
|
|
269
269
|
light_values?: number[];
|
|
270
270
|
saturation_values?: number[];
|
|
271
|
-
aesthetic_appeal?: number;
|
|
272
|
-
lighting?: number;
|
|
273
|
-
subject_significance?: number;
|
|
274
|
-
emotional_intensity?: number;
|
|
275
|
-
positive_emotion?: number;
|
|
276
|
-
universal_relatability?: number;
|
|
277
|
-
memorability?: number;
|
|
278
|
-
composition?: number;
|
|
279
|
-
judgment_overall_score?: number;
|
|
280
271
|
user_id: number;
|
|
281
272
|
company_id: number;
|
|
282
273
|
id: number;
|
|
@@ -375,7 +366,6 @@ export interface ProjectRunDisplay {
|
|
|
375
366
|
image_comparison_model?: boolean;
|
|
376
367
|
image_describe_model?: boolean;
|
|
377
368
|
ocr_model?: boolean;
|
|
378
|
-
judgment_model?: boolean;
|
|
379
369
|
similarity_model?: boolean;
|
|
380
370
|
personhood_model?: boolean;
|
|
381
371
|
evidence_model?: boolean;
|
|
@@ -542,7 +532,7 @@ export class Person {
|
|
|
542
532
|
}
|
|
543
533
|
|
|
544
534
|
export class Photoupload {
|
|
545
|
-
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,
|
|
535
|
+
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>;
|
|
546
536
|
uploadPhoto(companyId: string, userId: string, projectTableName: string, photo: Record<string, any>): Promise<any>;
|
|
547
537
|
}
|
|
548
538
|
|
|
@@ -611,10 +601,6 @@ export class Users {
|
|
|
611
601
|
deleteUser(userId: number, options?: { newCompanyOwnerId?: number | number[] }): Promise<Record<string, any>>;
|
|
612
602
|
}
|
|
613
603
|
|
|
614
|
-
export class Webhookreceiver {
|
|
615
|
-
listSubscriptionEvents(subscriptionId: string, options?: { since?: string | string[], limit?: number | number[], wait?: number | number[], includeHeavy?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
604
|
export class MediaViz {
|
|
619
605
|
constructor(config?: MediaVizConfig);
|
|
620
606
|
authenticate(): Promise<TokenResponse>;
|
|
@@ -641,7 +627,6 @@ export class MediaViz {
|
|
|
641
627
|
readonly search: Search;
|
|
642
628
|
readonly subscription: Subscription;
|
|
643
629
|
readonly users: Users;
|
|
644
|
-
readonly webhookReceiver: Webhookreceiver;
|
|
645
630
|
readonly webhooks: WebhookConsumer;
|
|
646
631
|
}
|
|
647
632
|
|
package/dist/sdk.esm.d.ts
CHANGED
|
@@ -268,15 +268,6 @@ export interface PhotoDisplay {
|
|
|
268
268
|
hue_values?: number[];
|
|
269
269
|
light_values?: number[];
|
|
270
270
|
saturation_values?: number[];
|
|
271
|
-
aesthetic_appeal?: number;
|
|
272
|
-
lighting?: number;
|
|
273
|
-
subject_significance?: number;
|
|
274
|
-
emotional_intensity?: number;
|
|
275
|
-
positive_emotion?: number;
|
|
276
|
-
universal_relatability?: number;
|
|
277
|
-
memorability?: number;
|
|
278
|
-
composition?: number;
|
|
279
|
-
judgment_overall_score?: number;
|
|
280
271
|
user_id: number;
|
|
281
272
|
company_id: number;
|
|
282
273
|
id: number;
|
|
@@ -375,7 +366,6 @@ export interface ProjectRunDisplay {
|
|
|
375
366
|
image_comparison_model?: boolean;
|
|
376
367
|
image_describe_model?: boolean;
|
|
377
368
|
ocr_model?: boolean;
|
|
378
|
-
judgment_model?: boolean;
|
|
379
369
|
similarity_model?: boolean;
|
|
380
370
|
personhood_model?: boolean;
|
|
381
371
|
evidence_model?: boolean;
|
|
@@ -542,7 +532,7 @@ export class Person {
|
|
|
542
532
|
}
|
|
543
533
|
|
|
544
534
|
export class Photoupload {
|
|
545
|
-
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,
|
|
535
|
+
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>;
|
|
546
536
|
uploadPhoto(companyId: string, userId: string, projectTableName: string, photo: Record<string, any>): Promise<any>;
|
|
547
537
|
}
|
|
548
538
|
|
|
@@ -611,10 +601,6 @@ export class Users {
|
|
|
611
601
|
deleteUser(userId: number, options?: { newCompanyOwnerId?: number | number[] }): Promise<Record<string, any>>;
|
|
612
602
|
}
|
|
613
603
|
|
|
614
|
-
export class Webhookreceiver {
|
|
615
|
-
listSubscriptionEvents(subscriptionId: string, options?: { since?: string | string[], limit?: number | number[], wait?: number | number[], includeHeavy?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
604
|
export class MediaViz {
|
|
619
605
|
constructor(config?: MediaVizConfig);
|
|
620
606
|
authenticate(): Promise<TokenResponse>;
|
|
@@ -641,7 +627,6 @@ export class MediaViz {
|
|
|
641
627
|
readonly search: Search;
|
|
642
628
|
readonly subscription: Subscription;
|
|
643
629
|
readonly users: Users;
|
|
644
|
-
readonly webhookReceiver: Webhookreceiver;
|
|
645
630
|
readonly webhooks: WebhookConsumer;
|
|
646
631
|
}
|
|
647
632
|
|
package/dist/sdk.esm.js
CHANGED
|
@@ -1994,7 +1994,7 @@ class Projects {
|
|
|
1994
1994
|
class Photoupload {
|
|
1995
1995
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
1996
1996
|
|
|
1997
|
-
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 } = {}) {
|
|
1998
1998
|
this._ctx.requireTokens();
|
|
1999
1999
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2000
2000
|
const headers = {
|
|
@@ -2004,7 +2004,7 @@ class Photoupload {
|
|
|
2004
2004
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2005
2005
|
method: 'POST',
|
|
2006
2006
|
headers,
|
|
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,
|
|
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 }),
|
|
2008
2008
|
});
|
|
2009
2009
|
return handleResponse(resp);
|
|
2010
2010
|
}
|
|
@@ -2020,7 +2020,7 @@ class Photoupload {
|
|
|
2020
2020
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2021
2021
|
}
|
|
2022
2022
|
|
|
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),
|
|
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 });
|
|
2024
2024
|
|
|
2025
2025
|
return upload_result;
|
|
2026
2026
|
}
|
|
@@ -2434,32 +2434,6 @@ class Users {
|
|
|
2434
2434
|
}
|
|
2435
2435
|
}
|
|
2436
2436
|
|
|
2437
|
-
class Webhookreceiver {
|
|
2438
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
2439
|
-
|
|
2440
|
-
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2441
|
-
this._ctx.requireTokens();
|
|
2442
|
-
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2443
|
-
const headers = {
|
|
2444
|
-
'Content-Type': 'application/json',
|
|
2445
|
-
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2446
|
-
};
|
|
2447
|
-
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2448
|
-
const query = new URLSearchParams();
|
|
2449
|
-
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2450
|
-
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2451
|
-
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2452
|
-
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2453
|
-
const qs = query.toString();
|
|
2454
|
-
if (qs) path += '?' + qs;
|
|
2455
|
-
const resp = await fetch(baseUrl + path, {
|
|
2456
|
-
method: 'GET',
|
|
2457
|
-
headers,
|
|
2458
|
-
});
|
|
2459
|
-
return handleResponse(resp);
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
2437
|
// Auto-generated — do not edit
|
|
2464
2438
|
|
|
2465
2439
|
function _env(key) {
|
|
@@ -2506,7 +2480,6 @@ class MediaViz {
|
|
|
2506
2480
|
};
|
|
2507
2481
|
this._hosts = {
|
|
2508
2482
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2509
|
-
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2510
2483
|
...(config.hosts || {}),
|
|
2511
2484
|
};
|
|
2512
2485
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2540,7 +2513,6 @@ class MediaViz {
|
|
|
2540
2513
|
this.search = new Search(_ctx);
|
|
2541
2514
|
this.subscription = new Subscription(_ctx);
|
|
2542
2515
|
this.users = new Users(_ctx);
|
|
2543
|
-
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2544
2516
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2545
2517
|
}
|
|
2546
2518
|
|
|
@@ -2571,4 +2543,4 @@ class MediaViz {
|
|
|
2571
2543
|
get refreshToken() { return this._refreshToken; }
|
|
2572
2544
|
}
|
|
2573
2545
|
|
|
2574
|
-
export { Admin, AiModelCredits, ApiError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords, MediaViz, NotFoundError, OAuthClient, OAuthError, OAuthErrorCode, OauthAuthorization, OauthLogin, OauthToken, Person, Photos, Photoupload, Projects, RateLimitError, Search, ServerError, Subscription, Users, ValidationError, WEBHOOK_MODEL_COLUMNS, WEBHOOK_OUTCOME_MODELS, WebhookConsumer,
|
|
2546
|
+
export { Admin, AiModelCredits, ApiError, Company, CuratedAlbums, CustomAlbums, EmailTokens, Health, InMemoryWebhookStore, Keywords, MediaViz, 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, handleResponse, selectResultColumns, signWebhookPayload, verifyWebhookSignature };
|
package/dist/sdk.umd.js
CHANGED
|
@@ -2000,7 +2000,7 @@
|
|
|
2000
2000
|
class Photoupload {
|
|
2001
2001
|
constructor(ctx) { this._ctx = ctx; this._caches = {}; }
|
|
2002
2002
|
|
|
2003
|
-
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr,
|
|
2003
|
+
async uploadPhotoToMediaviz(fileContent, filePath, mimetype, companyId, userId, projectTableName, blur, colors, faceRecognition, imageClassification, imageComparison, imageDescribe, ocr, { clientSideId, format, size, sourceResolutionX, sourceResolutionY, dateTaken, latitude, longitude } = {}) {
|
|
2004
2004
|
this._ctx.requireTokens();
|
|
2005
2005
|
const baseUrl = this._ctx.requireHost('photoUpload');
|
|
2006
2006
|
const headers = {
|
|
@@ -2010,7 +2010,7 @@
|
|
|
2010
2010
|
const resp = await fetch(baseUrl + `/photo_upload`, {
|
|
2011
2011
|
method: 'POST',
|
|
2012
2012
|
headers,
|
|
2013
|
-
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,
|
|
2013
|
+
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 }),
|
|
2014
2014
|
});
|
|
2015
2015
|
return handleResponse(resp);
|
|
2016
2016
|
}
|
|
@@ -2026,7 +2026,7 @@
|
|
|
2026
2026
|
this._caches['_get_template'].set(_cacheKey_get_template, template);
|
|
2027
2027
|
}
|
|
2028
2028
|
|
|
2029
|
-
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),
|
|
2029
|
+
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 });
|
|
2030
2030
|
|
|
2031
2031
|
return upload_result;
|
|
2032
2032
|
}
|
|
@@ -2440,32 +2440,6 @@
|
|
|
2440
2440
|
}
|
|
2441
2441
|
}
|
|
2442
2442
|
|
|
2443
|
-
class Webhookreceiver {
|
|
2444
|
-
constructor(ctx) { this._ctx = ctx; }
|
|
2445
|
-
|
|
2446
|
-
async listSubscriptionEvents(subscriptionId, { since, limit, wait, includeHeavy } = {}) {
|
|
2447
|
-
this._ctx.requireTokens();
|
|
2448
|
-
const baseUrl = this._ctx.requireHost('webhookReceiver');
|
|
2449
|
-
const headers = {
|
|
2450
|
-
'Content-Type': 'application/json',
|
|
2451
|
-
'Authorization': `Bearer ${this._ctx.accessToken}`,
|
|
2452
|
-
};
|
|
2453
|
-
let path = `/api/v1/subscriptions/${encodeURIComponent(subscriptionId)}/events`;
|
|
2454
|
-
const query = new URLSearchParams();
|
|
2455
|
-
if (since !== undefined) (Array.isArray(since) ? since : [since]).forEach(v => query.append('since', v));
|
|
2456
|
-
if (limit !== undefined) (Array.isArray(limit) ? limit : [limit]).forEach(v => query.append('limit', v));
|
|
2457
|
-
if (wait !== undefined) (Array.isArray(wait) ? wait : [wait]).forEach(v => query.append('wait', v));
|
|
2458
|
-
if (includeHeavy !== undefined) (Array.isArray(includeHeavy) ? includeHeavy : [includeHeavy]).forEach(v => query.append('include_heavy', v));
|
|
2459
|
-
const qs = query.toString();
|
|
2460
|
-
if (qs) path += '?' + qs;
|
|
2461
|
-
const resp = await fetch(baseUrl + path, {
|
|
2462
|
-
method: 'GET',
|
|
2463
|
-
headers,
|
|
2464
|
-
});
|
|
2465
|
-
return handleResponse(resp);
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
2443
|
// Auto-generated — do not edit
|
|
2470
2444
|
|
|
2471
2445
|
function _env(key) {
|
|
@@ -2512,7 +2486,6 @@
|
|
|
2512
2486
|
};
|
|
2513
2487
|
this._hosts = {
|
|
2514
2488
|
photoUpload: config.hosts?.photoUpload ?? _env('MEDIAVIZ_PHOTO_UPLOAD_URL'),
|
|
2515
|
-
webhookReceiver: config.hosts?.webhookReceiver ?? _env('MEDIAVIZ_WEBHOOK_RECEIVER_URL'),
|
|
2516
2489
|
...(config.hosts || {}),
|
|
2517
2490
|
};
|
|
2518
2491
|
this._accessToken = config.accessToken ?? null;
|
|
@@ -2546,7 +2519,6 @@
|
|
|
2546
2519
|
this.search = new Search(_ctx);
|
|
2547
2520
|
this.subscription = new Subscription(_ctx);
|
|
2548
2521
|
this.users = new Users(_ctx);
|
|
2549
|
-
this.webhookReceiver = new Webhookreceiver(_ctx);
|
|
2550
2522
|
this.webhooks = new WebhookConsumer(_ctx, this.subscription);
|
|
2551
2523
|
}
|
|
2552
2524
|
|
|
@@ -2608,7 +2580,6 @@
|
|
|
2608
2580
|
exports.WEBHOOK_MODEL_COLUMNS = WEBHOOK_MODEL_COLUMNS;
|
|
2609
2581
|
exports.WEBHOOK_OUTCOME_MODELS = WEBHOOK_OUTCOME_MODELS;
|
|
2610
2582
|
exports.WebhookConsumer = WebhookConsumer;
|
|
2611
|
-
exports.Webhookreceiver = Webhookreceiver;
|
|
2612
2583
|
exports.configureCrypto = configureCrypto;
|
|
2613
2584
|
exports.handleResponse = handleResponse;
|
|
2614
2585
|
exports.selectResultColumns = selectResultColumns;
|