@studyportals/fawkes 3.0.1-4 → 4.0.1-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 (148) hide show
  1. package/README.md +18 -17
  2. package/dist/organisations-seo/index.d.ts +3 -3
  3. package/dist/organisations-seo/index.js +1 -4
  4. package/dist/scholarships-seo/index.d.ts +5 -5
  5. package/dist/scholarships-seo/index.js +2 -2
  6. package/dist/sitemap-generator-seo/index.d.ts +6 -6
  7. package/dist/sitemap-generator-seo/index.js +2 -2
  8. package/dist/src/common/FilterKeyValuesMap.d.ts +1 -1
  9. package/dist/src/common/IDependencies.d.ts +1 -1
  10. package/dist/src/common/IRule.d.ts +2 -2
  11. package/dist/src/common/ISearchDependencies.d.ts +2 -2
  12. package/dist/src/common/ISeoDependencies.d.ts +2 -2
  13. package/dist/src/common/ISeoFilterState.d.ts +1 -1
  14. package/dist/src/common/ISitemapDependencies.d.ts +3 -3
  15. package/dist/src/common/ISitemapUrlGenerator.d.ts +1 -1
  16. package/dist/src/common/index.d.ts +4 -4
  17. package/dist/src/common/index.js +4 -4
  18. package/dist/src/common/policies/BaseSeoIndexabilityPolicy.d.ts +15 -9
  19. package/dist/src/common/policies/BaseSeoIndexabilityPolicy.js +23 -2
  20. package/dist/src/common/rules/BaseFilterKeyValueRule.d.ts +3 -3
  21. package/dist/src/common/rules/BaseFilterKeyValueRule.js +6 -5
  22. package/dist/src/common/rules/NoFiltersSelectedRule.d.ts +8 -0
  23. package/dist/src/{organisations → common}/rules/NoFiltersSelectedRule.js +3 -3
  24. package/dist/src/common/rules/OnlyFiltersSelectedRule.d.ts +4 -4
  25. package/dist/src/common/rules/OnlyFiltersSelectedRule.js +1 -1
  26. package/dist/src/common/rules/SingleValueSelectedForFilterRule.d.ts +4 -4
  27. package/dist/src/common/rules/SingleValueSelectedForFilterRule.js +1 -1
  28. package/dist/src/enums/FilterCombinations.js +0 -1
  29. package/dist/src/errors/InvalidFilterValueError.d.ts +1 -1
  30. package/dist/src/organisations/IOrganisationSearchApplicationState.d.ts +1 -1
  31. package/dist/src/organisations/ISeoSortingState.d.ts +1 -1
  32. package/dist/src/organisations/SearchIndexabilityManager.d.ts +6 -6
  33. package/dist/src/organisations/SearchIndexabilityManager.js +4 -4
  34. package/dist/src/organisations/index.d.ts +4 -4
  35. package/dist/src/organisations/index.js +4 -4
  36. package/dist/src/organisations/policies/OrganisationsSeoIndexabilityPolicy.d.ts +13 -0
  37. package/dist/src/organisations/policies/OrganisationsSeoIndexabilityPolicy.js +32 -0
  38. package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.d.ts +8 -0
  39. package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.js +19 -0
  40. package/dist/src/organisations/policies/index.d.ts +18 -18
  41. package/dist/src/organisations/policies/index.js +18 -18
  42. package/dist/src/organisations/policies/our-picks/Area.d.ts +6 -6
  43. package/dist/src/organisations/policies/our-picks/Area.js +21 -8
  44. package/dist/src/organisations/policies/our-picks/AreaAttendance.d.ts +8 -8
  45. package/dist/src/organisations/policies/our-picks/AreaAttendance.js +28 -10
  46. package/dist/src/organisations/policies/our-picks/Attendance.d.ts +7 -7
  47. package/dist/src/organisations/policies/our-picks/Attendance.js +19 -9
  48. package/dist/src/organisations/policies/our-picks/Continent.d.ts +7 -7
  49. package/dist/src/organisations/policies/our-picks/Continent.js +20 -10
  50. package/dist/src/organisations/policies/our-picks/Country.d.ts +7 -7
  51. package/dist/src/organisations/policies/our-picks/Country.js +21 -14
  52. package/dist/src/organisations/policies/our-picks/CountryAttendance.d.ts +9 -9
  53. package/dist/src/organisations/policies/our-picks/CountryAttendance.js +30 -13
  54. package/dist/src/organisations/policies/our-picks/Unfiltered.d.ts +5 -5
  55. package/dist/src/organisations/policies/our-picks/Unfiltered.js +8 -10
  56. package/dist/src/organisations/policies/ranked/RankedArea.d.ts +8 -9
  57. package/dist/src/organisations/policies/ranked/RankedArea.js +25 -12
  58. package/dist/src/organisations/policies/ranked/RankedAreaDiscipline.d.ts +9 -10
  59. package/dist/src/organisations/policies/ranked/RankedAreaDiscipline.js +32 -14
  60. package/dist/src/organisations/policies/ranked/RankedAttendance.d.ts +9 -10
  61. package/dist/src/organisations/policies/ranked/RankedAttendance.js +24 -14
  62. package/dist/src/organisations/policies/ranked/RankedAttendanceDiscipline.d.ts +10 -11
  63. package/dist/src/organisations/policies/ranked/RankedAttendanceDiscipline.js +30 -13
  64. package/dist/src/organisations/policies/ranked/RankedContinent.d.ts +8 -9
  65. package/dist/src/organisations/policies/ranked/RankedContinent.js +23 -13
  66. package/dist/src/organisations/policies/ranked/RankedContinentAttendance.d.ts +10 -11
  67. package/dist/src/organisations/policies/ranked/RankedContinentAttendance.js +30 -13
  68. package/dist/src/organisations/policies/ranked/RankedCountry.d.ts +8 -9
  69. package/dist/src/organisations/policies/ranked/RankedCountry.js +22 -15
  70. package/dist/src/organisations/policies/ranked/RankedCountryAttendance.d.ts +9 -10
  71. package/dist/src/organisations/policies/ranked/RankedCountryAttendance.js +29 -12
  72. package/dist/src/organisations/policies/ranked/RankedCountryDiscipline.d.ts +8 -9
  73. package/dist/src/organisations/policies/ranked/RankedCountryDiscipline.js +29 -12
  74. package/dist/src/organisations/policies/ranked/RankedDiscipline.d.ts +8 -9
  75. package/dist/src/organisations/policies/ranked/RankedDiscipline.js +22 -12
  76. package/dist/src/organisations/policies/ranked/RankedUnfiltered.d.ts +7 -8
  77. package/dist/src/organisations/policies/ranked/RankedUnfiltered.js +13 -11
  78. package/dist/src/organisations/rules/AtLeastTwoRankedResultsRule.d.ts +7 -3
  79. package/dist/src/organisations/rules/AtLeastTwoRankedResultsRule.js +14 -5
  80. package/dist/src/{scholarships/rules/SearchVolumeCountryDisciplineRule.d.ts → organisations/rules/BaseSearchVolumeOrganisationsRule.d.ts} +7 -7
  81. package/dist/src/organisations/rules/BaseSearchVolumeOrganisationsRule.js +30 -0
  82. package/dist/src/organisations/rules/ContinentIsEuropeRule.d.ts +3 -7
  83. package/dist/src/organisations/rules/ContinentIsEuropeRule.js +8 -12
  84. package/dist/src/organisations/rules/OnlineAttendanceRule.d.ts +1 -1
  85. package/dist/src/organisations/rules/OnlineAttendanceRule.js +3 -5
  86. package/dist/src/organisations/rules/SearchVolumeAreasAttendanceRule.d.ts +3 -9
  87. package/dist/src/organisations/rules/SearchVolumeAreasAttendanceRule.js +10 -22
  88. package/dist/src/organisations/rules/SearchVolumeAreasDisciplineRule.d.ts +3 -9
  89. package/dist/src/organisations/rules/SearchVolumeAreasDisciplineRule.js +11 -23
  90. package/dist/src/organisations/rules/SearchVolumeCountriesAttendanceRule.d.ts +3 -9
  91. package/dist/src/organisations/rules/SearchVolumeCountriesAttendanceRule.js +10 -24
  92. package/dist/src/organisations/types/IOrganisationSearchDependencies.d.ts +4 -4
  93. package/dist/src/organisations/types/IOrganisationsSeoDependencies.d.ts +2 -2
  94. package/dist/src/organisations/types/IOrganisationsSitemapDependencies.d.ts +4 -2
  95. package/dist/src/organisations/types.js +4 -4
  96. package/dist/src/presenters/AreaPresenter.d.ts +1 -1
  97. package/dist/src/presenters/AreaPresenter.js +1 -1
  98. package/dist/src/presenters/AttendancePresenter.d.ts +8 -0
  99. package/dist/src/presenters/AttendancePresenter.js +21 -0
  100. package/dist/src/presenters/ContinentPresenter.d.ts +9 -0
  101. package/dist/src/presenters/ContinentPresenter.js +31 -0
  102. package/dist/src/presenters/CountryPresenter.d.ts +1 -1
  103. package/dist/src/presenters/CountryPresenter.js +1 -1
  104. package/dist/src/presenters/DisciplinePresenter.d.ts +1 -1
  105. package/dist/src/presenters/DisciplinePresenter.js +1 -1
  106. package/dist/src/presenters/fragments/IAreaFragment.d.ts +1 -1
  107. package/dist/src/presenters/fragments/ICountryFragment.d.ts +1 -1
  108. package/dist/src/scholarships/SearchIndexabilityManager.d.ts +4 -4
  109. package/dist/src/scholarships/SearchIndexabilityManager.js +9 -9
  110. package/dist/src/scholarships/index.d.ts +2 -2
  111. package/dist/src/scholarships/index.js +2 -2
  112. package/dist/src/scholarships/policies/Area.d.ts +3 -3
  113. package/dist/src/scholarships/policies/Area.js +2 -2
  114. package/dist/src/scholarships/policies/Country.d.ts +4 -4
  115. package/dist/src/scholarships/policies/Country.js +3 -5
  116. package/dist/src/scholarships/policies/Discipline.d.ts +3 -3
  117. package/dist/src/scholarships/policies/Discipline.js +3 -5
  118. package/dist/src/scholarships/policies/DisciplineCountry.d.ts +3 -3
  119. package/dist/src/scholarships/policies/DisciplineCountry.js +2 -2
  120. package/dist/src/scholarships/policies/Unfiltered.d.ts +4 -3
  121. package/dist/src/scholarships/policies/Unfiltered.js +5 -7
  122. package/dist/src/scholarships/policies/UniversityCountry.d.ts +3 -3
  123. package/dist/src/scholarships/policies/UniversityCountry.js +3 -3
  124. package/dist/src/scholarships/rules/ExceptAustaliaAreasRule.d.ts +3 -3
  125. package/dist/src/scholarships/rules/ExceptAustaliaAreasRule.js +2 -2
  126. package/dist/src/scholarships/rules/SearchVolumeAreasRule.d.ts +3 -3
  127. package/dist/src/scholarships/rules/SearchVolumeAreasRule.js +1 -1
  128. package/dist/src/scholarships/rules/SearchVolumeCountriesDisciplinesRule.js +1 -1
  129. package/dist/src/scholarships/rules/SearchVolumeCountriesRule.d.ts +3 -3
  130. package/dist/src/scholarships/rules/SearchVolumeCountriesRule.js +1 -1
  131. package/dist/src/scholarships/rules/SearchVolumeDisciplinesRule.d.ts +3 -3
  132. package/dist/src/scholarships/rules/SearchVolumeDisciplinesRule.js +2 -4
  133. package/dist/src/scholarships/types.js +4 -4
  134. package/dist/src/sitemap-generator/IOrganisationsClient.d.ts +1 -1
  135. package/dist/src/sitemap-generator/IRankingApiClient.d.ts +4 -0
  136. package/dist/src/sitemap-generator/IRankingApiClient.js +1 -0
  137. package/dist/src/sitemap-generator/ISitemapUrlGeneratorManager.d.ts +1 -1
  138. package/dist/src/sitemap-generator/SitemapUrlGeneratorManager.d.ts +4 -4
  139. package/dist/src/sitemap-generator/SitemapUrlGeneratorManager.js +7 -7
  140. package/package.json +82 -80
  141. package/dist/src/common/policies/RuleBasedIndexabilityPolicy.d.ts +0 -11
  142. package/dist/src/common/policies/RuleBasedIndexabilityPolicy.js +0 -24
  143. package/dist/src/organisations/OrganisationsBaseSeoIndexabilityPolicy.d.ts +0 -11
  144. package/dist/src/organisations/OrganisationsBaseSeoIndexabilityPolicy.js +0 -20
  145. package/dist/src/organisations/OrganisationsRuleBasedIndexabilityPolicy.d.ts +0 -11
  146. package/dist/src/organisations/OrganisationsRuleBasedIndexabilityPolicy.js +0 -20
  147. package/dist/src/organisations/rules/NoFiltersSelectedRule.d.ts +0 -8
  148. package/dist/src/scholarships/rules/SearchVolumeCountryDisciplineRule.js +0 -40
package/README.md CHANGED
@@ -1,17 +1,18 @@
1
- # fawkes
2
-
3
- This project is used to centralize indexability logic for our Search microservices and Sitemap Generator. The main purpose is to completely remove discrepancies between pages indexed by Search and page URLs stored in Sitemap.
4
-
5
- Link to documentation: https://studyportals.atlassian.net/wiki/x/BwAdvw
6
-
7
- ## Base structure
8
-
9
- - organisations-seo (used by Organisation Search)
10
- - scholarships-seo (used by Scholarship Search)
11
- - sitemap-generator-seo (used by Sitemap Generator)
12
- - src
13
- - common
14
- - organisations
15
- - scholarships
16
- - sitemap-generator
17
-
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
@@ -1,4 +1,4 @@
1
- import { ISeoInfoBase } from "../src/common/ISeoInfoBase";
2
- import { ISeoFilterState } from "../src/common/ISeoFilterState";
3
- import { IOrganisationSearchApplicationState, SearchIndexabilityManager, ISeoSortingState, types } from "../src/organisations";
1
+ import { ISeoInfoBase } from '../src/common/ISeoInfoBase';
2
+ import { ISeoFilterState } from '../src/common/ISeoFilterState';
3
+ import { IOrganisationSearchApplicationState, SearchIndexabilityManager, ISeoSortingState, types } from '../src/organisations';
4
4
  export { ISeoInfoBase, ISeoFilterState, IOrganisationSearchApplicationState, SearchIndexabilityManager, ISeoSortingState, types };
@@ -1,5 +1,2 @@
1
- // export * from "../src/common/ISeoInfoBase";
2
- // export * from "../src/common/ISeoFilterState";
3
- // export * from "../src/organisations";
4
- import { SearchIndexabilityManager, types } from "../src/organisations";
1
+ import { SearchIndexabilityManager, types } from '../src/organisations';
5
2
  export { SearchIndexabilityManager, types };
@@ -1,6 +1,6 @@
1
- import { ISeoFilterState } from "../src/common/ISeoFilterState";
2
- import { ISeoInfoBase } from "../src/common/ISeoInfoBase";
3
- import { ISearchIndexabilityManager } from "../src/common/ISearchIndexabilityManager";
4
- import { SearchIndexabilityManager } from "../src/scholarships/SearchIndexabilityManager";
5
- import { types } from "../src/scholarships/types";
1
+ import { ISeoFilterState } from '../src/common/ISeoFilterState';
2
+ import { ISeoInfoBase } from '../src/common/ISeoInfoBase';
3
+ import { ISearchIndexabilityManager } from '../src/common/ISearchIndexabilityManager';
4
+ import { SearchIndexabilityManager } from '../src/scholarships/SearchIndexabilityManager';
5
+ import { types } from '../src/scholarships/types';
6
6
  export { ISeoFilterState, ISeoInfoBase, ISearchIndexabilityManager, SearchIndexabilityManager, types };
@@ -1,3 +1,3 @@
1
- import { SearchIndexabilityManager } from "../src/scholarships/SearchIndexabilityManager";
2
- import { types } from "../src/scholarships/types";
1
+ import { SearchIndexabilityManager } from '../src/scholarships/SearchIndexabilityManager';
2
+ import { types } from '../src/scholarships/types';
3
3
  export { SearchIndexabilityManager, types };
@@ -1,7 +1,7 @@
1
- import { IOrganisationsClient } from "../src/sitemap-generator/IOrganisationsClient";
2
- import { IOrganisation } from "../src/sitemap-generator/IOrganisation";
3
- import { ISearchApiClient } from "../src/sitemap-generator/ISearchApiClient";
4
- import { ISitemapUrlGeneratorManager } from "../src/sitemap-generator/ISitemapUrlGeneratorManager";
5
- import { SitemapUrlGeneratorManager } from "../src/sitemap-generator/SitemapUrlGeneratorManager";
6
- import { FilterCombinations } from "../src/enums/FilterCombinations";
1
+ import { IOrganisationsClient } from '../src/sitemap-generator/IOrganisationsClient';
2
+ import { IOrganisation } from '../src/sitemap-generator/IOrganisation';
3
+ import { ISearchApiClient } from '../src/sitemap-generator/ISearchApiClient';
4
+ import { ISitemapUrlGeneratorManager } from '../src/sitemap-generator/ISitemapUrlGeneratorManager';
5
+ import { SitemapUrlGeneratorManager } from '../src/sitemap-generator/SitemapUrlGeneratorManager';
6
+ import { FilterCombinations } from '../src/enums/FilterCombinations';
7
7
  export { IOrganisationsClient, IOrganisation, ISearchApiClient, ISitemapUrlGeneratorManager, SitemapUrlGeneratorManager, FilterCombinations };
@@ -1,3 +1,3 @@
1
- import { SitemapUrlGeneratorManager } from "../src/sitemap-generator/SitemapUrlGeneratorManager";
2
- import { FilterCombinations } from "../src/enums/FilterCombinations";
1
+ import { SitemapUrlGeneratorManager } from '../src/sitemap-generator/SitemapUrlGeneratorManager';
2
+ import { FilterCombinations } from '../src/enums/FilterCombinations';
3
3
  export { SitemapUrlGeneratorManager, FilterCombinations };
@@ -1,2 +1,2 @@
1
- import { FilterKey } from "@studyportals/search-filters";
1
+ import { FilterKey } from '@studyportals/search-filters';
2
2
  export type FilterKeyValuesMap = Map<FilterKey, string[]>;
@@ -1,4 +1,4 @@
1
- import { DependencyTypes } from "../enums/DependencyTypes";
1
+ import { DependencyTypes } from '../enums/DependencyTypes';
2
2
  export interface IDependencies {
3
3
  dependencyType: DependencyTypes;
4
4
  }
@@ -1,5 +1,5 @@
1
- import { FilterKeyValuesMap } from "./FilterKeyValuesMap";
2
- import { ISearchDependencies } from "./ISearchDependencies";
1
+ import { FilterKeyValuesMap } from './FilterKeyValuesMap';
2
+ import { ISearchDependencies } from './ISearchDependencies';
3
3
  export interface IRule {
4
4
  getName(): string;
5
5
  forSearch(dependencies: ISearchDependencies): Promise<boolean>;
@@ -1,5 +1,5 @@
1
- import { ISeoInfoBase, ISeoFilterState, ISearchApplicationState } from "../common";
2
- import { IDependencies } from "./IDependencies";
1
+ import { ISeoInfoBase, ISeoFilterState, ISearchApplicationState } from '../common';
2
+ import { IDependencies } from './IDependencies';
3
3
  export interface ISearchDependencies extends IDependencies {
4
4
  seoInfoBase: ISeoInfoBase;
5
5
  filterState: ISeoFilterState;
@@ -1,3 +1,3 @@
1
- import { ISearchDependencies } from "../common/ISearchDependencies";
2
- import { ISitemapDependencies } from "../common/ISitemapDependencies";
1
+ import { ISearchDependencies } from '../common/ISearchDependencies';
2
+ import { ISitemapDependencies } from '../common/ISitemapDependencies';
3
3
  export type ISeoDependencies = ISearchDependencies | ISitemapDependencies;
@@ -1,4 +1,4 @@
1
- import { FilterKey } from "@studyportals/search-filters";
1
+ import { FilterKey } from '@studyportals/search-filters';
2
2
  export interface ISeoFilterState {
3
3
  getSelectedValuesFor(key: FilterKey): readonly string[];
4
4
  getSelectedFilters(): readonly FilterKey[];
@@ -1,6 +1,6 @@
1
- import { IDependencies } from "../common/IDependencies";
2
- import { ISearchApiClient } from "../sitemap-generator/ISearchApiClient";
3
- import { IOrganisationsClient } from "../sitemap-generator/IOrganisationsClient";
1
+ import { IDependencies } from '../common/IDependencies';
2
+ import { ISearchApiClient } from '../sitemap-generator/ISearchApiClient';
3
+ import { IOrganisationsClient } from '../sitemap-generator/IOrganisationsClient';
4
4
  export interface ISitemapDependencies extends IDependencies {
5
5
  searchApiClient: ISearchApiClient;
6
6
  organisationsClient: IOrganisationsClient;
@@ -1,4 +1,4 @@
1
- import { FilterCombinations } from "../enums/FilterCombinations";
1
+ import { FilterCombinations } from '../enums/FilterCombinations';
2
2
  export interface ISitemapUrlGenerator {
3
3
  filterCombination: FilterCombinations;
4
4
  generateSitemapUrls(): Promise<string[]>;
@@ -1,4 +1,4 @@
1
- export * from "./ISeoInfoBase";
2
- export * from "./ISeoFilterState";
3
- export * from "./ISearchApplicationState";
4
- export * from "./ISearchIndexabilityManager";
1
+ export * from './ISeoInfoBase';
2
+ export * from './ISeoFilterState';
3
+ export * from './ISearchApplicationState';
4
+ export * from './ISearchIndexabilityManager';
@@ -1,4 +1,4 @@
1
- export * from "./ISeoInfoBase";
2
- export * from "./ISeoFilterState";
3
- export * from "./ISearchApplicationState";
4
- export * from "./ISearchIndexabilityManager";
1
+ export * from './ISeoInfoBase';
2
+ export * from './ISeoFilterState';
3
+ export * from './ISearchApplicationState';
4
+ export * from './ISearchIndexabilityManager';
@@ -1,15 +1,21 @@
1
- import { ISitemapUrlGenerator } from "../ISitemapUrlGenerator";
2
- import { ISeoIndexabilityPolicy } from "../ISeoIndexabilityPolicy";
3
- import { IDependencies } from "../IDependencies";
4
- import { FilterCombinations } from "../../enums/FilterCombinations";
1
+ import { ISearchDependencies } from '../ISearchDependencies';
2
+ import { IDependencies } from '../IDependencies';
3
+ import { IRule } from '../IRule';
4
+ import { FilterKeyValuesMap } from '../FilterKeyValuesMap';
5
+ import { ISeoIndexabilityPolicy } from '../ISeoIndexabilityPolicy';
6
+ import { ISitemapUrlGenerator } from '../ISitemapUrlGenerator';
7
+ import { FilterCombinations } from '../../../sitemap-generator-seo';
5
8
  export declare abstract class BaseSeoIndexabilityPolicy<TDependencies extends IDependencies> implements ISeoIndexabilityPolicy, ISitemapUrlGenerator {
6
9
  protected readonly dependencies: TDependencies;
10
+ protected abstract readonly rules: IRule[];
7
11
  constructor(dependencies: TDependencies);
12
+ abstract get filterCombination(): FilterCombinations;
13
+ protected abstract generateUrls(): Promise<string[]>;
8
14
  shouldIndex(): Promise<boolean>;
9
15
  generateSitemapUrls(): Promise<string[]>;
10
- private isIndexabilityPolicyDependencies;
11
- private isSitemapUrlGeneratorDependencies;
12
- protected abstract isIndexable(): Promise<boolean>;
13
- protected abstract generateUrls(): Promise<string[]>;
14
- abstract get filterCombination(): FilterCombinations;
16
+ protected isIndexable(): Promise<boolean>;
17
+ protected checkRulesForSearch(dependencies: ISearchDependencies): Promise<boolean>;
18
+ protected checkRulesForSitemap(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
19
+ protected isIndexabilityPolicyDependencies(): boolean;
20
+ protected isSitemapUrlGeneratorDependencies(): boolean;
15
21
  }
@@ -1,5 +1,5 @@
1
- import { DependencyTypes } from "../../enums/DependencyTypes";
2
- import { InvalidDependencyTypeError } from "../../errors/InvalidDependencyTypeError";
1
+ import { InvalidDependencyTypeError } from '../../errors/InvalidDependencyTypeError';
2
+ import { DependencyTypes } from '../../enums/DependencyTypes';
3
3
  export class BaseSeoIndexabilityPolicy {
4
4
  dependencies;
5
5
  constructor(dependencies) {
@@ -17,6 +17,27 @@ export class BaseSeoIndexabilityPolicy {
17
17
  }
18
18
  return await this.generateUrls();
19
19
  }
20
+ async isIndexable() {
21
+ return await this.checkRulesForSearch(this.dependencies);
22
+ }
23
+ async checkRulesForSearch(dependencies) {
24
+ for (const rule of this.rules) {
25
+ const result = await rule.forSearch(dependencies);
26
+ if (!result) {
27
+ return false;
28
+ }
29
+ }
30
+ return true;
31
+ }
32
+ async checkRulesForSitemap(filterKeyValues) {
33
+ for (const rule of this.rules) {
34
+ const result = await rule.forSitemapGenerator(filterKeyValues);
35
+ if (!result) {
36
+ return false;
37
+ }
38
+ }
39
+ return true;
40
+ }
20
41
  isIndexabilityPolicyDependencies() {
21
42
  return this.dependencies.dependencyType === DependencyTypes.SEARCH;
22
43
  }
@@ -1,6 +1,6 @@
1
- import { FilterKeyValuesMap } from "../FilterKeyValuesMap";
2
- import { IRule } from "../IRule";
3
- import { ISearchDependencies } from "../ISearchDependencies";
1
+ import { FilterKeyValuesMap } from '../FilterKeyValuesMap';
2
+ import { IRule } from '../IRule';
3
+ import { ISearchDependencies } from '../ISearchDependencies';
4
4
  export declare abstract class BaseFilterKeyValueRule implements IRule {
5
5
  private readonly expectedFilterKeyValues;
6
6
  constructor(expectedFilterKeyValues: FilterKeyValuesMap);
@@ -5,12 +5,13 @@ export class BaseFilterKeyValueRule {
5
5
  }
6
6
  forSearch(dependencies) {
7
7
  const { seoInfoBase, filterState } = dependencies;
8
- const result = Array.from(this.expectedFilterKeyValues)
9
- .reduce((acc, [key, values]) => {
8
+ for (const [key, values] of this.expectedFilterKeyValues) {
10
9
  const optionValue = seoInfoBase.getFilterOptionValueBy(key, filterState);
11
- return acc && optionValue === values[0];
12
- }, true);
13
- return Promise.resolve(result);
10
+ if (!optionValue || !values.includes(optionValue)) {
11
+ return Promise.resolve(false);
12
+ }
13
+ }
14
+ return Promise.resolve(true);
14
15
  }
15
16
  forSitemapGenerator(filterKeyValues) {
16
17
  for (const [key, values] of this.expectedFilterKeyValues) {
@@ -0,0 +1,8 @@
1
+ import { IRule } from '../../common/IRule';
2
+ import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
3
+ import { ISearchDependencies } from '../ISearchDependencies';
4
+ export declare class NoFiltersSelectedRule implements IRule {
5
+ forSearch(dependencies: ISearchDependencies): Promise<boolean>;
6
+ forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
7
+ getName(): string;
8
+ }
@@ -4,11 +4,11 @@ export class NoFiltersSelectedRule {
4
4
  const selectionCount = seoInfoBase.getSelectionTypeCount(filterState);
5
5
  return Promise.resolve(selectionCount === 0);
6
6
  }
7
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
7
  forSitemapGenerator(filterKeyValues) {
9
- throw new Error("Method not implemented.");
8
+ const filterKeys = Array.from(filterKeyValues.keys());
9
+ return Promise.resolve(filterKeys.length === 0);
10
10
  }
11
11
  getName() {
12
- return "NoFiltersSelectedRule";
12
+ return 'NoFiltersSelectedRule';
13
13
  }
14
14
  }
@@ -1,7 +1,7 @@
1
- import { IRule } from "../../common/IRule";
2
- import { FilterKey } from "@studyportals/search-filters";
3
- import { ISearchDependencies } from "../../common/ISearchDependencies";
4
- import { FilterKeyValuesMap } from "../FilterKeyValuesMap";
1
+ import { IRule } from '../../common/IRule';
2
+ import { FilterKey } from '@studyportals/search-filters';
3
+ import { ISearchDependencies } from '../../common/ISearchDependencies';
4
+ import { FilterKeyValuesMap } from '../FilterKeyValuesMap';
5
5
  export declare class OnlyFiltersSelectedRule implements IRule {
6
6
  private readonly filterKeys;
7
7
  constructor(filterKeys: FilterKey[]);
@@ -4,7 +4,7 @@ export class OnlyFiltersSelectedRule {
4
4
  this.filterKeys = filterKeys;
5
5
  }
6
6
  getName() {
7
- return 'OneValueSelectedForFilterRule';
7
+ return `OnlyFiltersSelectedRule-${this.filterKeys.join('-')}`;
8
8
  }
9
9
  async forSearch(dependencies) {
10
10
  const seoInfoBase = dependencies.seoInfoBase;
@@ -1,7 +1,7 @@
1
- import { IRule } from "../../common/IRule";
2
- import { FilterKey } from "@studyportals/search-filters";
3
- import { ISearchDependencies } from "../../common/ISearchDependencies";
4
- import { FilterKeyValuesMap } from "../FilterKeyValuesMap";
1
+ import { IRule } from '../../common/IRule';
2
+ import { FilterKey } from '@studyportals/search-filters';
3
+ import { ISearchDependencies } from '../../common/ISearchDependencies';
4
+ import { FilterKeyValuesMap } from '../FilterKeyValuesMap';
5
5
  export declare class SingleValueSelectedForFilterRule implements IRule {
6
6
  private readonly filterKey;
7
7
  constructor(filterKey: FilterKey);
@@ -4,7 +4,7 @@ export class SingleValueSelectedForFilterRule {
4
4
  this.filterKey = filterKey;
5
5
  }
6
6
  getName() {
7
- return 'OneValueSelectedForFilterRule';
7
+ return `SingleValueSelectedForFilterRule-${this.filterKey}`;
8
8
  }
9
9
  async forSearch(dependencies) {
10
10
  const seoInfoBase = dependencies.seoInfoBase;
@@ -10,7 +10,6 @@ export var FilterCombinations;
10
10
  FilterCombinations["DISCIPLINE"] = "discipline";
11
11
  FilterCombinations["UNFILTERED"] = "unfiltered";
12
12
  FilterCombinations["UNIVERSITY_COUNTRY"] = "universityCountry";
13
- // TODO: orgs
14
13
  FilterCombinations["ATTENDANCE_DISCIPLINE"] = "attendancedDiscipline";
15
14
  FilterCombinations["CONTINENT_ATTENDANCE"] = "continentAttendance";
16
15
  FilterCombinations["COUNTRY_ATTENDANCE"] = "countryAttendance";
@@ -1,4 +1,4 @@
1
- import { FilterKey } from "@studyportals/search-filters";
1
+ import { FilterKey } from '@studyportals/search-filters';
2
2
  export declare class InvalidFilterValueError extends Error {
3
3
  constructor(filterKey: FilterKey, value: string | undefined);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { ISearchApplicationState } from "../common";
1
+ import { ISearchApplicationState } from '../common';
2
2
  export interface IOrganisationSearchApplicationState extends ISearchApplicationState {
3
3
  getRankedResultsCount(): number;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { SortingOptions } from "../enums/SortingOptions";
1
+ import { SortingOptions } from '../enums/SortingOptions';
2
2
  export interface ISeoSortingState {
3
3
  getSelectedOption(): SortingOptions;
4
4
  }
@@ -1,9 +1,9 @@
1
- import { ISearchIndexabilityManager } from "../common/ISearchIndexabilityManager";
2
- import { ISeoIndexabilityPolicy } from "../common/ISeoIndexabilityPolicy";
3
- import { IOrganisationSearchApplicationState } from "./IOrganisationSearchApplicationState";
4
- import { ISeoFilterState, ISeoInfoBase } from "../common";
5
- import { PortalType } from "@studyportals/domain-client";
6
- import { ISeoSortingState } from "../organisations/ISeoSortingState";
1
+ import { ISearchIndexabilityManager } from '../common/ISearchIndexabilityManager';
2
+ import { ISeoIndexabilityPolicy } from '../common/ISeoIndexabilityPolicy';
3
+ import { IOrganisationSearchApplicationState } from './IOrganisationSearchApplicationState';
4
+ import { ISeoFilterState, ISeoInfoBase } from '../common';
5
+ import { PortalType } from '@studyportals/domain-client';
6
+ import { ISeoSortingState } from '../organisations/ISeoSortingState';
7
7
  export declare class SearchIndexabilityManager implements ISearchIndexabilityManager {
8
8
  policies: ISeoIndexabilityPolicy[];
9
9
  constructor(portalType: PortalType, seoInfoBase: ISeoInfoBase, filterState: ISeoFilterState, sortingState: ISeoSortingState, applicationState: IOrganisationSearchApplicationState);
@@ -1,5 +1,5 @@
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 } from "../organisations/policies";
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 } from '../organisations/policies';
3
3
  export class SearchIndexabilityManager {
4
4
  policies;
5
5
  constructor(portalType, seoInfoBase, filterState, sortingState, applicationState) {
@@ -33,7 +33,7 @@ export class SearchIndexabilityManager {
33
33
  ];
34
34
  }
35
35
  async shouldIndex() {
36
- const results = await Promise.all(this.policies.map(policy => policy.shouldIndex()));
37
- return results.some(result => result);
36
+ const results = await Promise.all(this.policies.map((policy) => policy.shouldIndex()));
37
+ return results.some((result) => result);
38
38
  }
39
39
  }
@@ -1,4 +1,4 @@
1
- export * from "./IOrganisationSearchApplicationState";
2
- export * from "./ISeoSortingState";
3
- export * from "./SearchIndexabilityManager";
4
- export * from "./types";
1
+ export * from './IOrganisationSearchApplicationState';
2
+ export * from './ISeoSortingState';
3
+ export * from './SearchIndexabilityManager';
4
+ export * from './types';
@@ -1,4 +1,4 @@
1
- export * from "./IOrganisationSearchApplicationState";
2
- export * from "./ISeoSortingState";
3
- export * from "./SearchIndexabilityManager";
4
- export * from "./types";
1
+ export * from './IOrganisationSearchApplicationState';
2
+ export * from './ISeoSortingState';
3
+ export * from './SearchIndexabilityManager';
4
+ export * from './types';
@@ -0,0 +1,13 @@
1
+ import { PortalType } from '@studyportals/domain-client';
2
+ import { BaseSeoIndexabilityPolicy } from '../../common/policies/BaseSeoIndexabilityPolicy';
3
+ import { IOrganisationsSeoDependencies } from '../types/IOrganisationsSeoDependencies';
4
+ import { SortingOptions } from '../../enums/SortingOptions';
5
+ export declare abstract class OrganisationsSeoIndexabilityPolicy extends BaseSeoIndexabilityPolicy<IOrganisationsSeoDependencies> {
6
+ protected readonly indexablePortalTypes: PortalType[];
7
+ protected abstract readonly sortingOption: SortingOptions;
8
+ constructor(dependencies: IOrganisationsSeoDependencies);
9
+ generateSitemapUrls(): Promise<string[]>;
10
+ protected isIndexable(): Promise<boolean>;
11
+ protected getPathWithSortingOption(path: string): string;
12
+ private matchesSortingOption;
13
+ }
@@ -0,0 +1,32 @@
1
+ import { PortalType } from '@studyportals/domain-client';
2
+ import { BaseSeoIndexabilityPolicy } from '../../common/policies/BaseSeoIndexabilityPolicy';
3
+ import { SortingOptions } from '../../enums/SortingOptions';
4
+ export class OrganisationsSeoIndexabilityPolicy extends BaseSeoIndexabilityPolicy {
5
+ indexablePortalTypes = [PortalType.MASTER];
6
+ constructor(dependencies) {
7
+ super(dependencies);
8
+ }
9
+ async generateSitemapUrls() {
10
+ if (this.indexablePortalTypes.includes(this.dependencies.portalType)) {
11
+ return super.generateSitemapUrls();
12
+ }
13
+ return [];
14
+ }
15
+ async isIndexable() {
16
+ const isIndexable = await super.isIndexable();
17
+ if (!isIndexable) {
18
+ return false;
19
+ }
20
+ return this.indexablePortalTypes.includes(this.dependencies.portalType) && this.matchesSortingOption();
21
+ }
22
+ getPathWithSortingOption(path) {
23
+ if (this.sortingOption === SortingOptions.UNIVERSITY_META_RANKING) {
24
+ return 'rankings/' + path;
25
+ }
26
+ return path;
27
+ }
28
+ matchesSortingOption() {
29
+ const dependencies = this.dependencies;
30
+ return dependencies.sortingState.getSelectedOption() === this.sortingOption;
31
+ }
32
+ }
@@ -0,0 +1,8 @@
1
+ import { PortalType } from '@studyportals/domain-client';
2
+ import { SortingOptions } from '../../enums/SortingOptions';
3
+ import { OrganisationsSeoIndexabilityPolicy } from './OrganisationsSeoIndexabilityPolicy';
4
+ export declare abstract class RankedOrganisationsSeoIndexabilityPolicy extends OrganisationsSeoIndexabilityPolicy {
5
+ protected readonly indexablePortalTypes: PortalType[];
6
+ protected readonly sortingOption: SortingOptions;
7
+ protected addRankedResultsCountRule(): void;
8
+ }
@@ -0,0 +1,19 @@
1
+ import { PortalType } from '@studyportals/domain-client';
2
+ import { SortingOptions } from '../../enums/SortingOptions';
3
+ import { OrganisationsSeoIndexabilityPolicy } from './OrganisationsSeoIndexabilityPolicy';
4
+ import { AtLeastTwoRankedResultsRule } from '../rules/AtLeastTwoRankedResultsRule';
5
+ export class RankedOrganisationsSeoIndexabilityPolicy extends OrganisationsSeoIndexabilityPolicy {
6
+ indexablePortalTypes = [PortalType.MASTER];
7
+ sortingOption = SortingOptions.UNIVERSITY_META_RANKING;
8
+ addRankedResultsCountRule() {
9
+ let rankedResultsCountRule;
10
+ if (super.isSitemapUrlGeneratorDependencies()) {
11
+ const dependencies = this.dependencies;
12
+ rankedResultsCountRule = new AtLeastTwoRankedResultsRule(dependencies.rankingApiClient);
13
+ }
14
+ else {
15
+ rankedResultsCountRule = new AtLeastTwoRankedResultsRule();
16
+ }
17
+ this.rules.push(rankedResultsCountRule);
18
+ }
19
+ }
@@ -1,18 +1,18 @@
1
- export * from "./our-picks/Area";
2
- export * from "./our-picks/AreaAttendance";
3
- export * from "./our-picks/Attendance";
4
- export * from "./our-picks/Continent";
5
- export * from "./our-picks/Country";
6
- export * from "./our-picks/CountryAttendance";
7
- export * from "./our-picks/Unfiltered";
8
- export * from "./ranked/RankedArea";
9
- export * from "./ranked/RankedAreaDiscipline";
10
- export * from "./ranked/RankedAttendance";
11
- export * from "./ranked/RankedAttendanceDiscipline";
12
- export * from "./ranked/RankedContinent";
13
- export * from "./ranked/RankedContinentAttendance";
14
- export * from "./ranked/RankedCountry";
15
- export * from "./ranked/RankedCountryAttendance";
16
- export * from "./ranked/RankedCountryDiscipline";
17
- export * from "./ranked/RankedDiscipline";
18
- export * from "./ranked/RankedUnfiltered";
1
+ export * from './our-picks/Area';
2
+ export * from './our-picks/AreaAttendance';
3
+ export * from './our-picks/Attendance';
4
+ export * from './our-picks/Continent';
5
+ export * from './our-picks/Country';
6
+ export * from './our-picks/CountryAttendance';
7
+ export * from './our-picks/Unfiltered';
8
+ export * from './ranked/RankedArea';
9
+ export * from './ranked/RankedAreaDiscipline';
10
+ export * from './ranked/RankedAttendance';
11
+ export * from './ranked/RankedAttendanceDiscipline';
12
+ export * from './ranked/RankedContinent';
13
+ export * from './ranked/RankedContinentAttendance';
14
+ export * from './ranked/RankedCountry';
15
+ export * from './ranked/RankedCountryAttendance';
16
+ export * from './ranked/RankedCountryDiscipline';
17
+ export * from './ranked/RankedDiscipline';
18
+ export * from './ranked/RankedUnfiltered';
@@ -1,18 +1,18 @@
1
- export * from "./our-picks/Area";
2
- export * from "./our-picks/AreaAttendance";
3
- export * from "./our-picks/Attendance";
4
- export * from "./our-picks/Continent";
5
- export * from "./our-picks/Country";
6
- export * from "./our-picks/CountryAttendance";
7
- export * from "./our-picks/Unfiltered";
8
- export * from "./ranked/RankedArea";
9
- export * from "./ranked/RankedAreaDiscipline";
10
- export * from "./ranked/RankedAttendance";
11
- export * from "./ranked/RankedAttendanceDiscipline";
12
- export * from "./ranked/RankedContinent";
13
- export * from "./ranked/RankedContinentAttendance";
14
- export * from "./ranked/RankedCountry";
15
- export * from "./ranked/RankedCountryAttendance";
16
- export * from "./ranked/RankedCountryDiscipline";
17
- export * from "./ranked/RankedDiscipline";
18
- export * from "./ranked/RankedUnfiltered";
1
+ export * from './our-picks/Area';
2
+ export * from './our-picks/AreaAttendance';
3
+ export * from './our-picks/Attendance';
4
+ export * from './our-picks/Continent';
5
+ export * from './our-picks/Country';
6
+ export * from './our-picks/CountryAttendance';
7
+ export * from './our-picks/Unfiltered';
8
+ export * from './ranked/RankedArea';
9
+ export * from './ranked/RankedAreaDiscipline';
10
+ export * from './ranked/RankedAttendance';
11
+ export * from './ranked/RankedAttendanceDiscipline';
12
+ export * from './ranked/RankedContinent';
13
+ export * from './ranked/RankedContinentAttendance';
14
+ export * from './ranked/RankedCountry';
15
+ export * from './ranked/RankedCountryAttendance';
16
+ export * from './ranked/RankedCountryDiscipline';
17
+ export * from './ranked/RankedDiscipline';
18
+ export * from './ranked/RankedUnfiltered';