@studyportals/fawkes 8.7.2 → 9.0.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.
Files changed (41) hide show
  1. package/README.md +176 -176
  2. package/dist/sitemap-generator-seo/index.d.ts +1 -1
  3. package/dist/src/common/FilterKeyToFilterTypeMap.d.ts +2 -0
  4. package/dist/src/common/FilterKeyToFilterTypeMap.js +14 -0
  5. package/dist/src/common/FilterTypeMap.d.ts +2 -0
  6. package/dist/src/common/FilterTypeMap.js +1 -0
  7. package/dist/src/organisations/SearchIndexabilityManager.js +1 -2
  8. package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.js +1 -1
  9. package/dist/src/organisations/policies/index.d.ts +0 -1
  10. package/dist/src/organisations/policies/index.js +0 -1
  11. package/dist/src/organisations/policies/our-picks/AreaAttendance.js +16 -14
  12. package/dist/src/organisations/policies/our-picks/CountryAttendance.js +15 -13
  13. package/dist/src/organisations/policies/ranked/RankedArea.js +1 -1
  14. package/dist/src/organisations/policies/ranked/RankedAreaDiscipline.d.ts +1 -0
  15. package/dist/src/organisations/policies/ranked/RankedAreaDiscipline.js +1 -0
  16. package/dist/src/organisations/policies/ranked/RankedAttendance.js +3 -1
  17. package/dist/src/organisations/policies/ranked/RankedAttendanceDiscipline.js +2 -1
  18. package/dist/src/organisations/policies/ranked/RankedContinent.js +3 -1
  19. package/dist/src/organisations/policies/ranked/RankedContinentAttendance.js +15 -13
  20. package/dist/src/organisations/policies/ranked/RankedCountry.js +3 -1
  21. package/dist/src/organisations/policies/ranked/RankedCountryAttendance.js +1 -0
  22. package/dist/src/organisations/policies/ranked/RankedCountryDiscipline.js +30 -14
  23. package/dist/src/organisations/policies/ranked/RankedDiscipline.js +14 -8
  24. package/dist/src/organisations/policies/ranked/RankedUnfiltered.js +10 -4
  25. package/dist/src/organisations/rules/MinimumAmountOfRankedResultsRule.d.ts +3 -4
  26. package/dist/src/organisations/rules/MinimumAmountOfRankedResultsRule.js +12 -8
  27. package/dist/src/organisations/types/IOrganisationsSitemapDependencies.d.ts +0 -2
  28. package/dist/src/programmes/policies/CountryAttendanceDegree.js +1 -1
  29. package/dist/src/programmes/policies/CountryDurationDegree.js +1 -1
  30. package/dist/src/programmes/policies/CountryEducationalForm.js +1 -1
  31. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.d.ts +1 -1
  32. package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.js +6 -6
  33. package/dist/src/programmes/policies/DegreeContinentTuitionFee.d.ts +1 -1
  34. package/dist/src/programmes/policies/DegreeContinentTuitionFee.js +6 -6
  35. package/dist/src/programmes/policies/DegreeFormatTuitionFee.js +5 -5
  36. package/dist/src/programmes/policies/DisciplineCountryEducationalForm.js +1 -1
  37. package/dist/src/programmes/policies/DisciplineEducationalForm.js +1 -1
  38. package/dist/src/sitemap-generator/ISearchApiClient.d.ts +1 -0
  39. package/dist/src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.d.ts +1 -2
  40. package/dist/src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.js +2 -4
  41. package/package.json +106 -105
package/README.md CHANGED
@@ -1,176 +1,176 @@
1
- # fawkes
2
-
3
- This project is used to centralize indexability logic for our Search
4
- microservices and Sitemap Generator. The main purpose is to completely remove
5
- discrepancies between pages indexed by Search and page URLs stored in Sitemap.
6
-
7
- Link to documentation: https://studyportals.atlassian.net/wiki/x/BwAdvw
8
-
9
- ## Base structure
10
-
11
- - organisations-seo (used by Organisation Search)
12
- - scholarships-seo (used by Scholarship Search)
13
- - sitemap-generator-seo (used by Sitemap Generator)
14
- - src
15
- - common
16
- - organisations
17
- - scholarships
18
- - sitemap-generator
19
-
20
- # Automatic Documentation System
21
-
22
- ## Overview
23
-
24
- This system automatically generates and maintains documentation for Fawkes
25
- indexing rules across multiple projects. It creates a hierarchical structure of
26
- Confluence pages that document all indexing policies and rules, ensuring that
27
- the documentation is always up-to-date with the actual codebase.
28
-
29
- Link to documentation:
30
- [Fawkes Indexing Rules Documentation](https://studyportals.atlassian.net/wiki/spaces/T/pages/3494969354/Fawkes+Indexing+Rules+Documentation)
31
-
32
- ## Features
33
-
34
- - **Dynamic Documentation**: Automatically extracts indexing rules and policies
35
- directly from the codebase
36
- - **Multi-Page Structure**: Creates a main index page with separate pages for
37
- each project
38
- - **Hierarchical Organization**: Structures content as Projects → Policies →
39
- Rules
40
- - **Automatic Page Creation**: Intelligently creates or updates pages as needed
41
- - **Cross-Page Navigation**: Provides intuitive navigation between all pages
42
-
43
- ## Architecture
44
-
45
- The system follows SOLID design principles to ensure maintainability and
46
- extensibility:
47
-
48
- - **Single Responsibility**: Each class has one specific responsibility
49
- - **Open/Closed**: Easily extendable without modifying existing code
50
- - **Liskov Substitution**: Interchangeable components through well-defined
51
- interfaces
52
- - **Interface Segregation**: Clean, focused interfaces
53
- - **Dependency Inversion**: High-level modules depend on abstractions
54
-
55
- ### Key Components
56
-
57
- 1. **Content Builder**: Extracts project, policy, and rule data from the Fawkes
58
- system
59
- 2. **Policy Fetchers**: Project-specific components that fetch and format policy
60
- data
61
- 3. **Document Builder**: Generates structured HTML content for Confluence pages
62
- 4. **Confluence Updater**: Handles creation and updating of Confluence pages
63
- 5. **Token Retriever**: Securely retrieves API token for Confluence access
64
-
65
- ## How It Works
66
-
67
- 1. The system starts by collecting all project data using the `ContentBuilder`
68
- 2. For each project, it extracts policies and rules using project-specific
69
- fetchers
70
- 3. The `DocumentBuilder` generates the content for the main index page and each
71
- project page
72
- 4. The `ConfluenceUpdater` creates or updates pages in Confluence as needed
73
- 5. Each project page links back to the main index, and the main index links to
74
- all project pages
75
-
76
- ## Setup and Configuration
77
-
78
- ### Environment Variables
79
-
80
- The system requires the following environment variables:
81
-
82
- ```
83
- CONFLUENCE_EMAIL=your-email@example.com
84
- CONFLUENCE_API_TOKEN=your-api-token
85
- CONFLUENCE_BASE_URL=https://your-instance.atlassian.net
86
- CONFLUENCE_SPACE_KEY=YOUR_SPACE_KEY
87
- CONFLUENCE_MAIN_PAGE_TITLE=Fawkes Indexing Rules Documentation
88
- ```
89
-
90
- > **Important Note on Credentials**: Currently, the system uses personal
91
- > credentials (email and API token) for Confluence access. This is a temporary
92
- > solution and should be replaced with a team or service account in the future
93
- > to avoid dependency on a specific individual's account.
94
-
95
- ### Deployment and Triggering
96
-
97
- The system runs as an AWS Lambda function and is automatically triggered as part
98
- of the CI/CD pipeline. This ensures documentation is always updated whenever new
99
- code is deployed:
100
-
101
- ```yaml
102
- # buildspec.yml (excerpt)
103
- post_build:
104
- commands:
105
- - |
106
- if [ -z "$PR_ID" ]; then
107
- LAMBDA_NAME="FawkesConfluenceUpdater-$STAGE"
108
- echo "Invoking Lambda function $LAMBDA_NAME"
109
- echo '{"source":"cicd-pipeline","timestamp":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}' > payload.json
110
- aws lambda invoke --function-name $LAMBDA_NAME --invocation-type Event --payload fileb://payload.json response.json || echo "Lambda invocation failed, but continuing"
111
- fi
112
- ```
113
-
114
- **Trigger Flow:**
115
-
116
- 1. When code is pushed to the `main` branch, the CI/CD pipeline is triggered
117
- 2. After successful deployment of a new Fawkes version, the post-build phase
118
- executes
119
- 3. The Lambda function is invoked with a simple payload containing the source
120
- and timestamp
121
- 4. The Lambda function authenticates with Confluence and executes the
122
- documentation generation process
123
- 5. This only happens for production deployments (not PR builds)
124
-
125
- This automated approach ensures documentation stays in sync with the actual
126
- codebase without manual intervention.
127
-
128
- ## Scalability and Extension
129
-
130
- ### Adding New Projects
131
-
132
- To add documentation for a new project:
133
-
134
- 1. Create a new class that implements the `IPolicyFetcher` interface
135
- 2. Implement the `getProjectName()` and `fetchPolicies()` methods
136
- 3. Register the new fetcher in the `ContentBuilder` constructor
137
-
138
- Example:
139
-
140
- ```typescript
141
- export class NewProjectPolicyFetcher implements IPolicyFetcher {
142
- getProjectName(): string {
143
- return 'New Project Name';
144
- }
145
-
146
- fetchPolicies(): IPolicy[] {
147
- // Implement policy fetching logic
148
- return [...policies];
149
- }
150
- }
151
-
152
- // Then update ContentBuilder:
153
- constructor(fetchers?: IPolicyFetcher[]) {
154
- this.policyFetchers = fetchers || [
155
- // Existing fetchers
156
- new NewProjectPolicyFetcher()
157
- ];
158
- }
159
- ```
160
-
161
- ### Customizing Page Content
162
-
163
- The `DocumentBuilder` class contains methods for generating page content. To
164
- customize the format:
165
-
166
- 1. Modify the `buildMainDocument()` method for changes to the main index page
167
- 2. Modify the `buildProjectDocument()` method for changes to project pages
168
- 3. Modify the `buildPolicySection()` and `buildRulesTable()` methods for changes
169
- to policy and rule sections
170
-
171
- ## Conclusion
172
-
173
- This documentation system ensures that Fawkes indexing rules are always
174
- well-documented and accessible to the team. By automatically generating
175
- documentation directly from the codebase, it eliminates the risk of
176
- documentation becoming outdated or inconsistent with the actual implementation.
1
+ # fawkes
2
+
3
+ This project is used to centralize indexability logic for our Search
4
+ microservices and Sitemap Generator. The main purpose is to completely remove
5
+ discrepancies between pages indexed by Search and page URLs stored in Sitemap.
6
+
7
+ Link to documentation: https://studyportals.atlassian.net/wiki/x/BwAdvw
8
+
9
+ ## Base structure
10
+
11
+ - organisations-seo (used by Organisation Search)
12
+ - scholarships-seo (used by Scholarship Search)
13
+ - sitemap-generator-seo (used by Sitemap Generator)
14
+ - src
15
+ - common
16
+ - organisations
17
+ - scholarships
18
+ - sitemap-generator
19
+
20
+ # Automatic Documentation System
21
+
22
+ ## Overview
23
+
24
+ This system automatically generates and maintains documentation for Fawkes
25
+ indexing rules across multiple projects. It creates a hierarchical structure of
26
+ Confluence pages that document all indexing policies and rules, ensuring that
27
+ the documentation is always up-to-date with the actual codebase.
28
+
29
+ Link to documentation:
30
+ [Fawkes Indexing Rules Documentation](https://studyportals.atlassian.net/wiki/spaces/T/pages/3494969354/Fawkes+Indexing+Rules+Documentation)
31
+
32
+ ## Features
33
+
34
+ - **Dynamic Documentation**: Automatically extracts indexing rules and policies
35
+ directly from the codebase
36
+ - **Multi-Page Structure**: Creates a main index page with separate pages for
37
+ each project
38
+ - **Hierarchical Organization**: Structures content as Projects → Policies →
39
+ Rules
40
+ - **Automatic Page Creation**: Intelligently creates or updates pages as needed
41
+ - **Cross-Page Navigation**: Provides intuitive navigation between all pages
42
+
43
+ ## Architecture
44
+
45
+ The system follows SOLID design principles to ensure maintainability and
46
+ extensibility:
47
+
48
+ - **Single Responsibility**: Each class has one specific responsibility
49
+ - **Open/Closed**: Easily extendable without modifying existing code
50
+ - **Liskov Substitution**: Interchangeable components through well-defined
51
+ interfaces
52
+ - **Interface Segregation**: Clean, focused interfaces
53
+ - **Dependency Inversion**: High-level modules depend on abstractions
54
+
55
+ ### Key Components
56
+
57
+ 1. **Content Builder**: Extracts project, policy, and rule data from the Fawkes
58
+ system
59
+ 2. **Policy Fetchers**: Project-specific components that fetch and format policy
60
+ data
61
+ 3. **Document Builder**: Generates structured HTML content for Confluence pages
62
+ 4. **Confluence Updater**: Handles creation and updating of Confluence pages
63
+ 5. **Token Retriever**: Securely retrieves API token for Confluence access
64
+
65
+ ## How It Works
66
+
67
+ 1. The system starts by collecting all project data using the `ContentBuilder`
68
+ 2. For each project, it extracts policies and rules using project-specific
69
+ fetchers
70
+ 3. The `DocumentBuilder` generates the content for the main index page and each
71
+ project page
72
+ 4. The `ConfluenceUpdater` creates or updates pages in Confluence as needed
73
+ 5. Each project page links back to the main index, and the main index links to
74
+ all project pages
75
+
76
+ ## Setup and Configuration
77
+
78
+ ### Environment Variables
79
+
80
+ The system requires the following environment variables:
81
+
82
+ ```
83
+ CONFLUENCE_EMAIL=your-email@example.com
84
+ CONFLUENCE_API_TOKEN=your-api-token
85
+ CONFLUENCE_BASE_URL=https://your-instance.atlassian.net
86
+ CONFLUENCE_SPACE_KEY=YOUR_SPACE_KEY
87
+ CONFLUENCE_MAIN_PAGE_TITLE=Fawkes Indexing Rules Documentation
88
+ ```
89
+
90
+ > **Important Note on Credentials**: Currently, the system uses personal
91
+ > credentials (email and API token) for Confluence access. This is a temporary
92
+ > solution and should be replaced with a team or service account in the future
93
+ > to avoid dependency on a specific individual's account.
94
+
95
+ ### Deployment and Triggering
96
+
97
+ The system runs as an AWS Lambda function and is automatically triggered as part
98
+ of the CI/CD pipeline. This ensures documentation is always updated whenever new
99
+ code is deployed:
100
+
101
+ ```yaml
102
+ # buildspec.yml (excerpt)
103
+ post_build:
104
+ commands:
105
+ - |
106
+ if [ -z "$PR_ID" ]; then
107
+ LAMBDA_NAME="FawkesConfluenceUpdater-$STAGE"
108
+ echo "Invoking Lambda function $LAMBDA_NAME"
109
+ echo '{"source":"cicd-pipeline","timestamp":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}' > payload.json
110
+ aws lambda invoke --function-name $LAMBDA_NAME --invocation-type Event --payload fileb://payload.json response.json || echo "Lambda invocation failed, but continuing"
111
+ fi
112
+ ```
113
+
114
+ **Trigger Flow:**
115
+
116
+ 1. When code is pushed to the `main` branch, the CI/CD pipeline is triggered
117
+ 2. After successful deployment of a new Fawkes version, the post-build phase
118
+ executes
119
+ 3. The Lambda function is invoked with a simple payload containing the source
120
+ and timestamp
121
+ 4. The Lambda function authenticates with Confluence and executes the
122
+ documentation generation process
123
+ 5. This only happens for production deployments (not PR builds)
124
+
125
+ This automated approach ensures documentation stays in sync with the actual
126
+ codebase without manual intervention.
127
+
128
+ ## Scalability and Extension
129
+
130
+ ### Adding New Projects
131
+
132
+ To add documentation for a new project:
133
+
134
+ 1. Create a new class that implements the `IPolicyFetcher` interface
135
+ 2. Implement the `getProjectName()` and `fetchPolicies()` methods
136
+ 3. Register the new fetcher in the `ContentBuilder` constructor
137
+
138
+ Example:
139
+
140
+ ```typescript
141
+ export class NewProjectPolicyFetcher implements IPolicyFetcher {
142
+ getProjectName(): string {
143
+ return 'New Project Name';
144
+ }
145
+
146
+ fetchPolicies(): IPolicy[] {
147
+ // Implement policy fetching logic
148
+ return [...policies];
149
+ }
150
+ }
151
+
152
+ // Then update ContentBuilder:
153
+ constructor(fetchers?: IPolicyFetcher[]) {
154
+ this.policyFetchers = fetchers || [
155
+ // Existing fetchers
156
+ new NewProjectPolicyFetcher()
157
+ ];
158
+ }
159
+ ```
160
+
161
+ ### Customizing Page Content
162
+
163
+ The `DocumentBuilder` class contains methods for generating page content. To
164
+ customize the format:
165
+
166
+ 1. Modify the `buildMainDocument()` method for changes to the main index page
167
+ 2. Modify the `buildProjectDocument()` method for changes to project pages
168
+ 3. Modify the `buildPolicySection()` and `buildRulesTable()` methods for changes
169
+ to policy and rule sections
170
+
171
+ ## Conclusion
172
+
173
+ This documentation system ensures that Fawkes indexing rules are always
174
+ well-documented and accessible to the team. By automatically generating
175
+ documentation directly from the codebase, it eliminates the risk of
176
+ documentation becoming outdated or inconsistent with the actual implementation.
@@ -1,6 +1,5 @@
1
1
  export { IOrganisationsClient } from '../src/sitemap-generator/IOrganisationsClient';
2
2
  export { IOrganisation } from '../src/sitemap-generator/IOrganisation';
3
- export { IRankingApiClient } from '../src/sitemap-generator/IRankingApiClient';
4
3
  export { ISearchApiClient } from '../src/sitemap-generator/ISearchApiClient';
5
4
  export { ISitemapUrlGeneratorManager } from '../src/sitemap-generator/ISitemapUrlGeneratorManager';
6
5
  export { OrganisationsSitemapUrlGeneratorManager } from '../src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager';
@@ -12,3 +11,4 @@ export { ISitemapUrlGenerator } from '../src/common/ISitemapUrlGenerator';
12
11
  export { FilterKeyValuesMap } from '../src/common/FilterKeyValuesMap';
13
12
  export { IPresenter } from '../src/common';
14
13
  export { IProgrammeSitemapUrlGenerator } from '../src/programmes/types/IProgrammeSitemapUrlGenerator';
14
+ export { IRankingApiClient } from '../src/sitemap-generator/IRankingApiClient';
@@ -0,0 +1,2 @@
1
+ import { FilterKey } from '@studyportals/search-filters/server-side';
2
+ export declare const FILTER_KEY_TO_FILTER_TYPE_MAP: Map<FilterKey, FilterType>;
@@ -0,0 +1,14 @@
1
+ import { FilterKey } from '@studyportals/search-filters/server-side';
2
+ import { FilterType } from '@studyportals/omnisearch-interfaces';
3
+ export const FILTER_KEY_TO_FILTER_TYPE_MAP = new Map([
4
+ [FilterKey.COUNTRY, FilterType.COUNTRY],
5
+ [FilterKey.DISCIPLINES, FilterType.DISCIPLINES],
6
+ [FilterKey.CITY, FilterType.CITY],
7
+ [FilterKey.AREA, FilterType.AREA],
8
+ [FilterKey.ATTENDANCE, FilterType.DENSITIES],
9
+ [FilterKey.DELIVERY_METHOD, FilterType.ATTENDANCE],
10
+ [FilterKey.CAMPAIGN_TYPE, FilterType.CAMPAIGN_TYPE],
11
+ [FilterKey.DEGREE_TYPE, FilterType.DEGREE_TYPE],
12
+ [FilterKey.KEYWORD, FilterType.KEYWORD],
13
+ [FilterKey.CONTINENT, FilterType.CONTINENT],
14
+ ]);
@@ -0,0 +1,2 @@
1
+ import { FilterType } from '@studyportals/omnisearch-interfaces';
2
+ export type FilterTypeMap = Map<FilterType, string[]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { DependencyTypes } from '../enums/DependencyTypes';
2
- import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity } from '../organisations/policies';
2
+ import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity } from '../organisations/policies';
3
3
  export class SearchIndexabilityManager {
4
4
  policies;
5
5
  constructor(portalType, seoInfoBase, filterState, sortingState, applicationState) {
@@ -22,7 +22,6 @@ export class SearchIndexabilityManager {
22
22
  new CountryAttendance(dependencies),
23
23
  new Unfiltered(dependencies),
24
24
  new RankedArea(dependencies),
25
- new RankedAreaDiscipline(dependencies),
26
25
  new RankedAttendance(dependencies),
27
26
  new RankedAttendanceDiscipline(dependencies),
28
27
  new RankedContinent(dependencies),
@@ -9,7 +9,7 @@ export class RankedOrganisationsSeoIndexabilityPolicy extends OrganisationsSeoIn
9
9
  let rankedResultsCountRule;
10
10
  if (super.isSitemapUrlGeneratorDependencies()) {
11
11
  const dependencies = this.dependencies;
12
- rankedResultsCountRule = new MinimumAmountOfRankedResultsRule(dependencies.rankingApiClient);
12
+ rankedResultsCountRule = new MinimumAmountOfRankedResultsRule(dependencies.searchApiClient);
13
13
  }
14
14
  else {
15
15
  rankedResultsCountRule = new MinimumAmountOfRankedResultsRule();
@@ -8,7 +8,6 @@ export * from './our-picks/CountryAreaCity';
8
8
  export * from './our-picks/CountryAttendance';
9
9
  export * from './our-picks/Unfiltered';
10
10
  export * from './ranked/RankedArea';
11
- export * from './ranked/RankedAreaDiscipline';
12
11
  export * from './ranked/RankedAttendance';
13
12
  export * from './ranked/RankedAttendanceDiscipline';
14
13
  export * from './ranked/RankedContinent';
@@ -8,7 +8,6 @@ export * from './our-picks/CountryAreaCity';
8
8
  export * from './our-picks/CountryAttendance';
9
9
  export * from './our-picks/Unfiltered';
10
10
  export * from './ranked/RankedArea';
11
- export * from './ranked/RankedAreaDiscipline';
12
11
  export * from './ranked/RankedAttendance';
13
12
  export * from './ranked/RankedAttendanceDiscipline';
14
13
  export * from './ranked/RankedContinent';
@@ -23,21 +23,23 @@ export class AreaAttendance extends OrganisationsSeoIndexabilityPolicy {
23
23
  async generateUrls() {
24
24
  const areaFragments = AreaPresenter.getInstance().getFragments();
25
25
  const attendanceFragments = AttendancePresenter.getInstance().getFragments();
26
- const paths = [];
27
- for (const area of areaFragments) {
28
- for (const attendance of attendanceFragments) {
29
- const filterKeyValues = new Map([
30
- [FilterKey.AREA, [area.id]],
31
- [FilterKey.COUNTRY, [area.countryId]],
32
- [FilterKey.DELIVERY_METHOD, [attendance.id]]
33
- ]);
34
- const result = await this.checkRulesForSitemap(filterKeyValues);
35
- if (result) {
36
- paths.push(this.getPathWithSortingOption(`${attendance.path}/${area.path}`));
37
- }
26
+ // Create array of promises for all combinations to parallelize API calls
27
+ const promises = areaFragments.flatMap(area => attendanceFragments.map(async (attendance) => {
28
+ const filterKeyValues = new Map([
29
+ [FilterKey.AREA, [area.id]],
30
+ [FilterKey.COUNTRY, [area.countryId]],
31
+ [FilterKey.DELIVERY_METHOD, [attendance.id]]
32
+ ]);
33
+ const result = await this.checkRulesForSitemap(filterKeyValues);
34
+ if (result) {
35
+ return this.getPathWithSortingOption(`${attendance.path}/${area.path}`);
38
36
  }
39
- }
40
- return paths;
37
+ return null;
38
+ }));
39
+ // Wait for all promises to resolve in parallel
40
+ const results = await Promise.all(promises);
41
+ // Filter out null values and return paths
42
+ return results.filter((path) => path !== null);
41
43
  }
42
44
  get filterCombination() {
43
45
  return FilterCombinations.AREA_ATTENDANCE;
@@ -25,19 +25,21 @@ export class CountryAttendance extends OrganisationsSeoIndexabilityPolicy {
25
25
  async generateUrls() {
26
26
  const countryFragments = CountryPresenter.getInstance().getFragments();
27
27
  const attendanceFragments = AttendancePresenter.getInstance().getFragments();
28
- const paths = [];
29
- for (const country of countryFragments) {
30
- for (const attendance of attendanceFragments) {
31
- const filterKeyValues = new Map([
32
- [FilterKey.COUNTRY, [country.id]],
33
- [FilterKey.DELIVERY_METHOD, [attendance.id]]
34
- ]);
35
- const result = await this.checkRulesForSitemap(filterKeyValues);
36
- if (result) {
37
- paths.push(this.getPathWithSortingOption(`${attendance.path}/${country.path}`));
38
- }
28
+ // Create array of promises for all combinations to parallelize API calls
29
+ const promises = countryFragments.flatMap(country => attendanceFragments.map(async (attendance) => {
30
+ const filterKeyValues = new Map([
31
+ [FilterKey.COUNTRY, [country.id]],
32
+ [FilterKey.DELIVERY_METHOD, [attendance.id]]
33
+ ]);
34
+ const result = await this.checkRulesForSitemap(filterKeyValues);
35
+ if (result) {
36
+ return this.getPathWithSortingOption(`${attendance.path}/${country.path}`);
39
37
  }
40
- }
41
- return paths;
38
+ return null;
39
+ }));
40
+ // Wait for all promises to resolve in parallel
41
+ const results = await Promise.all(promises);
42
+ // Filter out null values and return paths
43
+ return results.filter((path) => path !== null);
42
44
  }
43
45
  }
@@ -21,7 +21,7 @@ export class RankedArea extends RankedOrganisationsSeoIndexabilityPolicy {
21
21
  for (const area of areaFragments) {
22
22
  const filterKeyValues = new Map([
23
23
  [FilterKey.AREA, [area.id]],
24
- [FilterKey.COUNTRY, [area.countryId]]
24
+ [FilterKey.COUNTRY, [area.countryId]],
25
25
  ]);
26
26
  const result = await this.checkRulesForSitemap(filterKeyValues);
27
27
  if (result) {
@@ -4,6 +4,7 @@ import { SingleValueSelectedForFilterRule } from '../../../common/rules/SingleVa
4
4
  import { OnlyFiltersSelectedRule } from '../../../common/rules/OnlyFiltersSelectedRule';
5
5
  import { RankedOrganisationsSeoIndexabilityPolicy } from '../RankedOrganisationsSeoIndexabilityPolicy';
6
6
  import { IOrganisationsSeoDependencies } from '../../../organisations/types/IOrganisationsSeoDependencies';
7
+ /** @deprecated Don't use this policy as it's been removed from indexability manager. */
7
8
  export declare class RankedAreaDiscipline extends RankedOrganisationsSeoIndexabilityPolicy {
8
9
  readonly name: string;
9
10
  readonly description: string;
@@ -6,6 +6,7 @@ import { OnlyFiltersSelectedRule } from '../../../common/rules/OnlyFiltersSelect
6
6
  import { AreaPresenter } from '../../../presenters/AreaPresenter';
7
7
  import { DisciplinePresenter } from '../../../presenters/DisciplinePresenter';
8
8
  import { RankedOrganisationsSeoIndexabilityPolicy } from '../RankedOrganisationsSeoIndexabilityPolicy';
9
+ /** @deprecated Don't use this policy as it's been removed from indexability manager. */
9
10
  export class RankedAreaDiscipline extends RankedOrganisationsSeoIndexabilityPolicy {
10
11
  name = 'Ranked Area Discipline Policy';
11
12
  description = 'Controls indexing for ranking-sorted pages filtered by geographic areas, optimizing for region-specific content with quality-based result ordering.';
@@ -20,7 +20,9 @@ export class RankedAttendance extends RankedOrganisationsSeoIndexabilityPolicy {
20
20
  const attendanceFragments = AttendancePresenter.getInstance().getFragments();
21
21
  const paths = [];
22
22
  for (const attendance of attendanceFragments) {
23
- const filterKeyValues = new Map([[FilterKey.DELIVERY_METHOD, [attendance.id]]]);
23
+ const filterKeyValues = new Map([
24
+ [FilterKey.DELIVERY_METHOD, [attendance.id]],
25
+ ]);
24
26
  const result = await this.checkRulesForSitemap(filterKeyValues);
25
27
  if (result) {
26
28
  paths.push(this.getPathWithSortingOption(attendance.path));
@@ -25,11 +25,12 @@ export class RankedAttendanceDiscipline extends RankedOrganisationsSeoIndexabili
25
25
  const attendanceFragments = AttendancePresenter.getInstance().getFragments();
26
26
  const disciplineFragments = DisciplinePresenter.getInstance().getFragments();
27
27
  const paths = [];
28
+ // Process sequentially to respect API rate limits
28
29
  for (const attendance of attendanceFragments) {
29
30
  for (const discipline of disciplineFragments) {
30
31
  const filterKeyValues = new Map([
31
32
  [FilterKey.DELIVERY_METHOD, [attendance.id]],
32
- [FilterKey.DISCIPLINES, [discipline.id]]
33
+ [FilterKey.DISCIPLINES, [discipline.id]],
33
34
  ]);
34
35
  const result = await this.checkRulesForSitemap(filterKeyValues);
35
36
  if (result) {
@@ -18,7 +18,9 @@ export class RankedContinent extends RankedOrganisationsSeoIndexabilityPolicy {
18
18
  const continentFragments = ContinentPresenter.getInstance().getFragments();
19
19
  const paths = [];
20
20
  for (const continent of continentFragments) {
21
- const filterKeyValues = new Map([[FilterKey.CONTINENT, [continent.id]]]);
21
+ const filterKeyValues = new Map([
22
+ [FilterKey.CONTINENT, [continent.id]],
23
+ ]);
22
24
  const result = await this.checkRulesForSitemap(filterKeyValues);
23
25
  if (result) {
24
26
  paths.push(this.getPathWithSortingOption(continent.path));
@@ -23,20 +23,22 @@ export class RankedContinentAttendance extends RankedOrganisationsSeoIndexabilit
23
23
  async generateUrls() {
24
24
  const continentFragments = ContinentPresenter.getInstance().getFragments();
25
25
  const attendanceFragments = AttendancePresenter.getInstance().getFragments();
26
- const paths = [];
27
- for (const continent of continentFragments) {
28
- for (const attendance of attendanceFragments) {
29
- const filterKeyValues = new Map([
30
- [FilterKey.CONTINENT, [continent.id]],
31
- [FilterKey.DELIVERY_METHOD, [attendance.id]]
32
- ]);
33
- const result = await this.checkRulesForSitemap(filterKeyValues);
34
- if (result) {
35
- paths.push(this.getPathWithSortingOption(`${attendance.path}/${continent.path}`));
36
- }
26
+ // Create array of promises for all combinations to parallelize API calls
27
+ const promises = continentFragments.flatMap(continent => attendanceFragments.map(async (attendance) => {
28
+ const filterKeyValues = new Map([
29
+ [FilterKey.CONTINENT, [continent.id]],
30
+ [FilterKey.DELIVERY_METHOD, [attendance.id]],
31
+ ]);
32
+ const result = await this.checkRulesForSitemap(filterKeyValues);
33
+ if (result) {
34
+ return this.getPathWithSortingOption(`${attendance.path}/${continent.path}`);
37
35
  }
38
- }
39
- return paths;
36
+ return null;
37
+ }));
38
+ // Wait for all promises to resolve in parallel
39
+ const results = await Promise.all(promises);
40
+ // Filter out null values and return paths
41
+ return results.filter((path) => path !== null);
40
42
  }
41
43
  get filterCombination() {
42
44
  return FilterCombinations.RANKED_CONTINENT_ATTENDANCE;
@@ -15,7 +15,9 @@ export class RankedCountry extends RankedOrganisationsSeoIndexabilityPolicy {
15
15
  const countryFragments = CountryPresenter.getInstance().getFragments();
16
16
  const paths = [];
17
17
  for (const country of countryFragments) {
18
- const filterKeyValues = new Map([[FilterKey.COUNTRY, [country.id]]]);
18
+ const filterKeyValues = new Map([
19
+ [FilterKey.COUNTRY, [country.id]],
20
+ ]);
19
21
  const result = await this.checkRulesForSitemap(filterKeyValues);
20
22
  if (result) {
21
23
  paths.push(this.getPathWithSortingOption(country.path));
@@ -22,6 +22,7 @@ export class RankedCountryAttendance extends RankedOrganisationsSeoIndexabilityP
22
22
  const countryFragments = CountryPresenter.getInstance().getFragments();
23
23
  const attendanceFragments = AttendancePresenter.getInstance().getFragments();
24
24
  const paths = [];
25
+ // Process sequentially to respect API rate limits
25
26
  for (const country of countryFragments) {
26
27
  for (const attendance of attendanceFragments) {
27
28
  const filterKeyValues = new Map([