@remit/backend 0.0.10 → 0.0.12

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/backend",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Remit Mail Inspector API backend",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -86,7 +86,7 @@ export const AddressOperations: Record<
86
86
 
87
87
  const result = await client.address.listByAccountConfig({
88
88
  accountConfigId,
89
- normalizedCompound: q.toLowerCase(),
89
+ search: q.toLowerCase(),
90
90
  limit: limit ?? 10,
91
91
  });
92
92
 
@@ -18,15 +18,18 @@ const row = (
18
18
  ): Row => ({ threadMessageId, messageIdHeader, createdAt });
19
19
 
20
20
  describe("buildListThreadMessagesOptions", () => {
21
- it("defaults to newest-first and hides soft-deleted messages", () => {
21
+ it("defaults to oldest-first and hides soft-deleted messages", () => {
22
22
  assert.deepEqual(buildListThreadMessagesOptions({}), {
23
- order: "desc",
23
+ order: "asc",
24
24
  excludeDeleted: true,
25
25
  });
26
26
  });
27
27
 
28
28
  it("honours an explicit order", () => {
29
- assert.equal(buildListThreadMessagesOptions({ order: "asc" }).order, "asc");
29
+ assert.equal(
30
+ buildListThreadMessagesOptions({ order: "desc" }).order,
31
+ "desc",
32
+ );
30
33
  });
31
34
 
32
35
  it("carries no mailbox filter, so sent messages stay in the conversation", () => {
@@ -251,11 +251,16 @@ export const executeThreadSearch = async (
251
251
  * A conversation is never scoped to one mailbox: the user's own replies live
252
252
  * in Sent, filed messages live in their folder, and all of them belong to the
253
253
  * same thread (#46).
254
+ *
255
+ * The default order is `asc`: a conversation is read in the order it happened,
256
+ * so a reply follows the message it answers (#81). The ordering is the query's,
257
+ * not the handler's — `listByThread` sorts on sentDate with `threadMessageId`
258
+ * breaking ties, so it holds across pages rather than within one response.
254
259
  */
255
260
  export const buildListThreadMessagesOptions = (query: {
256
261
  order?: "asc" | "desc";
257
262
  }) => ({
258
- order: query.order ?? ("desc" as const),
263
+ order: query.order ?? ("asc" as const),
259
264
  excludeDeleted: true,
260
265
  });
261
266