@signalapp/mock-server
Advanced tools
Comparing version 2.19.0 to 2.20.0
{ | ||
"name": "@signalapp/mock-server", | ||
"version": "2.19.0", | ||
"version": "2.20.0", | ||
"description": "Mock Signal Server for writing tests", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -89,24 +89,21 @@ /// <reference types="node" /> | ||
}>; | ||
export type MessageQueueEntry = Readonly<{ | ||
export type ContentQueueEntry = Readonly<{ | ||
source: Device; | ||
uuidKind: UUIDKind; | ||
envelopeType: EnvelopeType; | ||
content: Proto.IContent; | ||
}>; | ||
export type MessageQueueEntry = ContentQueueEntry & Readonly<{ | ||
body: string; | ||
dataMessage: Proto.IDataMessage; | ||
content: Proto.IContent; | ||
}>; | ||
export type ReceiptQueueEntry = Readonly<{ | ||
source: Device; | ||
uuidKind: UUIDKind; | ||
envelopeType: EnvelopeType; | ||
export type ReceiptQueueEntry = ContentQueueEntry & Readonly<{ | ||
receiptMessage: Proto.IReceiptMessage; | ||
content: Proto.IContent; | ||
}>; | ||
export type StoryQueueEntry = Readonly<{ | ||
source: Device; | ||
uuidKind: UUIDKind; | ||
envelopeType: EnvelopeType; | ||
export type StoryQueueEntry = ContentQueueEntry & Readonly<{ | ||
storyMessage: Proto.IStoryMessage; | ||
content: Proto.IContent; | ||
}>; | ||
export type EditMessageQueueEntry = ContentQueueEntry & Readonly<{ | ||
editMessage: Proto.IEditMessage; | ||
}>; | ||
export type SyncMessageQueueEntry = Readonly<{ | ||
@@ -150,2 +147,3 @@ source: Device; | ||
private readonly storyQueue; | ||
private readonly editMessageQueue; | ||
private readonly syncMessageQueue; | ||
@@ -207,2 +205,3 @@ private privPniPublicKey; | ||
waitForStory(): Promise<StoryQueueEntry>; | ||
waitForEditMessage(): Promise<EditMessageQueueEntry>; | ||
waitForSyncMessage(predicate?: ((entry: SyncMessageQueueEntry) => boolean)): Promise<SyncMessageQueueEntry>; | ||
@@ -218,2 +217,3 @@ private getProfileKeyPresentation; | ||
private handleStoryMessage; | ||
private handleEditMessage; | ||
private encrypt; | ||
@@ -220,0 +220,0 @@ private decrypt; |
@@ -178,2 +178,3 @@ "use strict"; | ||
storyQueue = new util_1.PromiseQueue(); | ||
editMessageQueue = new util_1.PromiseQueue(); | ||
syncMessageQueue = new util_1.PromiseQueue(); | ||
@@ -493,2 +494,5 @@ privPniPublicKey = this.pniPrivateKey.getPublicKey(); | ||
} | ||
else if (content.editMessage) { | ||
this.handleEditMessage(unsealedSource, uuidKind, unsealedType, content); | ||
} | ||
else if (content.receiptMessage) { | ||
@@ -737,2 +741,5 @@ this.handleReceiptMessage(unsealedSource, uuidKind, unsealedType, content); | ||
} | ||
async waitForEditMessage() { | ||
return this.editMessageQueue.shift(); | ||
} | ||
async waitForSyncMessage(predicate = () => true) { | ||
@@ -908,2 +915,13 @@ for (;;) { | ||
} | ||
handleEditMessage(source, uuidKind, envelopeType, content) { | ||
const { editMessage } = content; | ||
assert_1.default.ok(editMessage, 'editMessage must be present'); | ||
this.editMessageQueue.push({ | ||
source, | ||
uuidKind, | ||
envelopeType, | ||
editMessage, | ||
content, | ||
}); | ||
} | ||
async encrypt(target, message, { timestamp = Date.now(), sealed = false, uuidKind = types_1.UUIDKind.ACI, updatedPni, distributionId, group, } = {}) { | ||
@@ -910,0 +928,0 @@ assert_1.default.ok(this.isInitialized, 'Not initialized'); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import z from 'zod'; | ||
@@ -58,11 +57,11 @@ export declare const DeviceKeysSchema: z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}, { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}>; | ||
@@ -77,29 +76,29 @@ export type Message = z.infer<typeof MessageSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}, { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}>, "many">; | ||
timestamp: z.ZodNumber; | ||
}, "strip", z.ZodTypeAny, { | ||
timestamp: number; | ||
messages: { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}[]; | ||
timestamp: number; | ||
}, { | ||
timestamp: number; | ||
messages: { | ||
content: string; | ||
type: number; | ||
destinationDeviceId: number; | ||
destinationRegistrationId: number; | ||
content: string; | ||
}[]; | ||
timestamp: number; | ||
}>; | ||
@@ -106,0 +105,0 @@ export type MessageList = z.infer<typeof MessageListSchema>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3405775
62401