@studyportals/fawkes 8.0.1-5 → 8.0.1
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/dist/src/organisations/policies/OrganisationsSeoIndexabilityPolicy.d.ts +1 -1
- package/dist/src/organisations/policies/OrganisationsSeoIndexabilityPolicy.js +5 -5
- package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.d.ts +1 -1
- package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.js +4 -4
- package/dist/src/organisations/rules/AtLeastSevenRankedResultsRule.d.ts +13 -0
- package/dist/src/organisations/rules/AtLeastSevenRankedResultsRule.js +26 -0
- package/dist/src/organisations/rules/AtLeastSevenResultsRule.js +1 -1
- package/dist/src/organisations/rules/MinimumAmountOfRankedResultsRule.d.ts +13 -0
- package/dist/src/organisations/rules/MinimumAmountOfRankedResultsRule.js +26 -0
- package/dist/src/organisations/rules/MinimumAmountOfResultsRule.d.ts +15 -0
- package/dist/src/organisations/rules/MinimumAmountOfResultsRule.js +34 -0
- package/dist/src/programmes/ProgrammesBaseIndexabilityPolicy.js +3 -3
- package/dist/src/programmes/rules/MinimumAmountOfResultsRule.d.ts +15 -0
- package/dist/src/programmes/rules/MinimumAmountOfResultsRule.js +30 -0
- package/package.json +3 -3
|
@@ -13,7 +13,7 @@ export declare abstract class OrganisationsSeoIndexabilityPolicy extends BaseSeo
|
|
|
13
13
|
protected addRule(rule: IRule): void;
|
|
14
14
|
generateSitemapUrls(): Promise<string[]>;
|
|
15
15
|
protected isIndexable(): Promise<boolean>;
|
|
16
|
-
protected
|
|
16
|
+
protected addMinimumAmountOfResultsRule(): void;
|
|
17
17
|
protected getPathWithSortingOption(path: string): string;
|
|
18
18
|
private matchesSortingOption;
|
|
19
19
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { PortalType } from '@studyportals/domain-client';
|
|
2
2
|
import { BaseSeoIndexabilityPolicy } from '../../common/policies/BaseSeoIndexabilityPolicy';
|
|
3
3
|
import { IndexablePageNumberRule } from '../../common/rules/IndexablePageNumberRule';
|
|
4
|
-
import {
|
|
4
|
+
import { MinimumAmountOfResultsRule } from '../../organisations/rules/MinimumAmountOfResultsRule';
|
|
5
5
|
export class OrganisationsSeoIndexabilityPolicy extends BaseSeoIndexabilityPolicy {
|
|
6
6
|
indexablePortalTypes = [PortalType.MASTER];
|
|
7
7
|
additionalRules = [];
|
|
8
8
|
constructor(dependencies) {
|
|
9
9
|
super(dependencies);
|
|
10
|
-
this.
|
|
10
|
+
this.addMinimumAmountOfResultsRule();
|
|
11
11
|
}
|
|
12
12
|
get rules() {
|
|
13
13
|
return [...this.baseRules, ...this.additionalRules, new IndexablePageNumberRule()];
|
|
@@ -28,14 +28,14 @@ export class OrganisationsSeoIndexabilityPolicy extends BaseSeoIndexabilityPolic
|
|
|
28
28
|
}
|
|
29
29
|
return this.indexablePortalTypes.includes(this.dependencies.portalType) && this.matchesSortingOption();
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
addMinimumAmountOfResultsRule() {
|
|
32
32
|
let resultCountRUle;
|
|
33
33
|
if (super.isSitemapUrlGeneratorDependencies()) {
|
|
34
34
|
const dependencies = this.dependencies;
|
|
35
|
-
resultCountRUle = new
|
|
35
|
+
resultCountRUle = new MinimumAmountOfResultsRule(dependencies.searchApiClient);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
resultCountRUle = new
|
|
38
|
+
resultCountRUle = new MinimumAmountOfResultsRule();
|
|
39
39
|
}
|
|
40
40
|
this.addRule(resultCountRUle);
|
|
41
41
|
}
|
|
@@ -4,6 +4,6 @@ import { OrganisationsSeoIndexabilityPolicy } from './OrganisationsSeoIndexabili
|
|
|
4
4
|
export declare abstract class RankedOrganisationsSeoIndexabilityPolicy extends OrganisationsSeoIndexabilityPolicy {
|
|
5
5
|
protected readonly indexablePortalTypes: PortalType[];
|
|
6
6
|
protected readonly sortingOption: SortingOptions;
|
|
7
|
-
protected
|
|
7
|
+
protected addMinimumAmountOfResultsRule(): void;
|
|
8
8
|
protected getPathWithSortingOption(path: string): string;
|
|
9
9
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { PortalType } from '@studyportals/domain-client';
|
|
2
2
|
import { SortingOptions } from '../../enums/SortingOptions';
|
|
3
3
|
import { OrganisationsSeoIndexabilityPolicy } from './OrganisationsSeoIndexabilityPolicy';
|
|
4
|
-
import {
|
|
4
|
+
import { MinimumAmountOfRankedResultsRule } from '../rules/MinimumAmountOfRankedResultsRule';
|
|
5
5
|
export class RankedOrganisationsSeoIndexabilityPolicy extends OrganisationsSeoIndexabilityPolicy {
|
|
6
6
|
indexablePortalTypes = [PortalType.MASTER];
|
|
7
7
|
sortingOption = SortingOptions.UNIVERSITY_META_RANKING;
|
|
8
|
-
|
|
8
|
+
addMinimumAmountOfResultsRule() {
|
|
9
9
|
let rankedResultsCountRule;
|
|
10
10
|
if (super.isSitemapUrlGeneratorDependencies()) {
|
|
11
11
|
const dependencies = this.dependencies;
|
|
12
|
-
rankedResultsCountRule = new
|
|
12
|
+
rankedResultsCountRule = new MinimumAmountOfRankedResultsRule(dependencies.rankingApiClient);
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
rankedResultsCountRule = new
|
|
15
|
+
rankedResultsCountRule = new MinimumAmountOfRankedResultsRule();
|
|
16
16
|
}
|
|
17
17
|
this.addRule(rankedResultsCountRule);
|
|
18
18
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRule } from '../../common/IRule';
|
|
2
|
+
import { IOrganisationSearchDependencies } from '../types/IOrganisationSearchDependencies';
|
|
3
|
+
import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
|
|
4
|
+
import { IRankingApiClient } from '../../sitemap-generator/IRankingApiClient';
|
|
5
|
+
export declare class AtLeastSevenRankedResultsRule implements IRule {
|
|
6
|
+
private readonly minimumRankedResultsCount;
|
|
7
|
+
private readonly rankingApiClient?;
|
|
8
|
+
constructor(rankingApiClient?: IRankingApiClient);
|
|
9
|
+
forSearch(dependencies: IOrganisationSearchDependencies): Promise<boolean>;
|
|
10
|
+
forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
|
|
11
|
+
getName(): string;
|
|
12
|
+
getDescription(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DependencyMissingError } from '../../errors/DependencyMissingError';
|
|
2
|
+
export class AtLeastSevenRankedResultsRule {
|
|
3
|
+
minimumRankedResultsCount = 7;
|
|
4
|
+
rankingApiClient;
|
|
5
|
+
constructor(rankingApiClient) {
|
|
6
|
+
this.rankingApiClient = rankingApiClient;
|
|
7
|
+
}
|
|
8
|
+
forSearch(dependencies) {
|
|
9
|
+
const { applicationState } = dependencies;
|
|
10
|
+
const rankedResultsCount = applicationState.getRankedResultsCount();
|
|
11
|
+
return Promise.resolve(rankedResultsCount >= this.minimumRankedResultsCount);
|
|
12
|
+
}
|
|
13
|
+
async forSitemapGenerator(filterKeyValues) {
|
|
14
|
+
if (!this.rankingApiClient) {
|
|
15
|
+
throw new DependencyMissingError('RankingApiClient');
|
|
16
|
+
}
|
|
17
|
+
const rankedResultsCount = await this.rankingApiClient.getRankedOrganisationCount(filterKeyValues);
|
|
18
|
+
return rankedResultsCount >= this.minimumRankedResultsCount;
|
|
19
|
+
}
|
|
20
|
+
getName() {
|
|
21
|
+
return 'AtLeastTwoRankedResultsRule';
|
|
22
|
+
}
|
|
23
|
+
getDescription() {
|
|
24
|
+
return `At least ${this.minimumRankedResultsCount} ranked results are available`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRule } from '../../common/IRule';
|
|
2
|
+
import { IOrganisationSearchDependencies } from '../types/IOrganisationSearchDependencies';
|
|
3
|
+
import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
|
|
4
|
+
import { IRankingApiClient } from '../../sitemap-generator/IRankingApiClient';
|
|
5
|
+
export declare class MinimumAmountOfRankedResultsRule implements IRule {
|
|
6
|
+
private readonly minimumRankedResultsCount;
|
|
7
|
+
private readonly rankingApiClient?;
|
|
8
|
+
constructor(rankingApiClient?: IRankingApiClient);
|
|
9
|
+
forSearch(dependencies: IOrganisationSearchDependencies): Promise<boolean>;
|
|
10
|
+
forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
|
|
11
|
+
getName(): string;
|
|
12
|
+
getDescription(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DependencyMissingError } from '../../errors/DependencyMissingError';
|
|
2
|
+
export class MinimumAmountOfRankedResultsRule {
|
|
3
|
+
minimumRankedResultsCount = 7;
|
|
4
|
+
rankingApiClient;
|
|
5
|
+
constructor(rankingApiClient) {
|
|
6
|
+
this.rankingApiClient = rankingApiClient;
|
|
7
|
+
}
|
|
8
|
+
forSearch(dependencies) {
|
|
9
|
+
const { applicationState } = dependencies;
|
|
10
|
+
const rankedResultsCount = applicationState.getRankedResultsCount();
|
|
11
|
+
return Promise.resolve(rankedResultsCount >= this.minimumRankedResultsCount);
|
|
12
|
+
}
|
|
13
|
+
async forSitemapGenerator(filterKeyValues) {
|
|
14
|
+
if (!this.rankingApiClient) {
|
|
15
|
+
throw new DependencyMissingError('RankingApiClient');
|
|
16
|
+
}
|
|
17
|
+
const rankedResultsCount = await this.rankingApiClient.getRankedOrganisationCount(filterKeyValues);
|
|
18
|
+
return rankedResultsCount >= this.minimumRankedResultsCount;
|
|
19
|
+
}
|
|
20
|
+
getName() {
|
|
21
|
+
return 'AtLeastTwoRankedResultsRule';
|
|
22
|
+
}
|
|
23
|
+
getDescription() {
|
|
24
|
+
return `At least ${this.minimumRankedResultsCount} ranked results are available`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ISearchDependencies } from '../../common/ISearchDependencies';
|
|
2
|
+
import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
|
|
3
|
+
import { ISearchApiClient } from '../../sitemap-generator/ISearchApiClient';
|
|
4
|
+
import { IRule } from '../../common/IRule';
|
|
5
|
+
export declare class MinimumAmountOfResultsRule implements IRule {
|
|
6
|
+
private readonly minimumResultsCount;
|
|
7
|
+
private readonly maximumPageSize;
|
|
8
|
+
private readonly searchApiClient?;
|
|
9
|
+
constructor(searchApiClient?: ISearchApiClient);
|
|
10
|
+
forSearch(dependencies: ISearchDependencies): Promise<boolean>;
|
|
11
|
+
forSitemapGeneratorWithPageNumber(filterKeyValues: FilterKeyValuesMap, pageNumber: number): Promise<boolean>;
|
|
12
|
+
forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
|
|
13
|
+
getName(): string;
|
|
14
|
+
getDescription(): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DependencyMissingError } from '../../errors/DependencyMissingError';
|
|
2
|
+
export class MinimumAmountOfResultsRule {
|
|
3
|
+
minimumResultsCount = 7;
|
|
4
|
+
maximumPageSize = 20;
|
|
5
|
+
searchApiClient;
|
|
6
|
+
constructor(searchApiClient) {
|
|
7
|
+
this.searchApiClient = searchApiClient;
|
|
8
|
+
}
|
|
9
|
+
forSearch(dependencies) {
|
|
10
|
+
const { applicationState } = dependencies;
|
|
11
|
+
const resultCount = applicationState.getNumberOfResults();
|
|
12
|
+
return Promise.resolve(resultCount >= this.minimumResultsCount);
|
|
13
|
+
}
|
|
14
|
+
async forSitemapGeneratorWithPageNumber(filterKeyValues, pageNumber) {
|
|
15
|
+
if (!this.searchApiClient) {
|
|
16
|
+
throw new DependencyMissingError('SearchApiClient');
|
|
17
|
+
}
|
|
18
|
+
const count = await this.searchApiClient.getCount(filterKeyValues);
|
|
19
|
+
return count >= (pageNumber - 1) * this.maximumPageSize + this.minimumResultsCount;
|
|
20
|
+
}
|
|
21
|
+
async forSitemapGenerator(filterKeyValues) {
|
|
22
|
+
if (!this.searchApiClient) {
|
|
23
|
+
throw new DependencyMissingError('SearchApiClient');
|
|
24
|
+
}
|
|
25
|
+
const resultsCount = await this.searchApiClient?.getCount(filterKeyValues);
|
|
26
|
+
return resultsCount >= this.minimumResultsCount;
|
|
27
|
+
}
|
|
28
|
+
getName() {
|
|
29
|
+
return 'AtLeastSevenResultsRule';
|
|
30
|
+
}
|
|
31
|
+
getDescription() {
|
|
32
|
+
return 'Is indexable if there are at least 6 results.';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MinimumAmountOfResultsRule } from './rules/MinimumAmountOfResultsRule';
|
|
2
2
|
import { IndexablePageNumberRule } from './rules/IndexablePageNumberRule';
|
|
3
3
|
import { NotDistanceLearningPortalRule } from './rules/NotDistanceLearningPortalRule';
|
|
4
4
|
import { BaseSeoIndexabilityPolicy } from '../common/policies/BaseSeoIndexabilityPolicy';
|
|
@@ -10,11 +10,11 @@ export class ProgrammesBaseIndexabilityPolicy extends BaseSeoIndexabilityPolicy
|
|
|
10
10
|
let notDistanceLearningPortalRule;
|
|
11
11
|
if (super.isSitemapUrlGeneratorDependencies()) {
|
|
12
12
|
const dependencies = this.dependencies;
|
|
13
|
-
atLeastSevenResultsRule = new
|
|
13
|
+
atLeastSevenResultsRule = new MinimumAmountOfResultsRule(dependencies.searchApiClient);
|
|
14
14
|
notDistanceLearningPortalRule = new NotDistanceLearningPortalRule(dependencies.portalType);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
atLeastSevenResultsRule = new
|
|
17
|
+
atLeastSevenResultsRule = new MinimumAmountOfResultsRule();
|
|
18
18
|
notDistanceLearningPortalRule = new NotDistanceLearningPortalRule();
|
|
19
19
|
}
|
|
20
20
|
this.rules.push(atLeastSevenResultsRule, notDistanceLearningPortalRule, indexablePageNumberRule);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ISearchDependencies } from '../../common/ISearchDependencies';
|
|
2
|
+
import { FilterKeyValuesMap } from '../../common/FilterKeyValuesMap';
|
|
3
|
+
import { ISearchApiClient } from '../../sitemap-generator/ISearchApiClient';
|
|
4
|
+
import { IProgrammeRule } from '../IProgrammeRule';
|
|
5
|
+
export declare class MinimumAmountOfResultsRule implements IProgrammeRule {
|
|
6
|
+
private readonly minimumResultsCount;
|
|
7
|
+
private readonly maximumPageSize;
|
|
8
|
+
private readonly searchApiClient?;
|
|
9
|
+
constructor(searchApiClient?: ISearchApiClient);
|
|
10
|
+
forSearch(dependencies: ISearchDependencies): Promise<boolean>;
|
|
11
|
+
forSitemapGeneratorWithPageNumber(filterKeyValues: FilterKeyValuesMap, pageNumber: number): Promise<boolean>;
|
|
12
|
+
forSitemapGenerator(): Promise<boolean>;
|
|
13
|
+
getName(): string;
|
|
14
|
+
getDescription(): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DependencyMissingError } from '../../errors/DependencyMissingError';
|
|
2
|
+
export class MinimumAmountOfResultsRule {
|
|
3
|
+
minimumResultsCount = 7;
|
|
4
|
+
maximumPageSize = 20;
|
|
5
|
+
searchApiClient;
|
|
6
|
+
constructor(searchApiClient) {
|
|
7
|
+
this.searchApiClient = searchApiClient;
|
|
8
|
+
}
|
|
9
|
+
forSearch(dependencies) {
|
|
10
|
+
const { applicationState } = dependencies;
|
|
11
|
+
const resultCount = applicationState.getNumberOfResults();
|
|
12
|
+
return Promise.resolve(resultCount >= this.minimumResultsCount);
|
|
13
|
+
}
|
|
14
|
+
async forSitemapGeneratorWithPageNumber(filterKeyValues, pageNumber) {
|
|
15
|
+
if (!this.searchApiClient) {
|
|
16
|
+
throw new DependencyMissingError('SearchApiClient');
|
|
17
|
+
}
|
|
18
|
+
const count = await this.searchApiClient.getCount(filterKeyValues);
|
|
19
|
+
return count >= (pageNumber - 1) * this.maximumPageSize + this.minimumResultsCount;
|
|
20
|
+
}
|
|
21
|
+
forSitemapGenerator() {
|
|
22
|
+
throw new Error('Method not implemented.');
|
|
23
|
+
}
|
|
24
|
+
getName() {
|
|
25
|
+
return 'AtLeastSevenResultsRule';
|
|
26
|
+
}
|
|
27
|
+
getDescription() {
|
|
28
|
+
return 'Is indexable if there are at least 7 results.';
|
|
29
|
+
}
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studyportals/fawkes",
|
|
3
|
-
"version": "8.0.1
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"compile": "npx tsc && tsc-alias && rm -r ./dist/tests",
|
|
12
12
|
"build": "npm run clean && npm run compile",
|
|
13
13
|
"clean": "rimraf \"!(node_modules)/**/dist\"",
|
|
14
|
-
"prepare-deployment": "npm run build",
|
|
14
|
+
"prepare-deployment": "npm run test && npm run build",
|
|
15
15
|
"publish-major": "npm run prepare-deployment && npm version major && npm publish",
|
|
16
16
|
"publish-beta": "npm run prepare-deployment && npm version prerelease && npm publish --tag beta --access=public",
|
|
17
17
|
"publish-patch": "npm run prepare-deployment && npm version patch && npm publish",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@studyportals/domain-client": "^6.3.0",
|
|
94
94
|
"@studyportals/ranking-api-interface": "^1.3.12",
|
|
95
|
-
"@studyportals/search-filters": "^6.
|
|
95
|
+
"@studyportals/search-filters": "^6.1.0",
|
|
96
96
|
"@studyportals/static-domain-data": "^6.1.0"
|
|
97
97
|
},
|
|
98
98
|
"optionalDependencies": {
|