musora-content-services 2.130.0 → 2.131.1

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,22 @@
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.131.1](https://github.com/railroadmedia/musora-content-services/compare/v2.131.0...v2.131.1) (2026-02-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add musora to award template ([#765](https://github.com/railroadmedia/musora-content-services/issues/765)) ([692743f](https://github.com/railroadmedia/musora-content-services/commit/692743f950d155e3bda8a8d6675374b4611c5a53))
11
+ * add SP and GC lesson types to progressTypesMapping ([#759](https://github.com/railroadmedia/musora-content-services/issues/759)) ([493ac78](https://github.com/railroadmedia/musora-content-services/commit/493ac78dfadb11e66def4c832d3998033bc133cd))
12
+ * optimize method complete fn ([#755](https://github.com/railroadmedia/musora-content-services/issues/755)) ([23f6429](https://github.com/railroadmedia/musora-content-services/commit/23f6429560234905cdd91f15aca33df0289e9133))
13
+
14
+ ## [2.131.0](https://github.com/railroadmedia/musora-content-services/compare/v2.130.0...v2.131.0) (2026-02-03)
15
+
16
+
17
+ ### Features
18
+
19
+ * decode gzip+base64'd responses ([#764](https://github.com/railroadmedia/musora-content-services/issues/764)) ([43c2a7c](https://github.com/railroadmedia/musora-content-services/commit/43c2a7cfb03992ac6bb89a46c7c09bcf478404ee))
20
+
5
21
  ## [2.130.0](https://github.com/railroadmedia/musora-content-services/compare/v2.129.3...v2.130.0) (2026-02-03)
6
22
 
7
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.130.0",
3
+ "version": "2.131.1",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -40,6 +40,7 @@
40
40
  "@sanity/client": "^5.4.2",
41
41
  "dayjs": "^1.11.13",
42
42
  "docdash": "^2.0.2",
43
+ "fflate": "^0.8.2",
43
44
  "groqd": "^0.15.12"
44
45
  },
45
46
  "peerDependencies": {
@@ -301,10 +301,10 @@ export const progressTypesMapping = {
301
301
  'song tutorial': [...tutorialsLessonTypes, 'song-tutorial-lesson'],
302
302
  songs: transcriptionsLessonTypes,
303
303
  'play along': playAlongLessonTypes,
304
- 'guided course': ['guided-course'],
304
+ 'guided course': ['guided-course', 'guided-course-lesson'],
305
305
  'course collection': ['course-collection'],
306
306
  'learning path': ['learning-path-v2'],
307
- 'skill pack': skillLessonTypes,
307
+ 'skill pack': [...skillLessonTypes, 'skill-pack-lesson'],
308
308
  'jam track': jamTrackLessonTypes,
309
309
  'course video': ['course-lesson'],
310
310
  }
@@ -1006,6 +1006,10 @@ export const awardTemplate = {
1006
1006
  front: "https://d3fzm1tzeyr5n3.cloudfront.net/v2/awards/playbass.svg",
1007
1007
  rear: "https://d3fzm1tzeyr5n3.cloudfront.net/v2/awards/playbass-rear.svg",
1008
1008
  },
1009
+ musora: {
1010
+ front: null,
1011
+ rear: null,
1012
+ },
1009
1013
  }
1010
1014
 
1011
1015
  /**
@@ -95,6 +95,7 @@ export async function fetchInstructorBySlug(
95
95
  export interface InstructorLessonsOptions extends BuildQueryOptions {
96
96
  searchTerm?: string
97
97
  includedFields?: Array<string>
98
+ contentType?: string
98
99
  }
99
100
 
100
101
  export interface InstructorLessons {
@@ -123,13 +124,13 @@ export interface InstructorLessons {
123
124
  export async function fetchInstructorLessons(
124
125
  slug: string,
125
126
  brand: Brands | string,
126
- contentType?: string,
127
127
  {
128
128
  sort = '-published_on',
129
129
  searchTerm = '',
130
130
  offset = 0,
131
131
  limit = 20,
132
132
  includedFields = [],
133
+ contentType = null
133
134
  }: InstructorLessonsOptions = {}
134
135
  ): Promise<InstructorLessons> {
135
136
  sort = getSortOrder(sort, brand)
@@ -453,17 +453,20 @@ export async function completeMethodIntroVideo(
453
453
  ): Promise<completeMethodIntroVideo> {
454
454
  let response = {} as completeMethodIntroVideo
455
455
 
456
- const methodStructure = await fetchMethodV2Structure(brand)
456
+ const [intro_video_response, methodStructure] = await Promise.all([
457
+ completeIfNotCompleted(introVideoId),
458
+ fetchMethodV2Structure(brand)
459
+ ])
460
+ response.intro_video_response = intro_video_response
457
461
 
458
462
  const firstLearningPathId = methodStructure.learning_paths[0].id
463
+
459
464
  response.active_path_response = await methodIntroVideoCompleteActions(
460
465
  brand,
461
466
  firstLearningPathId,
462
467
  new Date()
463
468
  )
464
469
 
465
- response.intro_video_response = await completeIfNotCompleted(introVideoId)
466
-
467
470
  return response
468
471
  }
469
472
 
@@ -33,7 +33,7 @@ export default function syncAdapterFactory<T extends DatabaseAdapter>(
33
33
 
34
34
  return new AdapterClass({
35
35
  ...opts,
36
- dbName: `sync:${userScope.initialId}`,
36
+ dbName: `musora:sync:${userScope.initialId}`,
37
37
  schema,
38
38
  migrations: undefined
39
39
  })
@@ -1,6 +1,6 @@
1
1
  import { SyncToken, SyncEntry, SyncSyncable } from "./index"
2
2
  import { EpochMs } from "."
3
-
3
+ import * as fflate from 'fflate'
4
4
  import { globalConfig } from '../config.js'
5
5
  import { RecordId } from "@nozbe/watermelondb"
6
6
  import BaseModel from "./models/Base"
@@ -164,7 +164,8 @@ export function makeFetchRequest(input: RequestInfo, init?: RequestInit): (userI
164
164
  ...(context.session.getSessionId() ? {
165
165
  'X-Sync-Client-Session-Id': context.session.getSessionId()!
166
166
  } : {}),
167
- 'X-Sync-Intended-User-Id': userId.toString()
167
+ 'X-Sync-Intended-User-Id': userId.toString(),
168
+ 'X-Sync-Accept-Encoding': 'gzip-base64'
168
169
  }
169
170
  })
170
171
  }
@@ -216,7 +217,26 @@ export function handlePull(callback: (userId: number, context: SyncContext) => R
216
217
  }
217
218
  const intendedUserId = +response.headers.get('X-Sync-Intended-User-Id')!
218
219
 
219
- const json = await response.json() as RawPullResponse
220
+ const contentEncoding = response.headers.get('X-Sync-Content-Encoding');
221
+ let json: RawPullResponse;
222
+
223
+ if (contentEncoding === 'gzip-base64') {
224
+ const base64Data = await response.text();
225
+
226
+ const binaryString = atob(base64Data);
227
+ const bytes = new Uint8Array(binaryString.length);
228
+ for (let i = 0; i < binaryString.length; i++) {
229
+ bytes[i] = binaryString.charCodeAt(i);
230
+ }
231
+
232
+ const decompressed = fflate.gunzipSync(bytes);
233
+
234
+ const jsonString = fflate.strFromU8(decompressed);
235
+ json = JSON.parse(jsonString) as RawPullResponse;
236
+ } else {
237
+ json = await response.json() as RawPullResponse;
238
+ }
239
+
220
240
  const data = deserializePullResponse(json)
221
241
 
222
242
  // if no max_updated_at, at least use the server's timestamp
@@ -32,7 +32,7 @@ const repoCache: Record<string, Partial<SyncRepositories>> = {};
32
32
  const proxy = new Proxy({} as SyncRepositories, {
33
33
  get(_target, prop: keyof SyncRepositories) {
34
34
  // @ts-ignore - funny stuff in RN dev env that calls manager instance too early?
35
- if (typeof prop === '$$typeof') return
35
+ if (prop === '$$typeof') return
36
36
 
37
37
  const manager = SyncManager.getInstance();
38
38
  const managerId = manager.getId();