musora-content-services 2.182.0 → 2.183.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/.claude/settings.local.json +5 -13
- package/CHANGELOG.md +14 -0
- package/CLAUDE.md +20 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -0
- package/src/index.js +4 -0
- package/src/services/user/account.ts +5 -3
- package/src/services/user/session.ts +34 -0
- package/src/version-info.js +1 -1
- package/.yarn/install-state.gz +0 -0
- package/dist/services/api/types.js +0 -2
|
@@ -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,17 @@
|
|
|
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
21
|
"nightwatch",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"mobile"
|
|
22
|
+
"sentry",
|
|
23
|
+
"customerio"
|
|
32
24
|
]
|
|
33
25
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.1](https://github.com/railroadmedia/musora-content-services/compare/v2.183.0...v2.183.1) (2026-09-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* send_email param on account status ([ad43c46](https://github.com/railroadmedia/musora-content-services/commit/ad43c46102a14d9a4ce0136dbc682e7f3a6adb08))
|
|
11
|
+
|
|
12
|
+
## [2.183.0](https://github.com/railroadmedia/musora-content-services/compare/v2.182.0...v2.183.0) (2026-09-24)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **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))
|
|
18
|
+
|
|
5
19
|
## [2.182.0](https://github.com/railroadmedia/musora-content-services/compare/v2.181.0...v2.182.0) (2026-09-21)
|
|
6
20
|
|
|
7
21
|
|
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
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,
|
|
@@ -20,10 +20,10 @@ export interface AccountStatus {
|
|
|
20
20
|
*
|
|
21
21
|
* @throws {HttpError} - Throws HttpError if the request fails.
|
|
22
22
|
*/
|
|
23
|
-
export async function status(email: string): Promise<AccountStatus> {
|
|
23
|
+
export async function status(email: string, send_email: boolean = true): Promise<AccountStatus> {
|
|
24
24
|
const httpClient = new HttpClient(globalConfig.baseUrl)
|
|
25
25
|
return await httpClient.post<AccountStatus>(
|
|
26
|
-
`/api/user-management-system/v1/accounts/${encodeURIComponent(email)}/status`,
|
|
26
|
+
`/api/user-management-system/v1/accounts/${encodeURIComponent(email)}/status?send_email=${send_email}`,
|
|
27
27
|
[]
|
|
28
28
|
)
|
|
29
29
|
}
|
|
@@ -129,7 +129,9 @@ export interface PendingAccountResponse {
|
|
|
129
129
|
* @returns {Promise<PendingAccountResponse>} - A promise that resolves when the pending account is created or an HttpError if the request fails.
|
|
130
130
|
* @throws {HttpError} - Throws an HttpError if the HTTP request fails.
|
|
131
131
|
*/
|
|
132
|
-
export async function createPendingAccount(
|
|
132
|
+
export async function createPendingAccount(
|
|
133
|
+
props: PendingAccountProps
|
|
134
|
+
): Promise<PendingAccountResponse> {
|
|
133
135
|
const httpClient = new HttpClient(globalConfig.baseUrl)
|
|
134
136
|
return await httpClient.post<PendingAccountResponse>(
|
|
135
137
|
`/api/user-management-system/v1/accounts/pending`,
|
|
@@ -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
|
+
}
|
package/src/version-info.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const MCS_VERSION = '2.
|
|
1
|
+
export const MCS_VERSION = '2.183.1'
|
package/.yarn/install-state.gz
DELETED
|
Binary file
|