musora-content-services 2.107.4 → 2.107.6

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.
Files changed (218) hide show
  1. package/.claude/settings.local.json +3 -10
  2. package/.coderabbit.yaml +0 -0
  3. package/.editorconfig +0 -0
  4. package/.github/pull_request_template.md +0 -0
  5. package/.github/workflows/conventional-commits.yaml +0 -0
  6. package/.github/workflows/docs.js.yml +0 -0
  7. package/.github/workflows/node.js.yml +0 -0
  8. package/.prettierignore +0 -0
  9. package/.prettierrc +0 -0
  10. package/CHANGELOG.md +14 -0
  11. package/CLAUDE.md +0 -0
  12. package/README.md +0 -0
  13. package/babel.config.cjs +0 -0
  14. package/jest.config.js +0 -0
  15. package/jsdoc.json +0 -0
  16. package/package.json +1 -1
  17. package/src/constants/award-assets.js +0 -0
  18. package/src/contentMetaData.js +0 -0
  19. package/src/filterBuilder.js +0 -0
  20. package/src/index.d.ts +2 -6
  21. package/src/index.js +2 -6
  22. package/src/infrastructure/http/HttpClient.ts +0 -0
  23. package/src/infrastructure/http/executors/FetchRequestExecutor.ts +0 -0
  24. package/src/infrastructure/http/index.ts +0 -0
  25. package/src/infrastructure/http/interfaces/HeaderProvider.ts +0 -0
  26. package/src/infrastructure/http/interfaces/HttpError.ts +0 -0
  27. package/src/infrastructure/http/interfaces/NetworkError.ts +0 -0
  28. package/src/infrastructure/http/interfaces/RequestExecutor.ts +0 -0
  29. package/src/infrastructure/http/interfaces/RequestOptions.ts +0 -0
  30. package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +0 -0
  31. package/src/lib/ads/monoid.ts +0 -0
  32. package/src/lib/ads/semigroup.ts +0 -0
  33. package/src/lib/brands.ts +0 -0
  34. package/src/lib/lastUpdated.js +0 -0
  35. package/src/lib/sanity/filter.ts +0 -0
  36. package/src/lib/sanity/query.ts +0 -0
  37. package/src/services/api/types.js +0 -0
  38. package/src/services/api/types.ts +0 -0
  39. package/src/services/awards/award-callbacks.js +0 -0
  40. package/src/services/awards/award-query.js +0 -0
  41. package/src/services/awards/internal/.indexignore +0 -0
  42. package/src/services/awards/internal/award-definitions.js +0 -0
  43. package/src/services/awards/internal/award-events.js +0 -0
  44. package/src/services/awards/internal/award-manager.js +0 -0
  45. package/src/services/awards/internal/certificate-builder.js +0 -0
  46. package/src/services/awards/internal/completion-data-generator.js +0 -0
  47. package/src/services/awards/internal/content-progress-observer.js +0 -0
  48. package/src/services/awards/internal/image-utils.js +0 -0
  49. package/src/services/awards/internal/message-generator.js +0 -0
  50. package/src/services/awards/internal/types.js +0 -0
  51. package/src/services/awards/types.d.ts +0 -0
  52. package/src/services/awards/types.js +0 -0
  53. package/src/services/config.js +0 -0
  54. package/src/services/content/artist.ts +0 -0
  55. package/src/services/content/content.ts +0 -0
  56. package/src/services/content/genre.ts +0 -0
  57. package/src/services/content/instructor.ts +0 -0
  58. package/src/services/content-org/content-org.js +0 -0
  59. package/src/services/content-org/guided-courses.ts +0 -0
  60. package/src/services/content-org/learning-paths.ts +5 -5
  61. package/src/services/content-org/playlists-types.js +0 -0
  62. package/src/services/content-org/playlists.js +0 -0
  63. package/src/services/content.js +0 -0
  64. package/src/services/contentAggregator.js +0 -0
  65. package/src/services/contentLikes.js +0 -0
  66. package/src/services/contentProgress.js +83 -33
  67. package/src/services/dataContext.js +0 -0
  68. package/src/services/dateUtils.js +0 -0
  69. package/src/services/eventsAPI.js +0 -0
  70. package/src/services/forums/categories.ts +0 -0
  71. package/src/services/forums/forums.ts +0 -0
  72. package/src/services/forums/types.ts +0 -0
  73. package/src/services/gamification/awards.ts +0 -0
  74. package/src/services/gamification/gamification.js +0 -0
  75. package/src/services/imageSRCBuilder.js +0 -0
  76. package/src/services/imageSRCVerify.js +0 -0
  77. package/src/services/liveTesting.ts +0 -0
  78. package/src/services/permissions/PermissionsAdapter.ts +0 -0
  79. package/src/services/permissions/PermissionsAdapterFactory.ts +0 -0
  80. package/src/services/permissions/PermissionsV1Adapter.ts +0 -0
  81. package/src/services/permissions/PermissionsV2Adapter.ts +0 -0
  82. package/src/services/permissions/README.md +0 -0
  83. package/src/services/permissions/index.ts +0 -0
  84. package/src/services/progress-events.js +0 -52
  85. package/src/services/progress-row/method-card.js +0 -0
  86. package/src/services/recommendations.js +0 -0
  87. package/src/services/reporting/README.md +0 -0
  88. package/src/services/reporting/types.ts +0 -0
  89. package/src/services/sanity.js +1 -1
  90. package/src/services/sentry/.indexignore +0 -0
  91. package/src/services/sentry/index.ts +0 -0
  92. package/src/services/sync/.indexignore +0 -0
  93. package/src/services/sync/adapters/factory.ts +0 -0
  94. package/src/services/sync/adapters/lokijs.ts +0 -0
  95. package/src/services/sync/adapters/sqlite.ts +0 -0
  96. package/src/services/sync/concurrency-safety.ts +0 -0
  97. package/src/services/sync/context/index.ts +0 -0
  98. package/src/services/sync/context/providers/base.ts +0 -0
  99. package/src/services/sync/context/providers/connectivity.ts +0 -0
  100. package/src/services/sync/context/providers/durability.ts +0 -0
  101. package/src/services/sync/context/providers/index.ts +0 -0
  102. package/src/services/sync/context/providers/session.ts +0 -0
  103. package/src/services/sync/context/providers/tabs.ts +0 -0
  104. package/src/services/sync/context/providers/visibility.ts +0 -0
  105. package/src/services/sync/database/factory.ts +0 -0
  106. package/src/services/sync/errors/boundary.ts +0 -0
  107. package/src/services/sync/errors/index.ts +0 -0
  108. package/src/services/sync/errors/validators.ts +0 -0
  109. package/src/services/sync/fetch.ts +0 -0
  110. package/src/services/sync/index.ts +0 -0
  111. package/src/services/sync/manager.ts +0 -4
  112. package/src/services/sync/models/Base.ts +0 -0
  113. package/src/services/sync/models/ContentLike.ts +0 -0
  114. package/src/services/sync/models/ContentProgress.ts +0 -0
  115. package/src/services/sync/models/Practice.ts +0 -0
  116. package/src/services/sync/models/PracticeDayNote.ts +0 -0
  117. package/src/services/sync/models/UserAwardProgress.ts +0 -0
  118. package/src/services/sync/models/index.ts +0 -0
  119. package/src/services/sync/repositories/base.ts +12 -8
  120. package/src/services/sync/repositories/content-likes.ts +0 -0
  121. package/src/services/sync/repositories/content-progress.ts +11 -7
  122. package/src/services/sync/repositories/index.ts +0 -0
  123. package/src/services/sync/repositories/practice-day-notes.ts +0 -0
  124. package/src/services/sync/repositories/practices.ts +0 -0
  125. package/src/services/sync/repositories/user-award-progress.ts +0 -0
  126. package/src/services/sync/repository-proxy.ts +0 -0
  127. package/src/services/sync/resolver.ts +0 -0
  128. package/src/services/sync/retry.ts +0 -0
  129. package/src/services/sync/run-scope.ts +0 -0
  130. package/src/services/sync/schema/index.ts +0 -0
  131. package/src/services/sync/serializers/index.ts +0 -0
  132. package/src/services/sync/serializers/model.ts +0 -0
  133. package/src/services/sync/serializers/raw.ts +0 -0
  134. package/src/services/sync/store/index.ts +13 -9
  135. package/src/services/sync/store/push-coalescer.ts +0 -0
  136. package/src/services/sync/store-configs.ts +0 -0
  137. package/src/services/sync/strategies/base.ts +0 -0
  138. package/src/services/sync/strategies/index.ts +0 -0
  139. package/src/services/sync/strategies/initial.ts +0 -0
  140. package/src/services/sync/strategies/polling.ts +0 -0
  141. package/src/services/sync/telemetry/index.ts +0 -0
  142. package/src/services/sync/telemetry/sampling.ts +0 -0
  143. package/src/services/sync/utils/event-emitter.ts +0 -0
  144. package/src/services/sync/utils/index.ts +0 -0
  145. package/src/services/sync/utils/throttle.ts +0 -0
  146. package/src/services/sync/utils/timers.ts +0 -0
  147. package/src/services/types.js +0 -0
  148. package/src/services/user/account.ts +0 -0
  149. package/src/services/user/chat.js +0 -0
  150. package/src/services/user/interests.js +0 -0
  151. package/src/services/user/management.js +0 -0
  152. package/src/services/user/memberships.ts +0 -0
  153. package/src/services/user/notifications.js +0 -0
  154. package/src/services/user/onboarding.ts +0 -0
  155. package/src/services/user/payments.ts +0 -0
  156. package/src/services/user/permissions.js +0 -0
  157. package/src/services/user/profile.js +0 -0
  158. package/src/services/user/sessions.js +0 -0
  159. package/src/services/user/types.d.ts +0 -0
  160. package/src/services/user/types.js +0 -0
  161. package/src/services/user/user-management-system.js +0 -0
  162. package/src/services/userActivity.js +0 -0
  163. package/test/HttpClient.test.js +0 -0
  164. package/test/awards/award-alacarte-observer.test.js +0 -0
  165. package/test/awards/award-auto-refresh.test.js +0 -0
  166. package/test/awards/award-calculations.test.js +0 -0
  167. package/test/awards/award-certificate-display.test.js +0 -0
  168. package/test/awards/award-collection-edge-cases.test.js +0 -0
  169. package/test/awards/award-collection-filtering.test.js +0 -0
  170. package/test/awards/award-completion-flow.test.js +0 -0
  171. package/test/awards/award-exclusion-handling.test.js +0 -0
  172. package/test/awards/award-multi-lesson.test.js +0 -0
  173. package/test/awards/award-observer-integration.test.js +0 -0
  174. package/test/awards/award-query-messages.test.js +0 -0
  175. package/test/awards/award-user-collection.test.js +0 -0
  176. package/test/awards/duplicate-prevention.test.js +0 -0
  177. package/test/awards/helpers/completion-mock.js +0 -0
  178. package/test/awards/helpers/index.js +0 -0
  179. package/test/awards/helpers/mock-setup.js +0 -0
  180. package/test/awards/helpers/progress-emitter.js +0 -0
  181. package/test/awards/message-generator.test.js +0 -0
  182. package/test/content.test.js +0 -0
  183. package/test/contentLikes.test.js +0 -0
  184. package/test/contentProgress.test.js +0 -0
  185. package/test/dataContext.test.js +0 -0
  186. package/test/forum.test.js +0 -0
  187. package/test/imageSRCBuilder.test.js +0 -0
  188. package/test/imageSRCVerify.test.js +0 -0
  189. package/test/initializeTests.js +0 -0
  190. package/test/learningPaths.test.js +0 -0
  191. package/test/lib/__snapshots__/filter.test.ts.snap +0 -0
  192. package/test/lib/filter.test.ts +0 -0
  193. package/test/lib/lastUpdated.test.js +0 -0
  194. package/test/lib/query.test.ts +0 -0
  195. package/test/live/contentProgressLive.test.js +0 -0
  196. package/test/live/railcontentLive.test.js +0 -0
  197. package/test/localStorageMock.js +0 -0
  198. package/test/log.js +0 -0
  199. package/test/mockData/award-definitions.js +0 -0
  200. package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
  201. package/test/mockData/mockData_progress_content.json +0 -0
  202. package/test/mockData/mockData_sanity_progress_content.json +0 -0
  203. package/test/mockData/mockData_user_practices.json +0 -0
  204. package/test/notifications.test.js +0 -0
  205. package/test/progressRows.test.js +0 -0
  206. package/test/sanityQueryService.test.js +0 -0
  207. package/test/streakMessage.test.js +0 -0
  208. package/test/sync/adapter.ts +0 -0
  209. package/test/sync/initialize-sync-manager.js +0 -0
  210. package/test/sync/models/award-database-integration.test.js +0 -0
  211. package/test/user/permissions.test.js +0 -0
  212. package/test/userActivity.test.js +0 -0
  213. package/tools/generate-index.cjs +0 -0
  214. package/.yarnrc.yml +0 -1
  215. package/check_content.js +0 -30
  216. package/check_content.mjs +0 -32
  217. package/test/reporting.test.js +0 -132
  218. package/test_owned_navigate.js +0 -74
@@ -927,7 +927,7 @@ export async function fetchLessonContent(railContentId, { addParent = false } =
927
927
  "instructor": ${instructorField},
928
928
  ${assignmentsField}
929
929
  video,
930
- length_in_seconds,
930
+ "length_in_seconds": coalesce(soundslice[0].soundslice_length_in_second, length_in_seconds),
931
931
  mp3_no_drums_no_click_url,
932
932
  mp3_no_drums_yes_click_url,
933
933
  mp3_yes_drums_no_click_url,
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
File without changes
@@ -14,9 +14,6 @@ import { inBoundary } from './errors/boundary'
14
14
  import createStoresFromConfig from './store-configs'
15
15
  import { contentProgressObserver } from '../awards/internal/content-progress-observer'
16
16
 
17
- import { onProgressSaved, onContentCompleted } from '../progress-events'
18
- import { onContentCompletedLearningPathListener } from '../content-org/learning-paths'
19
-
20
17
  export default class SyncManager {
21
18
  private static counter = 0
22
19
  private static instance: SyncManager | null = null
@@ -137,7 +134,6 @@ export default class SyncManager {
137
134
  contentProgressObserver.start(this.database).catch((error) => {
138
135
  this.telemetry.error('[SyncManager] Failed to start contentProgressObserver', error)
139
136
  })
140
- onContentCompleted(onContentCompletedLearningPathListener)
141
137
 
142
138
  const teardown = async () => {
143
139
  this.telemetry.debug('[SyncManager] Tearing down')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -96,10 +96,10 @@ export default class SyncRepository<TModel extends BaseModel> {
96
96
  )
97
97
  }
98
98
 
99
- protected async upsertOne(id: RecordId, builder: (record: TModel) => void) {
99
+ protected async upsertOne(id: RecordId, builder: (record: TModel) => void, { skipPush = false } = {}) {
100
100
  return this.store.telemetry.trace(
101
101
  { name: `upsertOne:${this.store.model.table}`, op: 'upsert' },
102
- (span) => this._respondToWrite(() => this.store.upsertOne(id, builder, span), span)
102
+ (span) => this._respondToWrite(() => this.store.upsertOne(id, builder, span, {skipPush}), span)
103
103
  )
104
104
  }
105
105
 
@@ -110,24 +110,24 @@ export default class SyncRepository<TModel extends BaseModel> {
110
110
  )
111
111
  }
112
112
 
113
- protected async upsertSome(builders: Record<RecordId, (record: TModel) => void>) {
113
+ protected async upsertSome(builders: Record<RecordId, (record: TModel) => void>, { skipPush = false } = {}) {
114
114
  return this.store.telemetry.trace(
115
115
  { name: `upsertSome:${this.store.model.table}`, op: 'upsert' },
116
- (span) => this._respondToWrite(() => this.store.upsertSome(builders, span), span)
116
+ (span) => this._respondToWrite(() => this.store.upsertSome(builders, span, {skipPush}), span)
117
117
  )
118
118
  }
119
119
 
120
- protected async upsertSomeTentative(builders: Record<RecordId, (record: TModel) => void>) {
120
+ protected async upsertSomeTentative(builders: Record<RecordId, (record: TModel) => void>, { skipPush = false } = {}) {
121
121
  return this.store.telemetry.trace(
122
122
  { name: `upsertSomeTentative:${this.store.model.table}`, op: 'upsert' },
123
- (span) => this._respondToWrite(() => this.store.upsertSomeTentative(builders, span), span)
123
+ (span) => this._respondToWrite(() => this.store.upsertSomeTentative(builders, span, {skipPush}), span)
124
124
  )
125
125
  }
126
126
 
127
- protected async deleteOne(id: RecordId) {
127
+ protected async deleteOne(id: RecordId, { skipPush = false } = {}) {
128
128
  return this.store.telemetry.trace(
129
129
  { name: `delete:${this.store.model.table}`, op: 'delete' },
130
- (span) => this._respondToWriteIds(() => this.store.deleteOne(id, span), span)
130
+ (span) => this._respondToWriteIds(() => this.store.deleteOne(id, span, {skipPush}), span)
131
131
  )
132
132
  }
133
133
 
@@ -244,4 +244,8 @@ export default class SyncRepository<TModel extends BaseModel> {
244
244
  }
245
245
  return result
246
246
  }
247
+
248
+ protected async _requestPushUnsynced() {
249
+ await this.store.pushUnsyncedWithRetry()
250
+ }
247
251
  }
File without changes
@@ -133,7 +133,7 @@ export default class ProgressRepository extends SyncRepository<ContentProgress>
133
133
  }
134
134
  }
135
135
 
136
- recordProgress(contentId: number, collection: CollectionParameter | null, progressPct: number, resumeTime?: number) {
136
+ recordProgress(contentId: number, collection: CollectionParameter | null, progressPct: number, resumeTime?: number, {skipPush = false} = {}) {
137
137
  const id = ProgressRepository.generateId(contentId, collection)
138
138
 
139
139
  const result = this.upsertOne(id, (r) => {
@@ -146,7 +146,7 @@ export default class ProgressRepository extends SyncRepository<ContentProgress>
146
146
  if (typeof resumeTime != 'undefined') {
147
147
  r.resume_time_seconds = Math.floor(resumeTime)
148
148
  }
149
- })
149
+ }, { skipPush })
150
150
 
151
151
  // Emit event AFTER database write completes
152
152
  result.then(() => {
@@ -176,7 +176,7 @@ export default class ProgressRepository extends SyncRepository<ContentProgress>
176
176
  recordProgressMany(
177
177
  contentProgresses: Record<string, number>, // Accept plain object
178
178
  collection: CollectionParameter | null,
179
- tentative: boolean
179
+ { tentative = true, skipPush = false }: { tentative?: boolean; skipPush?: boolean } = {}
180
180
  ) {
181
181
 
182
182
  const data = Object.fromEntries(
@@ -192,14 +192,18 @@ export default class ProgressRepository extends SyncRepository<ContentProgress>
192
192
  ])
193
193
  )
194
194
  return tentative
195
- ? this.upsertSomeTentative(data)
196
- : this.upsertSome(data)
195
+ ? this.upsertSomeTentative(data, { skipPush })
196
+ : this.upsertSome(data, { skipPush })
197
197
 
198
198
  //todo add event emitting for bulk updates?
199
199
  }
200
200
 
201
- eraseProgress(contentId: number, collection: CollectionParameter | null) {
202
- return this.deleteOne(ProgressRepository.generateId(contentId, collection))
201
+ eraseProgress(contentId: number, collection: CollectionParameter | null, {skipPush = false} = {}) {
202
+ return this.deleteOne(ProgressRepository.generateId(contentId, collection), { skipPush })
203
+ }
204
+
205
+ async requestPushUnsynced() {
206
+ await this._requestPushUnsynced()
203
207
  }
204
208
 
205
209
  private static generateId(
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
@@ -235,7 +235,7 @@ export default class SyncStore<TModel extends BaseModel = BaseModel> {
235
235
  })
236
236
  }
237
237
 
238
- async upsertSome(builders: Record<RecordId, (record: TModel) => void>, span?: Span) {
238
+ async upsertSome(builders: Record<RecordId, (record: TModel) => void>, span?: Span, { skipPush = false } = {}) {
239
239
  if (Object.keys(builders).length === 0) return []
240
240
 
241
241
  return await this.runScope.abortable(async () => {
@@ -298,29 +298,31 @@ export default class SyncStore<TModel extends BaseModel = BaseModel> {
298
298
 
299
299
  this.emit('upserted', records)
300
300
 
301
- this.pushUnsyncedWithRetry(span)
301
+ if (!skipPush) {
302
+ this.pushUnsyncedWithRetry(span)
303
+ }
302
304
  await this.ensurePersistence()
303
305
 
304
306
  return records.map((record) => this.modelSerializer.toPlainObject(record))
305
307
  })
306
308
  }
307
309
 
308
- async upsertSomeTentative(builders: Record<RecordId, (record: TModel) => void>, span?: Span) {
310
+ async upsertSomeTentative(builders: Record<RecordId, (record: TModel) => void>, span?: Span, { skipPush = false } = {}) {
309
311
  return this.upsertSome(Object.fromEntries(Object.entries(builders).map(([id, builder]) => [id, record => {
310
312
  builder(record)
311
313
  record._raw._status = 'synced'
312
- }])), span)
314
+ }])), span, {skipPush})
313
315
  }
314
316
 
315
- async upsertOne(id: RecordId, builder: (record: TModel) => void, span?: Span) {
316
- return this.upsertSome({ [id]: builder }, span).then(r => r[0])
317
+ async upsertOne(id: RecordId, builder: (record: TModel) => void, span?: Span, { skipPush = false } = {}) {
318
+ return this.upsertSome({ [id]: builder }, span, {skipPush}).then(r => r[0])
317
319
  }
318
320
 
319
321
  async upsertOneTentative(id: string, builder: (record: TModel) => void, span?: Span) {
320
322
  return this.upsertSomeTentative({ [id]: builder }, span).then(r => r[0])
321
323
  }
322
324
 
323
- async deleteOne(id: RecordId, span?: Span) {
325
+ async deleteOne(id: RecordId, span?: Span, { skipPush = false } = {}) {
324
326
  return await this.runScope.abortable(async () => {
325
327
  let record: TModel | null = null
326
328
 
@@ -345,7 +347,9 @@ export default class SyncStore<TModel extends BaseModel = BaseModel> {
345
347
 
346
348
  this.emit('deleted', [id])
347
349
 
348
- this.pushUnsyncedWithRetry(span)
350
+ if (!skipPush) {
351
+ this.pushUnsyncedWithRetry(span)
352
+ }
349
353
  await this.ensurePersistence()
350
354
 
351
355
  return id
@@ -477,7 +481,7 @@ export default class SyncStore<TModel extends BaseModel = BaseModel> {
477
481
  )()
478
482
  }
479
483
 
480
- private async pushUnsyncedWithRetry(span?: Span) {
484
+ public async pushUnsyncedWithRetry(span?: Span) {
481
485
  const records = await this.queryMaybeDeletedRecords(Q.where('_status', Q.notEq('synced')))
482
486
 
483
487
  if (records.length) {
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
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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/test/log.js 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
package/.yarnrc.yml DELETED
@@ -1 +0,0 @@
1
- nodeLinker: node-modules
package/check_content.js DELETED
@@ -1,30 +0,0 @@
1
- const { initializeService } = require('./src/services/config.js');
2
- const { fetchByRailContentIds } = require('./src/services/sanity.js');
3
- require('dotenv/config');
4
-
5
- async function checkContent() {
6
- initializeService({
7
- sanityConfig: {
8
- token: process.env.SANITY_TOKEN,
9
- projectId: process.env.SANITY_PROJECT_ID,
10
- dataset: process.env.SANITY_DATASET,
11
- version: process.env.SANITY_VERSION || '2021-06-07',
12
- },
13
- railcontentConfig: {
14
- token: process.env.RAILCONTENT_TOKEN,
15
- userId: process.env.RAILCONTENT_USER_ID,
16
- baseUrl: process.env.RAILCONTENT_BASE_URL,
17
- authToken: process.env.RAILCONTENT_AUTH_TOKEN,
18
- },
19
- baseUrl: process.env.RAILCONTENT_BASE_URL,
20
- localStorage: null,
21
- isMA: false,
22
- });
23
-
24
- console.log('Checking railcontent_id: 421814');
25
- const contents = await fetchByRailContentIds([421814]);
26
- console.log('Results:', JSON.stringify(contents, null, 2));
27
- console.log('Found:', contents.length, 'items');
28
- }
29
-
30
- checkContent().catch(console.error);
package/check_content.mjs DELETED
@@ -1,32 +0,0 @@
1
- import { initializeService } from './src/services/config.js';
2
- import { fetchByRailContentIds } from './src/services/sanity.js';
3
- import dotenv from 'dotenv';
4
-
5
- dotenv.config();
6
-
7
- async function checkContent() {
8
- initializeService({
9
- sanityConfig: {
10
- token: process.env.SANITY_TOKEN,
11
- projectId: process.env.SANITY_PROJECT_ID,
12
- dataset: process.env.SANITY_DATASET,
13
- version: process.env.SANITY_VERSION || '2021-06-07',
14
- },
15
- railcontentConfig: {
16
- token: process.env.RAILCONTENT_TOKEN,
17
- userId: process.env.RAILCONTENT_USER_ID,
18
- baseUrl: process.env.RAILCONTENT_BASE_URL,
19
- authToken: process.env.RAILCONTENT_AUTH_TOKEN,
20
- },
21
- baseUrl: process.env.RAILCONTENT_BASE_URL,
22
- localStorage: null,
23
- isMA: false,
24
- });
25
-
26
- console.log('Checking railcontent_id: 421814');
27
- const contents = await fetchByRailContentIds([421814]);
28
- console.log('Results:', JSON.stringify(contents, null, 2));
29
- console.log('Found:', contents.length, 'items');
30
- }
31
-
32
- checkContent().catch(console.error);