musora-content-services 2.187.0 → 2.188.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.
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.188.0](https://github.com/railroadmedia/musora-content-services/compare/v2.187.0...v2.188.0) (2026-10-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * **MU2-2024:** add brand filtering to promotional campaign queries ([0d6fed8](https://github.com/railroadmedia/musora-content-services/commit/0d6fed83329ccfeabab2ddbd6dff129075c1207b))
11
+
5
12
  ## [2.187.0](https://github.com/railroadmedia/musora-content-services/compare/v2.186.1...v2.187.0) (2026-10-19)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.187.0",
3
+ "version": "2.188.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/lib/brands.ts CHANGED
@@ -6,3 +6,5 @@ export enum Brands {
6
6
  Singeo = 'singeo',
7
7
  Playbass = 'playbass',
8
8
  }
9
+
10
+ export type Brand = 'musora' | 'drumeo' | 'pianote' | 'guitareo' | 'singeo' | 'playbass'
@@ -99,6 +99,7 @@ export type PromotionalCampaignDocument = {
99
99
  _createdAt: string
100
100
  _updatedAt: string
101
101
  _rev: string
102
+ brand: "musora" | "drumeo" | "pianote" | "singeo" | "guitareo" | "playbass"
102
103
  /** Campaign Name */
103
104
  name: string
104
105
  slug: { _type: "slug"; current: string }
@@ -5,8 +5,8 @@ import { Filters as f } from '../../lib/sanity/filter'
5
5
  import { groq } from '../../lib/sanity/groq'
6
6
  import type { GroqBuilder } from '../../lib/sanity/groq'
7
7
  import type { PromotionalCampaignDocument } from '../../lib/sanity/types/marketing'
8
- import { SanityQueryError } from '../../lib/sanity/runner'
9
8
  import { AsyncEither } from '../../lib/ads/async-either'
9
+ import { Brand } from '../../lib/brands'
10
10
 
11
11
  const excludeFromGeneratedIndex = [
12
12
  'campaignQuery',
@@ -36,6 +36,8 @@ export type WithUserCampaignState<T extends PromotionalCampaignDocument> = T & {
36
36
  }
37
37
 
38
38
  export interface CampaignQueryOptions {
39
+ /** Restricts the query to one brand's campaigns. */
40
+ brand?: Brand
39
41
  /** Restricts the query to one campaign, or to any of several. */
40
42
  slug?: string | string[]
41
43
  /** The moment the campaign window is tested against. Defaults to now. */
@@ -78,12 +80,13 @@ function slugFilter(slug: CampaignQueryOptions['slug']): string {
78
80
  export function campaignQuery(
79
81
  options: CampaignQueryOptions = {}
80
82
  ): GroqBuilder<PromotionalCampaignDocument[]> {
81
- const { slug, on = new Date(), running = true, active = true } = options
83
+ const { brand, slug, on = new Date(), running = true, active = true } = options
82
84
 
83
85
  return groq<PromotionalCampaignDocument[]>()
84
86
  .and(
85
87
  f.combine(
86
88
  f.type('promotional-campaign'),
89
+ brand && f.brand(brand),
87
90
  active && f.flag('active'),
88
91
  running && f.dateWithin('starts_at', 'ends_at', on.toISOString()),
89
92
  slugFilter(slug)
@@ -1 +1 @@
1
- export const MCS_VERSION = '2.187.0'
1
+ export const MCS_VERSION = '2.188.0'