@open-e2ee/signal-protocol-sdk 13.4.0 → 13.5.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.
Files changed (163) hide show
  1. package/CHANGELOG.md +417 -0
  2. package/README.md +1 -1
  3. package/SECURITY.md +2 -2
  4. package/dist/client/binary-send.d.ts +28 -0
  5. package/dist/client/binary-send.d.ts.map +1 -0
  6. package/dist/client/binary-send.js +26 -0
  7. package/dist/client/binary-send.js.map +1 -0
  8. package/dist/client/client.d.ts +46 -6
  9. package/dist/client/client.d.ts.map +1 -1
  10. package/dist/client/client.js +181 -66
  11. package/dist/client/client.js.map +1 -1
  12. package/dist/client/content-adapter.d.ts +18 -0
  13. package/dist/client/content-adapter.d.ts.map +1 -1
  14. package/dist/client/content-adapter.js.map +1 -1
  15. package/dist/client/device-set-reconciliation.d.ts +23 -8
  16. package/dist/client/device-set-reconciliation.d.ts.map +1 -1
  17. package/dist/client/device-set-reconciliation.js +25 -11
  18. package/dist/client/device-set-reconciliation.js.map +1 -1
  19. package/dist/client/event-hooks.d.ts +88 -8
  20. package/dist/client/event-hooks.d.ts.map +1 -1
  21. package/dist/client/event-hooks.js +1 -0
  22. package/dist/client/event-hooks.js.map +1 -1
  23. package/dist/client/group-outbox.d.ts +45 -10
  24. package/dist/client/group-outbox.d.ts.map +1 -1
  25. package/dist/client/group-outbox.js +246 -154
  26. package/dist/client/group-outbox.js.map +1 -1
  27. package/dist/client/group-receive-authorization.d.ts +10 -1
  28. package/dist/client/group-receive-authorization.d.ts.map +1 -1
  29. package/dist/client/group-receive-authorization.js.map +1 -1
  30. package/dist/client/hosted-anonymous-delivery.d.ts +18 -1
  31. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  32. package/dist/client/hosted-anonymous-delivery.js +84 -12
  33. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  34. package/dist/client/hosted-connection.js +1 -1
  35. package/dist/client/hosted-connection.js.map +1 -1
  36. package/dist/client/hosted-group-authority.d.ts +6 -2
  37. package/dist/client/hosted-group-authority.d.ts.map +1 -1
  38. package/dist/client/hosted-group-authority.js +11 -7
  39. package/dist/client/hosted-group-authority.js.map +1 -1
  40. package/dist/client/hosted-groups.d.ts +5 -1
  41. package/dist/client/hosted-groups.d.ts.map +1 -1
  42. package/dist/client/hosted-groups.js +8 -4
  43. package/dist/client/hosted-groups.js.map +1 -1
  44. package/dist/client/hosted-http-error.d.ts +5 -1
  45. package/dist/client/hosted-http-error.d.ts.map +1 -1
  46. package/dist/client/hosted-http-error.js +5 -1
  47. package/dist/client/hosted-http-error.js.map +1 -1
  48. package/dist/client/hosted-mailbox-subscription.d.ts +2 -0
  49. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
  50. package/dist/client/hosted-mailbox-subscription.js +5 -5
  51. package/dist/client/hosted-mailbox-subscription.js.map +1 -1
  52. package/dist/client/hosted-transport.d.ts +11 -1
  53. package/dist/client/hosted-transport.d.ts.map +1 -1
  54. package/dist/client/hosted-transport.js +75 -30
  55. package/dist/client/hosted-transport.js.map +1 -1
  56. package/dist/client/hosted.d.ts.map +1 -1
  57. package/dist/client/hosted.js +1 -1
  58. package/dist/client/hosted.js.map +1 -1
  59. package/dist/client/index.d.ts +1 -1
  60. package/dist/client/index.d.ts.map +1 -1
  61. package/dist/client/index.js.map +1 -1
  62. package/dist/client/receive-queue.d.ts +5 -2
  63. package/dist/client/receive-queue.d.ts.map +1 -1
  64. package/dist/client/receive-queue.js +55 -18
  65. package/dist/client/receive-queue.js.map +1 -1
  66. package/dist/client/relay-acceptance.d.ts +49 -6
  67. package/dist/client/relay-acceptance.d.ts.map +1 -1
  68. package/dist/client/relay-acceptance.js +49 -3
  69. package/dist/client/relay-acceptance.js.map +1 -1
  70. package/dist/client/relay-protocol.d.ts +37 -7
  71. package/dist/client/relay-protocol.d.ts.map +1 -1
  72. package/dist/client/relay-protocol.js +53 -10
  73. package/dist/client/relay-protocol.js.map +1 -1
  74. package/dist/client/retry-family.d.ts +3 -3
  75. package/dist/client/retry-family.js +1 -1
  76. package/dist/client/retry-family.js.map +1 -1
  77. package/dist/client/retry-request-envelope.d.ts +18 -8
  78. package/dist/client/retry-request-envelope.d.ts.map +1 -1
  79. package/dist/client/retry-request-envelope.js +57 -29
  80. package/dist/client/retry-request-envelope.js.map +1 -1
  81. package/dist/client/retry-request-lifecycle.d.ts +24 -11
  82. package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
  83. package/dist/client/retry-request-lifecycle.js +46 -20
  84. package/dist/client/retry-request-lifecycle.js.map +1 -1
  85. package/dist/client/retry-terminal-recovery.d.ts +11 -8
  86. package/dist/client/retry-terminal-recovery.d.ts.map +1 -1
  87. package/dist/client/retry-terminal-recovery.js +18 -12
  88. package/dist/client/retry-terminal-recovery.js.map +1 -1
  89. package/dist/client/retry.d.ts +8 -7
  90. package/dist/client/retry.d.ts.map +1 -1
  91. package/dist/client/retry.js +30 -22
  92. package/dist/client/retry.js.map +1 -1
  93. package/dist/client/send-deadline.d.ts +308 -0
  94. package/dist/client/send-deadline.d.ts.map +1 -0
  95. package/dist/client/send-deadline.js +914 -0
  96. package/dist/client/send-deadline.js.map +1 -0
  97. package/dist/client/send-intent-driver.d.ts +116 -0
  98. package/dist/client/send-intent-driver.d.ts.map +1 -0
  99. package/dist/client/send-intent-driver.js +373 -0
  100. package/dist/client/send-intent-driver.js.map +1 -0
  101. package/dist/client/signal-service-cipher.d.ts +257 -27
  102. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  103. package/dist/client/signal-service-cipher.js +1274 -283
  104. package/dist/client/signal-service-cipher.js.map +1 -1
  105. package/dist/client/types.d.ts +48 -5
  106. package/dist/client/types.d.ts.map +1 -1
  107. package/dist/client/types.js.map +1 -1
  108. package/dist/index.d.ts +1 -1
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js.map +1 -1
  111. package/dist/local/store/conformance/cases/metadata.d.ts +3 -2
  112. package/dist/local/store/conformance/cases/metadata.d.ts.map +1 -1
  113. package/dist/local/store/conformance/cases/metadata.js +153 -2
  114. package/dist/local/store/conformance/cases/metadata.js.map +1 -1
  115. package/dist/local/store/key-value/adapter.d.ts +2 -1
  116. package/dist/local/store/key-value/adapter.d.ts.map +1 -1
  117. package/dist/local/store/key-value/adapter.js +9 -0
  118. package/dist/local/store/key-value/adapter.js.map +1 -1
  119. package/dist/local/store/memory/adapter.d.ts +2 -1
  120. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  121. package/dist/local/store/memory/adapter.js +4 -0
  122. package/dist/local/store/memory/adapter.js.map +1 -1
  123. package/dist/local/store/metadata-keys.d.ts +13 -0
  124. package/dist/local/store/metadata-keys.d.ts.map +1 -0
  125. package/dist/local/store/metadata-keys.js +20 -0
  126. package/dist/local/store/metadata-keys.js.map +1 -0
  127. package/dist/local/store/receive-work.d.ts.map +1 -1
  128. package/dist/local/store/receive-work.js +12 -1
  129. package/dist/local/store/receive-work.js.map +1 -1
  130. package/dist/local/store/reliability.d.ts +482 -33
  131. package/dist/local/store/reliability.d.ts.map +1 -1
  132. package/dist/local/store/reliability.js +690 -48
  133. package/dist/local/store/reliability.js.map +1 -1
  134. package/dist/local/store/sqlite/key-storage/index.d.ts +2 -1
  135. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
  136. package/dist/local/store/sqlite/key-storage/index.js +3 -0
  137. package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
  138. package/dist/local/store/sqlite/key-storage/metadata.d.ts +9 -0
  139. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
  140. package/dist/local/store/sqlite/key-storage/metadata.js +12 -0
  141. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
  142. package/dist/local/store/sqlite/store.d.ts +2 -1
  143. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  144. package/dist/local/store/sqlite/store.js +3 -0
  145. package/dist/local/store/sqlite/store.js.map +1 -1
  146. package/dist/local/store/web/adapter.d.ts +8 -1
  147. package/dist/local/store/web/adapter.d.ts.map +1 -1
  148. package/dist/local/store/web/adapter.js +18 -0
  149. package/dist/local/store/web/adapter.js.map +1 -1
  150. package/dist/remote/relay/request-admission.d.ts +49 -0
  151. package/dist/remote/relay/request-admission.d.ts.map +1 -0
  152. package/dist/remote/relay/request-admission.js +74 -0
  153. package/dist/remote/relay/request-admission.js.map +1 -0
  154. package/dist/types/api.d.ts +77 -0
  155. package/dist/types/api.d.ts.map +1 -1
  156. package/dist/types/errors.d.ts +144 -1
  157. package/dist/types/errors.d.ts.map +1 -1
  158. package/dist/types/errors.js +146 -1
  159. package/dist/types/errors.js.map +1 -1
  160. package/docs/ASSURANCE.md +5 -5
  161. package/docs/DEVIATIONS.md +34 -4
  162. package/docs/ERROR_HANDLING.md +134 -7
  163. package/package.json +1 -1
@@ -0,0 +1,308 @@
1
+ import { type OutgoingIntentEndReport, type recordOutgoingDestinationProgress, type StoredDestinationProgress, type StoredManualResend, type StoredOutgoingMessageIntent } from '../local/store/reliability.js';
2
+ import { type RelayPostAcceptance } from './relay-acceptance.js';
3
+ import type { SendOutcomeEvent } from './event-hooks.js';
4
+ /**
5
+ * The posting deadline of a direct or group send: the time after which the
6
+ * SDK starts no relay request for the send, and the classification of the
7
+ * send when it ends at that time.
8
+ *
9
+ * The outbox stores the deadline with the intent (`deadlineAt`). Each post
10
+ * of the send checks it before each request, also before a transport repeat
11
+ * and before the identified fallback of a sealed post. The outbox also
12
+ * stores the progress of each destination: the requests that started for
13
+ * it and the class of its last answer. The evidence of one `send()` call
14
+ * records each answer that a request of the call got, and writes it to the
15
+ * stored progress. A destination is one device under the client message ID
16
+ * of its posts, so a pre-message and the group message of one device are
17
+ * two destinations. When an open destination remains at the deadline, or
18
+ * when every open destination got OPERATION_EXPIRED in the call or has a
19
+ * stored refusal that the SDK cannot recover, the send ends, and the stored
20
+ * progress decides its class.
21
+ *
22
+ * No package entry exports this module.
23
+ */
24
+ /** The internal error of a request that the posting deadline refused. */
25
+ export declare class PostingDeadlineReachedError extends Error {
26
+ readonly deadlineAt: number;
27
+ readonly name = "PostingDeadlineReachedError";
28
+ constructor(deadlineAt: number);
29
+ }
30
+ /** True when the posting deadline refused the request. */
31
+ export declare function isPostingDeadlineReached(error: unknown): error is PostingDeadlineReachedError;
32
+ /**
33
+ * The check that each request of a send meets before it starts. It rejects
34
+ * with `PostingDeadlineReachedError` at or after the deadline.
35
+ */
36
+ export declare function postingDeadlineCheck(deadlineAt: number, clock: () => number): () => Promise<void>;
37
+ /**
38
+ * Record whether the posting deadline refused a request of one post. The
39
+ * returned check runs the deadline check and records its refusal.
40
+ */
41
+ export declare function recordDeadlineStop(check: (() => Promise<void>) | undefined): {
42
+ readonly check: () => Promise<void>;
43
+ stopped(): boolean;
44
+ };
45
+ /** One device of a send error. */
46
+ export interface SendDevice {
47
+ readonly userId: string;
48
+ readonly deviceId: number;
49
+ }
50
+ /** One destination of a send: a device and the client message ID of its posts. */
51
+ export interface SendDestination {
52
+ readonly device: SendDevice;
53
+ readonly postMessageId: string;
54
+ }
55
+ /** One write of the stored progress of a destination. */
56
+ type DestinationProgressUpdate = Parameters<typeof recordOutgoingDestinationProgress>[3];
57
+ /**
58
+ * True when the stored entry proves that the Relay refused every request of
59
+ * the destination, and that no recovery in a send call can change the
60
+ * refusal: the entry is `refused` with no uncertain request, and its code
61
+ * is terminal or its recovery already ran and the Relay refused the repost.
62
+ */
63
+ export declare function provenRefused(entry: StoredDestinationProgress | undefined): boolean;
64
+ /**
65
+ * The acceptance of a destination that a stored entry records. The call got
66
+ * no receipt for it, so it counts as a conflict acceptance: it carries the
67
+ * stored Relay message ID when there is one, and no device-set mark.
68
+ */
69
+ export declare function storedAcceptance(entry: StoredDestinationProgress, clock: () => number): RelayPostAcceptance;
70
+ /** The relay answer of one shared post, which names refused accounts and devices. */
71
+ interface SharedPostAnswer extends RelayPostAcceptance {
72
+ uuids404: string[];
73
+ refusals?: readonly {
74
+ userId: string;
75
+ deviceId: number;
76
+ code: string;
77
+ }[];
78
+ }
79
+ /** The end of a send at its posting deadline. */
80
+ export interface SendEnd {
81
+ readonly outcome: NonNullable<StoredOutgoingMessageIntent['outcome']>;
82
+ readonly destinationProgress: Record<string, StoredDestinationProgress>;
83
+ /** The error that `send()` throws. */
84
+ readonly error: Error;
85
+ }
86
+ /**
87
+ * The evidence of one `send()` call of a direct or group send: the requests
88
+ * and the answers of each destination in the call, and the stored progress
89
+ * of each destination when the call started.
90
+ */
91
+ export declare class SendCallEvidence {
92
+ private readonly options;
93
+ /** The posting deadline check of each request of the call. */
94
+ readonly check: () => Promise<void>;
95
+ private readonly destinations;
96
+ private firstRefusal;
97
+ private lastError;
98
+ private hasRefusal;
99
+ private hasError;
100
+ /** The first UPGRADE_REQUIRED or DEVICE_REVOKED answer of the call. */
101
+ private terminalAnswer;
102
+ constructor(options: {
103
+ readonly clientMessageId: string;
104
+ readonly deadlineAt: number;
105
+ /** The stored progress of the intent when the call started. */
106
+ readonly progress?: Readonly<Record<string, StoredDestinationProgress>>;
107
+ /**
108
+ * True when the intent wrote progress before each of its requests. A
109
+ * destination with no entry then had no request.
110
+ */
111
+ readonly progressFromStart?: boolean;
112
+ /** True when the intent posts sealed and refuses identified delivery. */
113
+ readonly sealedSenderRequired?: boolean;
114
+ readonly clock: () => number;
115
+ /** True for another error that refuses one request for its device. */
116
+ readonly refusesDevice?: (error: unknown) => boolean;
117
+ /**
118
+ * Store one answer of a destination. It runs after each post settles,
119
+ * and the post settles only after the write.
120
+ */
121
+ readonly recordProgress?: (key: string, update: DestinationProgressUpdate) => Promise<StoredDestinationProgress | undefined>;
122
+ });
123
+ get deadlineAt(): number;
124
+ /**
125
+ * Take the stored entry of a device that a repair in this call returned.
126
+ * The entry names the client message ID of the repaired post. A later
127
+ * RETRY_CONFLICT of that destination reads its repair mark.
128
+ */
129
+ refreshEntry(device: SendDevice, entry: StoredDestinationProgress): void;
130
+ /**
131
+ * Run one post of a destination, record its answer, and store the class
132
+ * of the answer. `post` gives `onRequest` to the control of the post,
133
+ * which calls it when a request starts, also for a transport repeat and
134
+ * the identified fallback. A RETRY_CONFLICT, or a version 2
135
+ * DELIVERY_ALREADY_ACCEPTED, resolves the post as accepted when no repair
136
+ * replaced the message of the destination. A
137
+ * message that the stored progress records as accepted is not posted
138
+ * again: the post resolves with the stored acceptance. The post resolves
139
+ * only when the destination is accepted. Each other answer rejects.
140
+ */
141
+ post(destination: SendDestination, post: (onRequest: (repeat?: 'uncertain' | 'token') => void) => Promise<RelayPostAcceptance>): Promise<RelayPostAcceptance>;
142
+ /**
143
+ * Run one shared post of the destinations of a group body, and record its
144
+ * one answer on each destination. `post` gives `onRequest` to the control
145
+ * of the post, and each request counts for each destination. When the
146
+ * stored progress records each destination as accepted, the body is not
147
+ * posted again.
148
+ *
149
+ * - A receipt accepts each destination, except each destination of a user
150
+ * in `uuids404` and each destination that `refusals` names. Those are
151
+ * refused, as a thrown refusal of the post refuses its destination, and
152
+ * the first one gives the terminal error of a failed end. The count
153
+ * `refusedDestinationCount` names no device, so it refuses no
154
+ * destination.
155
+ * - A RETRY_CONFLICT, or a version 2 DELIVERY_ALREADY_ACCEPTED, accepts
156
+ * each destination whose current entry has no repair mark, and it resolves the post with a conflict
157
+ * acceptance when each destination is accepted. A destination with a
158
+ * repair mark is uncertain, and the post rejects.
159
+ * - Each other answer gives its class to each destination, so after
160
+ * OPERATION_EXPIRED each destination is expired.
161
+ */
162
+ postShared<T extends SharedPostAnswer>(destinations: readonly SendDestination[], post: (onRequest: (repeat?: 'uncertain' | 'token') => void) => Promise<T>): Promise<T>;
163
+ /**
164
+ * Run one sync copy of the send to an own device, and store its progress
165
+ * under the device key `destination`. A sync entry never counts for the
166
+ * end of the send. A copy that the stored progress records as accepted is
167
+ * not posted again.
168
+ *
169
+ * `post` gets the gate of each request of the copy, by the client message
170
+ * ID of the copy that the request posts. A copy with no client message ID
171
+ * gets its gate by `undefined`, and its request is stored under the sync
172
+ * ID of `destination`. The gate runs `check`, then stores the request.
173
+ * After the copy settles, its answer is stored. An undefined result means
174
+ * that the device refused the copy and its repair, and the copy left the
175
+ * intent.
176
+ */
177
+ postSync(destination: SendDestination, check: () => Promise<void>, post: (gate: (postMessageId: string | undefined) => () => Promise<void>) => Promise<RelayPostAcceptance | undefined>): Promise<RelayPostAcceptance | undefined>;
178
+ /**
179
+ * The end of the send at a classification point, or undefined when the
180
+ * send stays open. `progress` is the stored progress of the intent, read
181
+ * under the intent lock. The send ends when `isDue` holds for its open
182
+ * destinations: those with no acceptance in the call or in the stored
183
+ * progress (contract §3.4). The end is the one that `classify` gives.
184
+ */
185
+ end(destinations: readonly SendDestination[], progress?: Readonly<Record<string, StoredDestinationProgress>>): SendEnd | undefined;
186
+ /**
187
+ * The class of the send if it ended now (contract §3.4), or undefined when
188
+ * the call or the stored progress accepted each destination. Unlike `end`,
189
+ * it does not check that the send is due: the caller decides that the
190
+ * send ends. The error of a failed end follows the rule of
191
+ * `failedEndError`. Its thrown refusal is the first UPGRADE_REQUIRED or
192
+ * DEVICE_REVOKED answer of this call, else the first refusal of this
193
+ * call, and its entries are the progress that the end stores.
194
+ */
195
+ classify(destinations: readonly SendDestination[], progress?: Readonly<Record<string, StoredDestinationProgress>>): SendEnd | undefined;
196
+ /** The destinations with no acceptance in the call or in `progress`. */
197
+ private openDestinations;
198
+ /** Keep the first UPGRADE_REQUIRED or DEVICE_REVOKED answer of the call. */
199
+ private keepTerminalAnswer;
200
+ /**
201
+ * True when the send ends now: at or after the deadline, after an
202
+ * UPGRADE_REQUIRED or DEVICE_REVOKED answer in this call, or when each
203
+ * open destination got OPERATION_EXPIRED as the last answer in this call
204
+ * or has a stored refusal that no recovery in a call can change.
205
+ */
206
+ private isDue;
207
+ private evidenceAt;
208
+ private accept;
209
+ /**
210
+ * The class of the answer to one post that started a request (contract
211
+ * §3.5). An answer that followed a repeat after an uncertain answer is
212
+ * uncertain, because the first request can have stored the post. A
213
+ * RETRY_CONFLICT is an earlier acceptance only when the current entry of
214
+ * the destination has no repair mark: then the Relay holds the same bytes
215
+ * under the message ID. A version 2 DELIVERY_ALREADY_ACCEPTED says that
216
+ * the Relay holds an accepted post under the message ID, and it follows
217
+ * the same rule. An intent that did not write progress from its start can
218
+ * have had a repair that left no mark, so its answer stays uncertain.
219
+ */
220
+ private classifyAnswer;
221
+ /**
222
+ * The class of a destination at the end (contract §3.4), from its stored
223
+ * entry and the acceptance of this call. An `accepted` entry is accepted.
224
+ * A destination is refused, so never accepted, when its stored entry is
225
+ * `refused` or `pending`, or has no request, with no uncertain request.
226
+ * The Relay gives a pending answer before it stores the post, so that
227
+ * answer also proves that the request was not accepted. A destination
228
+ * with no entry had no request when the intent wrote progress from its
229
+ * start. Each other destination is unknown: a request with no answer, an
230
+ * uncertain answer, and every entry with the uncertain flag.
231
+ */
232
+ private classifyDestination;
233
+ }
234
+ /** The destinations of the device messages of a direct intent. */
235
+ export declare function sendDestinations(clientMessageId: string, messages: readonly {
236
+ readonly recipientUserId: string;
237
+ readonly recipientDeviceId: number;
238
+ readonly clientMessageId?: string;
239
+ }[]): SendDestination[];
240
+ /**
241
+ * The error of a replay of an ended send. The replay reads the stored end
242
+ * and starts no request.
243
+ *
244
+ * An `acceptance-unknown` end gives `SendAcceptanceUnknownError`. A `failed`
245
+ * end gives the error of `failedEndError` with no thrown refusal, from the
246
+ * stored entries in the order of the destinations.
247
+ */
248
+ export declare function storedSendEndError(intent: StoredOutgoingMessageIntent): Error;
249
+ /**
250
+ * Mark an error of a send that failed before its posting deadline. The send
251
+ * stays open, so a replay with the same `clientMessageId` before `deadlineAt`
252
+ * can post it: `retryable` is true. The Relay's own hint moves to
253
+ * `relayRetryable`. An error that keeps its own retry rule, such as
254
+ * UPGRADE_REQUIRED or DEVICE_REVOKED, does not change.
255
+ */
256
+ export declare function attachSendDeadline<T>(error: T, deadlineAt: number): T;
257
+ /**
258
+ * Mark the raw refusal of a send that ended at its posting deadline with no
259
+ * device of unknown acceptance. The error keeps its class, and `retryable`
260
+ * is false.
261
+ */
262
+ export declare function attachTerminalFailure<T extends Error>(error: T, details: {
263
+ readonly acceptedDevices: readonly SendDevice[];
264
+ readonly refusedDevices: readonly SendDevice[];
265
+ readonly deadlineAt: number;
266
+ }): T;
267
+ /** The key of the end report mark of a send call. No package subpath exports it. */
268
+ export declare const SEND_END_REPORT: unique symbol;
269
+ /**
270
+ * The options of a send, with the end report of the call. The intent lock
271
+ * of the send registers the report, so the end write or the completion write
272
+ * of the intent records the end in it.
273
+ */
274
+ export interface SendEndReportMark {
275
+ readonly [SEND_END_REPORT]?: OutgoingIntentEndReport;
276
+ }
277
+ /**
278
+ * The `onSendOutcome` event of an intent that ended or completed. A
279
+ * completed intent gives `completed` with its result, and an ended intent
280
+ * gives its outcome with the error that a replay of it throws.
281
+ */
282
+ export declare function sendOutcomeEvent(intent: StoredOutgoingMessageIntent): SendOutcomeEvent;
283
+ /**
284
+ * A manual resend of an intent, read as an intent of its own: its device
285
+ * messages, its progress, its end and its posting deadline. It has no
286
+ * sync phase. `storedSendEndError` and `sendOutcomeEvent` read it as they
287
+ * read an intent.
288
+ */
289
+ export declare function manualResendIntent(intent: StoredOutgoingMessageIntent, resend: StoredManualResend): StoredOutgoingMessageIntent;
290
+ /**
291
+ * The end of a manual resend that a call wrote: the intent and the ended
292
+ * resend. Only the call that wrote the end fills it, and its caller reports
293
+ * the end.
294
+ */
295
+ export interface ManualResendEndReport {
296
+ ended?: {
297
+ intent: StoredOutgoingMessageIntent;
298
+ resend: StoredManualResend;
299
+ };
300
+ }
301
+ /**
302
+ * The `onSendOutcome` event of a manual resend that ended. It carries the
303
+ * `clientMessageId` of the intent, the posting deadline of the resend, and
304
+ * `manualResend`, the number of the resend from 1.
305
+ */
306
+ export declare function manualResendOutcomeEvent(intent: StoredOutgoingMessageIntent, resend: StoredManualResend): SendOutcomeEvent;
307
+ export {};
308
+ //# sourceMappingURL=send-deadline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-deadline.d.ts","sourceRoot":"","sources":["../../client/send-deadline.ts"],"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