@nuclia/sync-agent
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -128,6 +128,5 @@ "use strict"; | ||
} | ||
uploadLink(originalId, filename, data) { | ||
uploadLink(originalId, filename, data, metadata) { | ||
const slug = sha256(originalId); | ||
return this.getKb().pipe((0, rxjs_1.switchMap)((kb) => kb | ||
.createOrUpdateResource({ | ||
const payload = { | ||
title: filename, | ||
@@ -138,4 +137,7 @@ slug, | ||
icon: 'application/stf-link', | ||
}) | ||
.pipe((0, rxjs_1.retry)(RETRY_CONFIG), (0, rxjs_1.delay)(500), // do not overload the server | ||
}; | ||
if (metadata.labels) { | ||
payload.usermetadata = { classifications: metadata.labels }; | ||
} | ||
return this.getKb().pipe((0, rxjs_1.switchMap)((kb) => kb.createOrUpdateResource(payload).pipe((0, rxjs_1.retry)(RETRY_CONFIG), (0, rxjs_1.delay)(500), // do not overload the server | ||
(0, rxjs_1.catchError)((error) => { | ||
@@ -142,0 +144,0 @@ console.log('createOrUpdateResource – error:', JSON.stringify(error)); |
@@ -51,3 +51,3 @@ "use strict"; | ||
return nucliaConnector | ||
.uploadLink(item.originalId, item.title, data.link) | ||
.uploadLink(item.originalId, item.title, data.link, { labels: sync.labels }) | ||
.pipe((0, rxjs_1.map)(() => ({ success: true, message: '' }))); | ||
@@ -54,0 +54,0 @@ } |
@@ -17,4 +17,4 @@ import { Observable } from 'rxjs'; | ||
private deleteResource; | ||
uploadLink(originalId: string, filename: string, data: Link): Observable<void>; | ||
uploadLink(originalId: string, filename: string, data: Link, metadata?: any): Observable<void>; | ||
private getKb; | ||
} |
{ | ||
"name": "@nuclia/sync-agent", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "This is a sync agent to synchronize user files from diferent sources to nuclia", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
169567
4014