Skip to content

Commit

Permalink
style: fix prettier errors
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
  • Loading branch information
genaris committed Jun 21, 2023
1 parent 6350bac commit 1f5034e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 25 deletions.
6 changes: 3 additions & 3 deletions src/MediaSharingApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class MediaSharingApi {
* @param recordId the record id
* @returns the record or null if not found
*/
public findByThreadId(recordId: string): Promise<MediaSharingRecord | null> {
return this.mediaSharingService.findByThreadId(this.agentContext, recordId)
}
public findByThreadId(recordId: string): Promise<MediaSharingRecord | null> {
return this.mediaSharingService.findByThreadId(this.agentContext, recordId)
}
}
20 changes: 11 additions & 9 deletions src/messages/ShareMediaMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,19 @@ export class ShareMediaMessage extends AgentMessage {

// Assign an attachment per item using index as id
this.items = []

for (var i = 0; i < options.items.length; i++) {
const item = options.items[i]
this.addAppendedAttachment(new Attachment({
id: i.toString(),
data: { links: [item.uri] },
byteCount: item.byteCount,
filename: item.fileName,
description: item.description,
mimeType: item.mimeType,
}))
this.addAppendedAttachment(
new Attachment({
id: i.toString(),
data: { links: [item.uri] },
byteCount: item.byteCount,
filename: item.fileName,
description: item.description,
mimeType: item.mimeType,
})
)
this.items.push({
id: item.id,
attachmentId: i.toString(),
Expand Down
1 change: 0 additions & 1 deletion src/repository/MediaSharingRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface SharedMediaItemOptions {
}

export class SharedMediaItem {

public id!: string
public uri!: string
public mimeType!: string
Expand Down
3 changes: 1 addition & 2 deletions src/services/MediaSharingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class MediaSharingService {
const items: SharedMediaItem[] = []

for (const item of message.items) {
const relatedAttachment = message.appendedAttachments?.find(attachment => attachment .id === item.attachmentId)
const relatedAttachment = message.appendedAttachments?.find((attachment) => attachment.id === item.attachmentId)
if (!relatedAttachment) {
throw new AriesFrameworkError(`No attachment found for shared item ${item.id}`)
}
Expand All @@ -139,7 +139,6 @@ export class MediaSharingService {
byteCount: relatedAttachment.byteCount,
description: relatedAttachment.description,
fileName: relatedAttachment.filename,

})
}

Expand Down
8 changes: 1 addition & 7 deletions test/mediasharing.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { agentDependencies } from '@aries-framework/node'
import { AskarModule } from '@aries-framework/askar'
import { ariesAskar } from '@hyperledger/aries-askar-nodejs'
import {
Agent,
ConnectionRecord,
ConsoleLogger,
EncryptedMessage,
LogLevel,
} from '@aries-framework/core'
import { Agent, ConnectionRecord, ConsoleLogger, EncryptedMessage, LogLevel } from '@aries-framework/core'
import { v4 as uuid } from 'uuid'
import { firstValueFrom, ReplaySubject, Subject } from 'rxjs'
import { MediaSharingModule } from '../src/MediaSharingModule'
Expand Down
12 changes: 10 additions & 2 deletions test/transport/SubjectInboundTransport.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { Agent, AgentContext, EncryptedMessage, InboundTransport, MessageReceiver, TransportService, TransportSession, utils } from '@aries-framework/core';
import {
Agent,
AgentContext,
EncryptedMessage,
InboundTransport,
MessageReceiver,
TransportService,
TransportSession,
utils,
} from '@aries-framework/core'
import type { Subscription } from 'rxjs'

import { Subject } from 'rxjs'


export type SubjectMessage = { message: EncryptedMessage; replySubject?: Subject<SubjectMessage> }

export class SubjectInboundTransport implements InboundTransport {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"paths": {
"aries-javascript-media-sharing/*": ["src"]
},
"types": ["jest", "node"],
"types": ["jest", "node"]
},
"exclude": ["node_modules", "build"]
}

0 comments on commit 1f5034e

Please sign in to comment.