@rmdes/indiekit-endpoint-microsub 1.0.0-beta.1 → 1.0.0-beta.2

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.
@@ -94,7 +94,8 @@ export async function searchItemsRegex(
94
94
  { "author.name": regex },
95
95
  ],
96
96
  })
97
- .toSorted({ published: -1 })
97
+ // eslint-disable-next-line unicorn/no-array-sort -- MongoDB cursor method, not Array#sort
98
+ .sort({ published: -1 })
98
99
  .limit(limit)
99
100
  .toArray();
100
101
 
@@ -55,7 +55,8 @@ export async function createChannel(application, { name, userId }) {
55
55
  // Get max order for user
56
56
  const maxOrderResult = await collection
57
57
  .find({ userId })
58
- .toSorted({ order: -1 })
58
+ // eslint-disable-next-line unicorn/no-array-sort -- MongoDB cursor method, not Array#sort
59
+ .sort({ order: -1 })
59
60
  .limit(1)
60
61
  .toArray();
61
62
 
@@ -93,7 +94,8 @@ export async function getChannels(application, userId) {
93
94
  const channels = await collection
94
95
  // eslint-disable-next-line unicorn/no-array-callback-reference -- filter is MongoDB query object
95
96
  .find(filter)
96
- .toSorted({ order: 1 })
97
+ // eslint-disable-next-line unicorn/no-array-sort -- MongoDB cursor method, not Array#sort
98
+ .sort({ order: 1 })
97
99
  .toArray();
98
100
 
99
101
  // Get unread counts for each channel
@@ -99,7 +99,8 @@ export async function getTimelineItems(application, channelId, options = {}) {
99
99
  const items = await collection
100
100
  // eslint-disable-next-line unicorn/no-array-callback-reference -- query is MongoDB query object
101
101
  .find(query)
102
- .toSorted(sort)
102
+ // eslint-disable-next-line unicorn/no-array-sort -- MongoDB cursor method, not Array#sort
103
+ .sort(sort)
103
104
  .limit(limit + 1)
104
105
  .toArray();
105
106
 
@@ -370,7 +371,8 @@ export async function searchItems(application, channelId, query, limit = 20) {
370
371
  { summary: regex },
371
372
  ],
372
373
  })
373
- .toSorted({ published: -1 })
374
+ // eslint-disable-next-line unicorn/no-array-sort -- MongoDB cursor method, not Array#sort
375
+ .sort({ published: -1 })
374
376
  .limit(limit)
375
377
  .toArray();
376
378
 
@@ -127,13 +127,13 @@ export async function getNotifications(application, userId, options = {}) {
127
127
  query.readBy = { $ne: userId };
128
128
  }
129
129
 
130
- /* eslint-disable unicorn/no-array-callback-reference -- query is MongoDB query object */
130
+ /* eslint-disable unicorn/no-array-callback-reference, unicorn/no-array-sort -- MongoDB cursor methods */
131
131
  const notifications = await collection
132
132
  .find(query)
133
- .toSorted({ published: -1 })
133
+ .sort({ published: -1 })
134
134
  .limit(limit)
135
135
  .toArray();
136
- /* eslint-enable unicorn/no-array-callback-reference */
136
+ /* eslint-enable unicorn/no-array-callback-reference, unicorn/no-array-sort */
137
137
 
138
138
  return notifications.map((n) => transformNotification(n, userId));
139
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-microsub",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Microsub endpoint for Indiekit. Enables subscribing to feeds and reading content using the Microsub protocol.",
5
5
  "keywords": [
6
6
  "indiekit",