musora-content-services 2.145.6 → 2.146.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,21 @@
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.146.1](https://github.com/railroadmedia/musora-content-services/compare/v2.146.0...v2.146.1) (2026-04-02)
6
+
7
+ ## [2.146.0](https://github.com/railroadmedia/musora-content-services/compare/v2.145.9...v2.146.0) (2026-04-02)
8
+
9
+
10
+ ### Features
11
+
12
+ * **BEHLPT-18:** remove user from muppet ([#891](https://github.com/railroadmedia/musora-content-services/issues/891)) ([ecdf778](https://github.com/railroadmedia/musora-content-services/commit/ecdf778108f974f59885c3d442c47c90152c5554))
13
+
14
+ ### [2.145.9](https://github.com/railroadmedia/musora-content-services/compare/v2.145.8...v2.145.9) (2026-04-01)
15
+
16
+ ### [2.145.8](https://github.com/railroadmedia/musora-content-services/compare/v2.145.7...v2.145.8) (2026-04-01)
17
+
18
+ ### [2.145.7](https://github.com/railroadmedia/musora-content-services/compare/v2.145.6...v2.145.7) (2026-04-01)
19
+
5
20
  ### [2.145.6](https://github.com/railroadmedia/musora-content-services/compare/v2.145.5...v2.145.6) (2026-03-31)
6
21
 
7
22
  ### [2.145.5](https://github.com/railroadmedia/musora-content-services/compare/v2.145.4...v2.145.5) (2026-03-31)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.145.6",
3
+ "version": "2.146.1",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/publish.sh CHANGED
@@ -4,16 +4,16 @@
4
4
  set -e
5
5
 
6
6
  # Check if there are uncommitted changes.
7
- if ! git diff-index --quiet HEAD --; then
8
- echo "You have uncommitted changes. Please commit or stash them before publishing."
9
- exit 1
10
- fi
7
+ #if ! git diff-index --quiet HEAD --; then
8
+ # echo "You have uncommitted changes. Please commit or stash them before publishing."
9
+ # exit 1
10
+ #fi
11
11
 
12
12
  # Run the release script
13
- npm run release
13
+ # npm run release
14
14
 
15
15
  # Push the changes and tags to the remote repository
16
- git push --follow-tags origin main
16
+ # git push --follow-tags origin main
17
17
 
18
18
  # Publish the package to npm
19
19
  npm publish
@@ -72,6 +72,8 @@ export const DEFAULT_FIELDS = [
72
72
  '"grandparent_id": parent_content_data[1].id',
73
73
  'live_event_start_time',
74
74
  'live_event_end_time',
75
+ 'enrollment_start_time',
76
+ 'enrollment_end_time',
75
77
  ]
76
78
 
77
79
  // these are identical... why
@@ -399,7 +401,6 @@ export const ownedContentTypes = {
399
401
 
400
402
  export let contentTypeConfig = {
401
403
  'tab-data': {
402
- fields: ['enrollment_start_time', 'enrollment_end_time'],
403
404
  includeChildFields: true,
404
405
  },
405
406
  'progress-tracker': {
@@ -416,7 +417,7 @@ export let contentTypeConfig = {
416
417
  'railcontent_id',
417
418
  '"assignments": assignment[]{railcontent_id}',
418
419
  '"metadata": { brand, "type": _type, "parent_id": coalesce(parent_content_data[0].id, 0) }',
419
- ],
420
+ ],
420
421
  childFields: [
421
422
  'railcontent_id',
422
423
  '"assignments": assignment[]{railcontent_id}',
package/src/index.d.ts CHANGED
@@ -218,6 +218,7 @@ import {
218
218
  createAccount,
219
219
  createInvites,
220
220
  fetchUsersMultiAccountDetails,
221
+ removeUserFromActiveMultiUserAccount,
221
222
  rescindInvite
222
223
  } from './services/multi-user-accounts/multi-user-accounts.ts';
223
224
 
@@ -323,6 +324,7 @@ import {
323
324
  getSanityDate,
324
325
  getSongTypesFor,
325
326
  getSortOrder,
327
+ hasAnyMethodV2IntroCompleted,
326
328
  jumpToContinueContent
327
329
  } from './services/sanity.js';
328
330
 
@@ -680,6 +682,7 @@ declare module 'musora-content-services' {
680
682
  getWeekNumber,
681
683
  globalConfig,
682
684
  guidedCourses,
685
+ hasAnyMethodV2IntroCompleted,
683
686
  initializeEnvVar,
684
687
  initializeService,
685
688
  isBucketUrl,
@@ -725,6 +728,7 @@ declare module 'musora-content-services' {
725
728
  registerProgressCallback,
726
729
  removeContentAsInterested,
727
730
  removeContentAsNotInterested,
731
+ removeUserFromActiveMultiUserAccount,
728
732
  removeUserPractice,
729
733
  replyToComment,
730
734
  report,
package/src/index.js CHANGED
@@ -222,6 +222,7 @@ import {
222
222
  createAccount,
223
223
  createInvites,
224
224
  fetchUsersMultiAccountDetails,
225
+ removeUserFromActiveMultiUserAccount,
225
226
  rescindInvite
226
227
  } from './services/multi-user-accounts/multi-user-accounts.ts';
227
228
 
@@ -327,6 +328,7 @@ import {
327
328
  getSanityDate,
328
329
  getSongTypesFor,
329
330
  getSortOrder,
331
+ hasAnyMethodV2IntroCompleted,
330
332
  jumpToContinueContent
331
333
  } from './services/sanity.js';
332
334
 
@@ -679,6 +681,7 @@ export {
679
681
  getWeekNumber,
680
682
  globalConfig,
681
683
  guidedCourses,
684
+ hasAnyMethodV2IntroCompleted,
682
685
  initializeEnvVar,
683
686
  initializeService,
684
687
  isBucketUrl,
@@ -724,6 +727,7 @@ export {
724
727
  registerProgressCallback,
725
728
  removeContentAsInterested,
726
729
  removeContentAsNotInterested,
730
+ removeUserFromActiveMultiUserAccount,
727
731
  removeUserPractice,
728
732
  replyToComment,
729
733
  report,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module MultiUserAccounts
3
3
  */
4
- import { HttpClient } from '../../infrastructure/http/HttpClient'
4
+ import { HttpClient, DELETE } from '../../infrastructure/http/HttpClient'
5
5
  import { globalConfig } from '../config.js'
6
6
 
7
7
  const baseUrl = `/api/multi-user-accounts/v1`
@@ -75,9 +75,7 @@ export async function createAccount(params: CreateAccountParams): Promise<MultiU
75
75
  */
76
76
  export async function fetchUsersMultiAccountDetails(userId: number): Promise<UsersMultiAccountResponse> {
77
77
  const httpClient = new HttpClient(globalConfig.baseUrl)
78
- const url = `${baseUrl}/${userId}/details`
79
- console.log(url)
80
- return httpClient.get<UsersMultiAccountResponse>(url)
78
+ return httpClient.get<UsersMultiAccountResponse>(`${baseUrl}/${userId}/details`)
81
79
  }
82
80
 
83
81
  /**
@@ -115,3 +113,15 @@ export async function rescindInvite(inviteId: number): Promise<void> {
115
113
  const httpClient = new HttpClient(globalConfig.baseUrl)
116
114
  return httpClient.post<void>(`${baseUrl}/invites/${inviteId}/rescind`, {})
117
115
  }
116
+
117
+
118
+ /**
119
+ * Removes a member from a multi-user account. authorized user must be the primary account owner, or the user passed
120
+ *
121
+ * @param {number} userId - Id of the user to remove
122
+ * @returns {Promise<void|MultiUserAccountResponse>} - Updated MultiUserAccountResponse if account owner, void if active user
123
+ * @throws {HttpError} - If the request fails.
124
+ */
125
+ export async function removeUserFromActiveMultiUserAccount(userId: number): Promise<MultiUserAccountResponse|void> {
126
+ return DELETE(`${globalConfig.baseUrl}${baseUrl}/${userId}/remove`, {})
127
+ }
@@ -44,7 +44,7 @@ import { globalConfig } from './config.js'
44
44
 
45
45
  import { arrayToStringRepresentation, FilterBuilder } from '../filterBuilder.js'
46
46
  import { getPermissionsAdapter } from './permissions/index.ts'
47
- import { getAllCompleted, getAllStarted, getAllStartedOrCompleted } from './contentProgress.js'
47
+ import {getAllCompleted, getAllCompletedByIds, getAllStarted, getAllStartedOrCompleted} from './contentProgress.js'
48
48
  import { fetchRecentActivitiesActiveTabs } from './userActivity.js'
49
49
  import { query } from '../lib/sanity/query'
50
50
  import { Filters as f } from '../lib/sanity/filter'
@@ -2529,3 +2529,26 @@ export function fetchParentChildRelationshipsFor(childIds, parentType) {
2529
2529
  }`
2530
2530
  return fetchSanity(query, true, { processNeedAccess: false, processPageType: false })
2531
2531
  }
2532
+
2533
+ /**
2534
+ * Checks whether the user has completed a Method V2 intro video on **any** brand.
2535
+ *
2536
+ * Fetches all `method-intro` content IDs from Sanity (cross-brand) and checks
2537
+ * the local progress store for any completed record among them. This intentionally
2538
+ * ignores the current brand so that completing the intro on one brand (e.g. PlayBass)
2539
+ * is recognised as completed when the user switches to another brand (e.g. Drumeo).
2540
+ *
2541
+ * @returns {Promise<boolean>} `true` if the user has completed at least one Method V2
2542
+ * intro video across any brand, `false` otherwise.
2543
+ */
2544
+ export async function hasAnyMethodV2IntroCompleted() {
2545
+ const type = 'method-intro'
2546
+ const filter = `_type == '${type}'`
2547
+
2548
+ const query = `*[${filter}] { railcontent_id }`
2549
+ const videos = await fetchSanity(query, true);
2550
+ const ids = (videos || []).map((v) => v.railcontent_id)
2551
+
2552
+ const completedVideos = await getAllCompletedByIds(ids)
2553
+ return (completedVideos?.data?.length || 0) > 0
2554
+ }