musora-content-services 1.6.3 → 1.6.5
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/.github/workflows/node.js.yml +0 -0
- package/.github/workflows/sync-docs.yml +56 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/CHANGELOG.md +4 -0
- package/README.md +2 -1
- package/babel.config.cjs +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/jest.config.js +0 -0
- package/package.json +1 -1
- package/src/contentTypeConfig.js +1 -0
- package/src/services/imageSRCBuilder.js +2 -0
- package/src/services/sanity.js +0 -2
- package/test/initializeTests.js +0 -1
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.test.js +26 -8
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Sync README to Mintlify Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths: [ 'README.md' ]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
sync-readme:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout source repository
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
|
|
18
|
+
- name: Checkout Mintlify docs repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
repository: railroadmedia/documentation
|
|
22
|
+
ref: main
|
|
23
|
+
token: ${{ secrets.ORG_DOCS_SYNC_TOKEN }}
|
|
24
|
+
path: mintlify-docs
|
|
25
|
+
persist-credentials: true
|
|
26
|
+
|
|
27
|
+
- name: Copy README to docs
|
|
28
|
+
run: |
|
|
29
|
+
mkdir -p mintlify-docs/docs/repositories
|
|
30
|
+
# Extract repo name and create title
|
|
31
|
+
REPO_NAME="${{ github.event.repository.name }}"
|
|
32
|
+
REPO_TITLE=$(echo "$REPO_NAME" | sed 's/-/ /g' | sed 's/\b\w/\U&/g')
|
|
33
|
+
|
|
34
|
+
# Add frontmatter and copy content
|
|
35
|
+
cat > mintlify-docs/docs/repositories/${REPO_NAME}.mdx << EOF
|
|
36
|
+
---
|
|
37
|
+
title: "${REPO_TITLE}"
|
|
38
|
+
description: "Repository documentation for ${REPO_NAME}"
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
EOF
|
|
42
|
+
cat README.md >> mintlify-docs/docs/repositories/${REPO_NAME}.mdx
|
|
43
|
+
|
|
44
|
+
- name: Commit and push changes
|
|
45
|
+
working-directory: mintlify-docs
|
|
46
|
+
run: |
|
|
47
|
+
REPO_NAME="${{ github.event.repository.name }}"
|
|
48
|
+
git config --local user.email "action@github.com"
|
|
49
|
+
git config --local user.name "GitHub Action"
|
|
50
|
+
git add docs/repositories/${REPO_NAME}.mdx
|
|
51
|
+
if git diff --staged --quiet; then
|
|
52
|
+
echo "No changes to commit"
|
|
53
|
+
else
|
|
54
|
+
git commit -m "Update ${REPO_NAME} documentation from source repo"
|
|
55
|
+
git push
|
|
56
|
+
fi
|
package/.prettierignore
CHANGED
|
File without changes
|
package/.prettierrc
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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
|
+
### [1.6.5](https://github.com/railroadmedia/musora-content-services/compare/v1.6.4...v1.6.5) (2025-06-17)
|
|
6
|
+
|
|
7
|
+
### [1.6.4](https://github.com/railroadmedia/musora-content-services/compare/v1.6.3...v1.6.4) (2025-06-13)
|
|
8
|
+
|
|
5
9
|
### [1.6.3](https://github.com/railroadmedia/musora-content-services/compare/v1.6.2...v1.6.3) (2025-06-12)
|
|
6
10
|
|
|
7
11
|
### [1.6.2](https://github.com/railroadmedia/musora-content-services/compare/v1.6.1...v1.6.2) (2025-06-11)
|
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to the **musora-content-services** repository. This package provides a collection of utility functions designed
|
|
4
4
|
to fetch and manage content from our Sanity Studio. These functions are tailored to interact with our Sanity backend,
|
|
5
|
-
allowing you to easily retrieve, filter, and manipulate content for use in various applications.
|
|
5
|
+
allowing you to easily retrieve, filter, and manipulate content for use in various applications. Used on both web and
|
|
6
|
+
app front ends.
|
|
6
7
|
|
|
7
8
|
## Setup
|
|
8
9
|
To set up the Musora Content Services project for local development, follow these steps:
|
package/babel.config.cjs
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/collapse.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/nav.js
CHANGED
|
File without changes
|
package/docs/scripts/polyfill.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/search.js
CHANGED
|
File without changes
|
package/docs/styles/jsdoc.css
CHANGED
|
File without changes
|
package/docs/styles/prettify.css
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -32,6 +32,7 @@ export const DEFAULT_CHILD_FIELDS = [
|
|
|
32
32
|
`"image": thumbnail.asset->url`,
|
|
33
33
|
`"instructors": instructor[]->name`,
|
|
34
34
|
`length_in_seconds`,
|
|
35
|
+
`'permission_id': permission[]->railcontent_id`,
|
|
35
36
|
]
|
|
36
37
|
|
|
37
38
|
export const descriptionField = 'description[0].children[0].text'
|
|
@@ -38,6 +38,8 @@ export function buildImageSRC(url, options = {}) {
|
|
|
38
38
|
// Process Sanity URL first if applicable
|
|
39
39
|
if (url.includes('cdn.sanity.io')) {
|
|
40
40
|
url = applySanityTransformations(url, options)
|
|
41
|
+
} else if (url.includes('imagedelivery.net')) {
|
|
42
|
+
return url
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
// Then apply Cloudflare transformations
|
package/src/services/sanity.js
CHANGED
|
@@ -1956,8 +1956,6 @@ export async function fetchSanity(
|
|
|
1956
1956
|
}
|
|
1957
1957
|
|
|
1958
1958
|
function needsAccessDecorator(results, userPermissions, isAdmin) {
|
|
1959
|
-
if (globalConfig.sanityConfig.useDummyRailContentMethods) return results
|
|
1960
|
-
|
|
1961
1959
|
userPermissions = new Set(userPermissions)
|
|
1962
1960
|
|
|
1963
1961
|
if (Array.isArray(results)) {
|
package/test/initializeTests.js
CHANGED
|
@@ -23,7 +23,6 @@ export async function initializeTestService(useLive = false) {
|
|
|
23
23
|
useCachedAPI: process.env.SANITY_USE_CACHED_API === 'true' || true,
|
|
24
24
|
version: '2021-06-07',
|
|
25
25
|
debug: process.env.DEBUG === 'true' || false,
|
|
26
|
-
useDummyRailContentMethods: true,
|
|
27
26
|
},
|
|
28
27
|
railcontentConfig: {
|
|
29
28
|
baseUrl: process.env.RAILCONTENT_BASE_URL,
|
|
File without changes
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
@@ -137,10 +137,10 @@ describe('Sanity Queries', function () {
|
|
|
137
137
|
expect(returnedIds.length).toBe(2)
|
|
138
138
|
})
|
|
139
139
|
|
|
140
|
-
test('fetchUpcomingEvents', async () => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
})
|
|
140
|
+
// test('fetchUpcomingEvents', async () => {
|
|
141
|
+
// const response = await fetchUpcomingEvents('drumeo', {})
|
|
142
|
+
// expect(response.length).toBeGreaterThan(0)
|
|
143
|
+
// })
|
|
144
144
|
|
|
145
145
|
test('fetchUpcomingNewReleases', async () => {
|
|
146
146
|
const response = await fetchNewReleases('drumeo')
|
|
@@ -508,10 +508,10 @@ describe('Sanity Queries', function () {
|
|
|
508
508
|
expect(response.entity.length).toBeGreaterThan(0)
|
|
509
509
|
})
|
|
510
510
|
|
|
511
|
-
test('fetchScheduledReleases', async () => {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
})
|
|
511
|
+
// test('fetchScheduledReleases', async () => {
|
|
512
|
+
// const response = await fetchScheduledReleases('drumeo', {})
|
|
513
|
+
// expect(response.length).toBeGreaterThan(0)
|
|
514
|
+
// })
|
|
515
515
|
|
|
516
516
|
test('fetchAll-GroupBy-Genre', async () => {
|
|
517
517
|
let response = await fetchAll('drumeo', 'solo', { groupBy: 'genre' })
|
|
@@ -619,6 +619,24 @@ describe('Sanity Queries', function () {
|
|
|
619
619
|
expect(documentPublishedOn.getTime()).toBeLessThanOrEqual(nextDocumentPublishedOn.getTime())
|
|
620
620
|
})
|
|
621
621
|
|
|
622
|
+
test('fetchByRailContentId_Children', async () => {
|
|
623
|
+
const id = 235968
|
|
624
|
+
const document = await fetchByRailContentId(id, 'song-tutorial')
|
|
625
|
+
|
|
626
|
+
// Verify document has lessons array
|
|
627
|
+
expect(document.lessons).toBeDefined()
|
|
628
|
+
expect(Array.isArray(document.lessons)).toBe(true)
|
|
629
|
+
|
|
630
|
+
// If there are lessons, verify each lesson has the required fields
|
|
631
|
+
if (document.lessons.length > 0) {
|
|
632
|
+
document.lessons.forEach((lesson) => {
|
|
633
|
+
expect(lesson.need_access).toBeDefined()
|
|
634
|
+
expect(lesson.permission_id).toBeDefined()
|
|
635
|
+
expect(Array.isArray(lesson.permission_id)).toBe(true)
|
|
636
|
+
})
|
|
637
|
+
}
|
|
638
|
+
})
|
|
639
|
+
|
|
622
640
|
test('fetchTopLevelParentId', async () => {
|
|
623
641
|
let contentId = await fetchTopLevelParentId(241250)
|
|
624
642
|
expect(contentId).toBe(241247)
|