musora-content-services 2.149.0 → 2.150.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.150.0](https://github.com/railroadmedia/musora-content-services/compare/v2.149.0...v2.150.0) (2026-04-08)
6
+
7
+
8
+ ### Features
9
+
10
+ * throw specific error after abort; protect getLastFetchToken ([#905](https://github.com/railroadmedia/musora-content-services/issues/905)) ([7c084e4](https://github.com/railroadmedia/musora-content-services/commit/7c084e4b351e26f8464f568d658e855f84e31951))
11
+
5
12
  ## [2.149.0](https://github.com/railroadmedia/musora-content-services/compare/v2.148.0...v2.149.0) (2026-04-07)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.149.0",
3
+ "version": "2.150.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -72,3 +72,11 @@ export class SyncValidationError extends SyncError {
72
72
  Object.setPrototypeOf(this, new.target.prototype)
73
73
  }
74
74
  }
75
+
76
+ export class SyncAbortError extends SyncError {
77
+ constructor(message: string = 'Sync operation was aborted', details?: ErrorDetails) {
78
+ super(message, details)
79
+ this.name = 'SyncAbortError'
80
+ Object.setPrototypeOf(this, new.target.prototype)
81
+ }
82
+ }
@@ -286,4 +286,8 @@ export default class SyncManager {
286
286
  getContext() {
287
287
  return this.context
288
288
  }
289
+
290
+ abort(reason?: string) {
291
+ this.runScope.abort(reason)
292
+ }
289
293
  }
@@ -1,3 +1,5 @@
1
+ import { SyncAbortError } from './errors'
2
+
1
3
  export default class SyncRunScope {
2
4
  private abortController: AbortController
3
5
 
@@ -9,14 +11,14 @@ export default class SyncRunScope {
9
11
  return this.abortController.signal
10
12
  }
11
13
 
12
- abort(): void {
13
- this.abortController.abort()
14
+ abort(reason?: string): void {
15
+ this.abortController.abort(reason)
14
16
  }
15
17
 
16
18
  abortable<T>(fn: () => Promise<T>): Promise<T> {
17
19
  return new Promise((resolve, reject) => {
18
20
  if (this.signal.aborted) {
19
- reject(this.signal.reason)
21
+ reject(new SyncAbortError('Operation aborted', { reason: this.signal.reason }))
20
22
  return
21
23
  }
22
24
 
@@ -172,7 +172,9 @@ export default class SyncStore<TModel extends BaseModel = BaseModel> {
172
172
  }
173
173
 
174
174
  async getLastFetchToken() {
175
- return (await this.db.localStorage.get<SyncToken | null>(this.lastFetchTokenKey)) ?? null
175
+ return await this.runScope.abortable(async () => {
176
+ return (await this.db.localStorage.get<SyncToken | null>(this.lastFetchTokenKey)) ?? null
177
+ })
176
178
  }
177
179
 
178
180
  async pullRecords(span?: Span) {