musora-content-services 2.182.0 → 2.183.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.
@@ -1,14 +1,4 @@
1
1
  {
2
- "permissions": {
3
- "allow": [
4
- "Bash(rg:*)",
5
- "Bash(npm run lint:*)",
6
- "Bash(ls:*)",
7
- "Bash(npm test *)",
8
- "Bash(npx jest *)"
9
- ],
10
- "deny": []
11
- },
12
2
  "enabledMcpjsonServers": [
13
3
  "1password",
14
4
  "atlassian",
@@ -19,15 +9,15 @@
19
9
  "hex",
20
10
  "sanity",
21
11
  "mysql",
12
+ "mysql-staging",
13
+ "mysql-local",
22
14
  "slack",
23
15
  "langfuse",
24
16
  "chrome-devtools",
17
+ "mobile",
25
18
  "railway",
26
19
  "github",
27
20
  "asana",
28
- "nightwatch",
29
- "mysql-staging",
30
- "mysql-local",
31
- "mobile"
21
+ "nightwatch"
32
22
  ]
33
23
  }
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.183.0](https://github.com/railroadmedia/musora-content-services/compare/v2.182.0...v2.183.0) (2026-09-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * **MU2-1970:** Add magic link login services ([#1056](https://github.com/railroadmedia/musora-content-services/issues/1056)) ([964dc8e](https://github.com/railroadmedia/musora-content-services/commit/964dc8ee532b2bd30e36b697527cee8d5a039ae6))
11
+
5
12
  ## [2.182.0](https://github.com/railroadmedia/musora-content-services/compare/v2.181.0...v2.182.0) (2026-09-21)
6
13
 
7
14
 
package/CLAUDE.md CHANGED
@@ -11,6 +11,24 @@ Do not run tests or try to run tests with npm test unless explicitly asked.
11
11
 
12
12
  ## Code Style Standards
13
13
 
14
+ ### TypeScript Is Required for New Code
15
+
16
+ This repository is migrating from JavaScript to TypeScript. **All new code must be written in TypeScript.**
17
+
18
+ - New files are `.ts`, never `.js`.
19
+ - New functionality added to an existing `.js` service belongs in a `.ts` file, not appended to the `.js` one. Add it to the existing `.ts` module for that domain (e.g. `session.ts` rather than the legacy `sessions.js`), or create a new `.ts` file if none fits.
20
+ - Do not convert an existing `.js` file to `.ts` as a side effect of an unrelated change - migrations are their own commit.
21
+ - Type every exported function's parameters and return value. Use `Promise<void>` rather than leaving a return untyped.
22
+ - Declare request/response shapes as exported `interface`s. Extend the shared types in `src/services/user/types.d.ts` where one already fits, rather than redeclaring it.
23
+ - JSDoc is for explaining behavior the types cannot express (for example, that an endpoint deliberately resolves on both success and failure). Do not restate parameter and return types in JSDoc - the signature is the documentation.
24
+ - Typecheck before considering a change done:
25
+
26
+ ```bash
27
+ npx tsc --noEmit -p tsconfig.json
28
+ ```
29
+
30
+ The index generator handles `.js` and `.ts` alike, so a new `.ts` service is picked up by `npm run build-index` with no extra step.
31
+
14
32
  ### Self-Documenting Code
15
33
  - Write clear, descriptive function and variable names that eliminate the need for comments
16
34
  - Never add comments explaining what code does - the code itself should be clear
@@ -125,6 +143,8 @@ All services are located in `src/services/` and organized by domain:
125
143
 
126
144
  **User Services** (`src/services/user/`)
127
145
  - `account.ts` - Account management, email changes, password resets
146
+ - `session.ts` - OAuth providers, admin impersonation, magic link login
147
+ - `sessions.js` - Legacy password login, logout, auth-key URLs
128
148
  - `profile.js` - User profiles, pictures, signatures
129
149
  - `permissions.js` - User permission checking
130
150
  - `notifications.js` - Notification management
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.182.0",
3
+ "version": "2.183.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.d.ts CHANGED
@@ -515,7 +515,9 @@ import {
515
515
  import {
516
516
  listOAuthProviders,
517
517
  loginAsUser,
518
+ loginWithMagicLink,
518
519
  redirectToOAuthProvider,
520
+ requestMagicLoginLink,
519
521
  unlinkOAuthProvider,
520
522
  verifyOAuthToken
521
523
  } from './services/user/session.ts';
@@ -833,6 +835,7 @@ declare module 'musora-content-services' {
833
835
  lockThread,
834
836
  login,
835
837
  loginAsUser,
838
+ loginWithMagicLink,
836
839
  logout,
837
840
  mapContentToParent,
838
841
  markAllNotificationsAsRead,
@@ -869,6 +872,7 @@ declare module 'musora-content-services' {
869
872
  reportComment,
870
873
  reportPlaylist,
871
874
  requestEmailChange,
875
+ requestMagicLoginLink,
872
876
  rescindInvite,
873
877
  reset,
874
878
  resetActiveLearningPath,
package/src/index.js CHANGED
@@ -519,7 +519,9 @@ import {
519
519
  import {
520
520
  listOAuthProviders,
521
521
  loginAsUser,
522
+ loginWithMagicLink,
522
523
  redirectToOAuthProvider,
524
+ requestMagicLoginLink,
523
525
  unlinkOAuthProvider,
524
526
  verifyOAuthToken
525
527
  } from './services/user/session.ts';
@@ -832,6 +834,7 @@ export {
832
834
  lockThread,
833
835
  login,
834
836
  loginAsUser,
837
+ loginWithMagicLink,
835
838
  logout,
836
839
  mapContentToParent,
837
840
  markAllNotificationsAsRead,
@@ -868,6 +871,7 @@ export {
868
871
  reportComment,
869
872
  reportPlaylist,
870
873
  requestEmailChange,
874
+ requestMagicLoginLink,
871
875
  rescindInvite,
872
876
  reset,
873
877
  resetActiveLearningPath,
@@ -58,3 +58,37 @@ export async function loginAsUser(userId: string): Promise<AuthResponse> {
58
58
  {}
59
59
  )
60
60
  }
61
+
62
+ export interface MagicLinkAuthResponse extends AuthResponse {
63
+ refresh_token: string | null
64
+ redirect_to: string | null
65
+ }
66
+
67
+ export interface MagicLinkDeviceParams {
68
+ device_name?: string
69
+ device_token?: string
70
+ platform?: 'ios' | 'android'
71
+ }
72
+
73
+ /**
74
+ * Resolves whether or not an account exists for the email, so the endpoint
75
+ * cannot be used to discover which addresses are registered.
76
+ */
77
+ export async function requestMagicLoginLink(
78
+ email: string,
79
+ redirectTo: string | null = null
80
+ ): Promise<void> {
81
+ const apiUrl = '/api/user-management-system/v1/sessions/magic-link'
82
+ const httpClient = new HttpClient(globalConfig.baseUrl)
83
+ await httpClient.post(apiUrl, { email, redirect_to: redirectTo })
84
+ }
85
+
86
+ export async function loginWithMagicLink(
87
+ email: string,
88
+ token: string,
89
+ params: MagicLinkDeviceParams = {}
90
+ ): Promise<MagicLinkAuthResponse> {
91
+ const apiUrl = '/api/user-management-system/v1/sessions/magic-link/exchange'
92
+ const httpClient = new HttpClient(globalConfig.baseUrl)
93
+ return httpClient.post<MagicLinkAuthResponse>(apiUrl, { email, token, ...params })
94
+ }
@@ -1 +1 @@
1
- export const MCS_VERSION = '2.182.0'
1
+ export const MCS_VERSION = '2.183.0'
Binary file
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });