diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84ce84e..470392d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,8 +45,8 @@ jobs: - name: Set version in source run: |- - sed -i.bak "s#99999.99999.99999#${{ env.PACKAGE_VERSION }}#" electron-app/src/index.ts - rm electron-app/src/index.ts.bak + sed -i "s#99999.99999.99999#${{ env.PACKAGE_VERSION }}#" electron-app/src/index.ts + sed -i 4s/.*/{{ env.PACKAGE_VERSION }}/ electron-app/package.json - name: Tag if new version uses: pkgdeps/git-tag-action@v2.0.5 diff --git a/.github/workflows/publish-server.yml b/.github/workflows/publish-server.yml index e3213d5..340c8f1 100644 --- a/.github/workflows/publish-server.yml +++ b/.github/workflows/publish-server.yml @@ -19,6 +19,8 @@ jobs: - name: Build run: |- cd server + VERSION=`cat ../package.json| grep '"version":'` + sed -i 3s/.*/$VERSION/ package.json npm install npm run compile - name: Publish diff --git a/electron-app/package.json b/electron-app/package.json index f85086d..286474f 100644 --- a/electron-app/package.json +++ b/electron-app/package.json @@ -1,7 +1,7 @@ { "name": "nuclia-sync-agent", "productName": "nuclia-sync-agent", - "version": "1.0.10", + "version": "0.0.0", "description": "This is a Nuclia Sync Agent App", "main": "build/index.js", "scripts": { diff --git a/package.json b/package.json index fc56175..72063a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclia-sync-agent-app", - "version": "1.0.10", + "version": "1.0.11", "description": "\"This is a Nuclia Sync Agent App\"", "main": "build/index.js", "scripts": { diff --git a/server/package.json b/server/package.json index 5c521cc..99d6d77 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@nuclia/sync-agent", - "version": "1.0.10", + "version": "0.0.0", "description": "This is a sync agent to synchronize user files from diferent sources to nuclia", "main": "build/index.js", "types": "build/types/index.d.ts", diff --git a/server/src/logic/sync/domain/nuclia-cloud.ts b/server/src/logic/sync/domain/nuclia-cloud.ts index cd88451..bb4a202 100644 --- a/server/src/logic/sync/domain/nuclia-cloud.ts +++ b/server/src/logic/sync/domain/nuclia-cloud.ts @@ -158,26 +158,28 @@ export class NucliaCloud { } } - uploadLink(originalId: string, filename: string, data: Link): Observable { + uploadLink(originalId: string, filename: string, data: Link, metadata?: any): Observable { const slug = sha256(originalId); + const payload: ICreateResource = { + title: filename, + slug, + links: { link: { uri: data.uri } }, + origin: { url: data.uri }, + icon: 'application/stf-link', + }; + if (metadata.labels) { + payload.usermetadata = { classifications: metadata.labels }; + } return this.getKb().pipe( switchMap((kb) => - kb - .createOrUpdateResource({ - title: filename, - slug, - links: { link: { uri: data.uri } }, - origin: { url: data.uri }, - icon: 'application/stf-link', - }) - .pipe( - retry(RETRY_CONFIG), - delay(500), // do not overload the server - catchError((error) => { - console.log('createOrUpdateResource – error:', JSON.stringify(error)); - return of({ success: false, message: '' }); - }), - ), + kb.createOrUpdateResource(payload).pipe( + retry(RETRY_CONFIG), + delay(500), // do not overload the server + catchError((error) => { + console.log('createOrUpdateResource – error:', JSON.stringify(error)); + return of({ success: false, message: '' }); + }), + ), ), map(() => undefined), ); diff --git a/server/src/logic/sync/domain/use-cases/sync-single-file.use-case.ts b/server/src/logic/sync/domain/use-cases/sync-single-file.use-case.ts index a105df7..678c503 100644 --- a/server/src/logic/sync/domain/use-cases/sync-single-file.use-case.ts +++ b/server/src/logic/sync/domain/use-cases/sync-single-file.use-case.ts @@ -62,7 +62,7 @@ export class SyncSingleFile implements SyncSingleFileUseCase { }); } else if (data.type === 'link' && data.link) { return nucliaConnector - .uploadLink(item.originalId, item.title, data.link) + .uploadLink(item.originalId, item.title, data.link, { labels: sync.labels }) .pipe(map(() => ({ success: true, message: '' }))); } else { return of({ success: false, message: '' });