@studyportals/fawkes 1.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 (80) hide show
  1. package/README.md +17 -0
  2. package/dist/index.d.ts +0 -0
  3. package/dist/index.js +1 -0
  4. package/dist/organisations-seo/index.d.ts +0 -0
  5. package/dist/organisations-seo/index.js +13 -0
  6. package/dist/organisations-seo.js +0 -0
  7. package/dist/scholarships-seo/index.d.ts +2 -0
  8. package/dist/scholarships-seo/index.js +7 -0
  9. package/dist/scholarships-seo.js +2 -0
  10. package/dist/scholarships-seo.js.map +1 -0
  11. package/dist/sitemap-generator-seo/index.d.ts +0 -0
  12. package/dist/sitemap-generator-seo/index.js +9 -0
  13. package/dist/sitemap-generator-seo.js +0 -0
  14. package/dist/src/common/BaseSeoIndexabilityPolicy.d.ts +12 -0
  15. package/dist/src/common/BaseSeoIndexabilityPolicy.js +54 -0
  16. package/dist/src/common/IFilterOptions.d.ts +4 -0
  17. package/dist/src/common/IFilterOptions.js +2 -0
  18. package/dist/src/common/IFilterSelectionState.d.ts +4 -0
  19. package/dist/src/common/IFilterSelectionState.js +2 -0
  20. package/dist/src/common/IPrettyPathGenerator.d.ts +3 -0
  21. package/dist/src/common/IPrettyPathGenerator.js +2 -0
  22. package/dist/src/common/ISearchApplicationState.d.ts +3 -0
  23. package/dist/src/common/ISearchApplicationState.js +2 -0
  24. package/dist/src/common/ISearchPolicyChain.d.ts +3 -0
  25. package/dist/src/common/ISearchPolicyChain.js +2 -0
  26. package/dist/src/common/ISeoIndexabilityPolicy.d.ts +3 -0
  27. package/dist/src/common/ISeoIndexabilityPolicy.js +2 -0
  28. package/dist/src/common/ISeoInfoBase.d.ts +10 -0
  29. package/dist/src/common/ISeoInfoBase.js +2 -0
  30. package/dist/src/common/index.d.ts +3 -0
  31. package/dist/src/common/index.js +4 -0
  32. package/dist/src/organisations/FilterKeyValuePairs.d.ts +7 -0
  33. package/dist/src/organisations/FilterKeyValuePairs.js +2 -0
  34. package/dist/src/organisations/IOrganisationsProvider.d.ts +3 -0
  35. package/dist/src/organisations/IOrganisationsProvider.js +2 -0
  36. package/dist/src/organisations/ISeoInfoBaseOrganisations.d.ts +7 -0
  37. package/dist/src/organisations/ISeoInfoBaseOrganisations.js +2 -0
  38. package/dist/src/organisations/ISortState.d.ts +4 -0
  39. package/dist/src/organisations/ISortState.js +2 -0
  40. package/dist/src/organisations/SearchPolicyChain.d.ts +6 -0
  41. package/dist/src/organisations/SearchPolicyChain.js +13 -0
  42. package/dist/src/organisations/SeoIndexabilityPolicy.d.ts +14 -0
  43. package/dist/src/organisations/SeoIndexabilityPolicy.js +33 -0
  44. package/dist/src/organisations/SeoRuleBasedIndexabilityPolicy.d.ts +16 -0
  45. package/dist/src/organisations/SeoRuleBasedIndexabilityPolicy.js +33 -0
  46. package/dist/src/organisations/SortingOptions.d.ts +4 -0
  47. package/dist/src/organisations/SortingOptions.js +8 -0
  48. package/dist/src/organisations/index.d.ts +2 -0
  49. package/dist/src/organisations/index.js +6 -0
  50. package/dist/src/scholarships/SearchIndexabilityManager.d.ts +15 -0
  51. package/dist/src/scholarships/SearchIndexabilityManager.js +78 -0
  52. package/dist/src/scholarships/index.d.ts +0 -0
  53. package/dist/src/scholarships/index.js +6 -0
  54. package/dist/src/scholarships/policies/AreaPolicy.d.ts +15 -0
  55. package/dist/src/scholarships/policies/AreaPolicy.js +110 -0
  56. package/dist/src/scholarships/policies/CountryPolicy.d.ts +10 -0
  57. package/dist/src/scholarships/policies/CountryPolicy.js +88 -0
  58. package/dist/src/scholarships/policies/DisciplineAreaPolicy.d.ts +10 -0
  59. package/dist/src/scholarships/policies/DisciplineAreaPolicy.js +99 -0
  60. package/dist/src/scholarships/policies/DisciplineCountryPolicy.d.ts +13 -0
  61. package/dist/src/scholarships/policies/DisciplineCountryPolicy.js +106 -0
  62. package/dist/src/scholarships/policies/DisciplinePolicy.d.ts +10 -0
  63. package/dist/src/scholarships/policies/DisciplinePolicy.js +88 -0
  64. package/dist/src/scholarships/policies/UnfilteredPolicy.d.ts +10 -0
  65. package/dist/src/scholarships/policies/UnfilteredPolicy.js +76 -0
  66. package/dist/src/scholarships/policies/UniversityCountryPolicy.d.ts +10 -0
  67. package/dist/src/scholarships/policies/UniversityCountryPolicy.js +94 -0
  68. package/dist/src/sitemap-generator/CombinationType.d.ts +2 -0
  69. package/dist/src/sitemap-generator/CombinationType.js +6 -0
  70. package/dist/src/sitemap-generator/IRankingApiClient.d.ts +3 -0
  71. package/dist/src/sitemap-generator/IRankingApiClient.js +2 -0
  72. package/dist/src/sitemap-generator/ISitemapPathGeneratorChain.d.ts +4 -0
  73. package/dist/src/sitemap-generator/ISitemapPathGeneratorChain.js +2 -0
  74. package/dist/src/sitemap-generator/SitemapPathGeneratorChain.d.ts +7 -0
  75. package/dist/src/sitemap-generator/SitemapPathGeneratorChain.js +13 -0
  76. package/dist/src/sitemap-generator/index.d.ts +3 -0
  77. package/dist/src/sitemap-generator/index.js +19 -0
  78. package/dist/tests/TestBase.test.d.mts +1 -0
  79. package/dist/tests/TestBase.test.mjs +9 -0
  80. package/package.json +55 -0
package/README.md ADDED
@@ -0,0 +1,17 @@
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
+
File without changes
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // import {
3
+ // IOrganisationsProvider,
4
+ // ISeoInfoBaseOrganisations,
5
+ // ISortState,
6
+ // SortingOptions
7
+ // } from "@/organisations";
8
+ // export {
9
+ // IOrganisationsProvider,
10
+ // ISeoInfoBaseOrganisations,
11
+ // ISortState,
12
+ // SortingOptions
13
+ // }
File without changes
@@ -0,0 +1,2 @@
1
+ import { IFilterSelectionState, ISeoInfoBase } from "../src/common";
2
+ export { IFilterSelectionState, ISeoInfoBase };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ // import {
3
+ // SearchIndexabilityManager,
4
+ // } from '@/scholarships/';
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // export * from '@/common/ISeoInfoBase';
7
+ // SearchPolicyChain => rename to something more generic (client does not need to know about the pattern)
@@ -0,0 +1,2 @@
1
+ var e,r={};e=r,Object.defineProperty(e,"B",{value:!0});var a=r.B;export{a as __esModule};
2
+ //# sourceMappingURL=scholarships-seo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scholarships-seo.js","mappings":"eACAA,OAAOC,eAAeC,EAAS,IAA/B,CAA+CC,OAAO,I","sources":["webpack://@studyportals/fawkes/./scholarships-seo/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":["Object","defineProperty","exports","value"],"sourceRoot":""}
File without changes
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // import {
3
+ // ISitemapPathGeneratorChain,
4
+ // SitemapPathGeneratorChain,
5
+ // } from '@/sitemap-generator';
6
+ // export {
7
+ // ISitemapPathGeneratorChain,
8
+ // SitemapPathGeneratorChain,
9
+ // }
File without changes
@@ -0,0 +1,12 @@
1
+ import { IFilterSelectionState } from "./IFilterSelectionState";
2
+ import { IPrettyPathGenerator } from "./IPrettyPathGenerator";
3
+ import { ISeoIndexabilityPolicy } from "./ISeoIndexabilityPolicy";
4
+ import { ISeoInfoBase } from "./ISeoInfoBase";
5
+ export declare abstract class BaseSeoIndexabilityPolicy implements ISeoIndexabilityPolicy, IPrettyPathGenerator {
6
+ protected readonly seoInfoBase: ISeoInfoBase;
7
+ protected readonly filterState: IFilterSelectionState;
8
+ constructor(seoInfoBase: ISeoInfoBase, filterState: IFilterSelectionState);
9
+ shouldIndex(): Promise<boolean>;
10
+ abstract generatePaths(): string[];
11
+ protected abstract matchesFilters(): Promise<boolean>;
12
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.BaseSeoIndexabilityPolicy = void 0;
40
+ var BaseSeoIndexabilityPolicy = /** @class */ (function () {
41
+ function BaseSeoIndexabilityPolicy(seoInfoBase, filterState) {
42
+ this.seoInfoBase = seoInfoBase;
43
+ this.filterState = filterState;
44
+ }
45
+ BaseSeoIndexabilityPolicy.prototype.shouldIndex = function () {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ return __generator(this, function (_a) {
48
+ return [2 /*return*/, this.matchesFilters()];
49
+ });
50
+ });
51
+ };
52
+ return BaseSeoIndexabilityPolicy;
53
+ }());
54
+ exports.BaseSeoIndexabilityPolicy = BaseSeoIndexabilityPolicy;
@@ -0,0 +1,4 @@
1
+ import { FilterKey, FilterOptionInformation } from "@studyportals/search-filters";
2
+ export interface IFilterOptions {
3
+ getFor(key: FilterKey): FilterOptionInformation[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { FilterKey } from "@studyportals/search-filters";
2
+ export interface IFilterSelectionState {
3
+ identifySelectedFiltersFor(state: IFilterSelectionState): readonly FilterKey[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface IPrettyPathGenerator {
2
+ generatePaths(): string[];
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface ISearchApplicationState {
2
+ getNumberOfResults(): number;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface ISearchPolicyChain {
2
+ shouldIndex(): Promise<boolean>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface ISeoIndexabilityPolicy {
2
+ shouldIndex(): Promise<boolean>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { FilterKey } from '@studyportals/search-filters';
2
+ import { IFilterSelectionState } from './IFilterSelectionState';
3
+ export interface ISeoInfoBase {
4
+ selectionOnlyFor(filterKeys: FilterKey[], filterSelectionState: IFilterSelectionState): Promise<boolean>;
5
+ singleSelectionFor(filterKey: FilterKey, filterSelectionState: IFilterSelectionState): Promise<boolean>;
6
+ getFilterOptionValueBy(filterKey: FilterKey, filterSelectionState: IFilterSelectionState): string | null;
7
+ getFilterOptionValueBy(filterKey: FilterKey, filterSelectionState: IFilterSelectionState): string | null;
8
+ getSelectionTypeCount(filterSelectionState: IFilterSelectionState): number;
9
+ getSelectedValuesFor(fiterKey: FilterKey, filterSelectionState: IFilterSelectionState): string[];
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { ISeoInfoBase } from "./ISeoInfoBase";
2
+ import { IFilterSelectionState } from "./IFilterSelectionState";
3
+ export { ISeoInfoBase, IFilterSelectionState };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // export * from "./IFilterSelectionState";
3
+ // export * from "./ISeoInfoBase";
4
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { FilterKey } from "@studyportals/search-filters";
2
+ type FilterKeyValue = {
3
+ readonly key: FilterKey;
4
+ readonly value: string;
5
+ };
6
+ export type FilterKeyValuePairs = FilterKeyValue[];
7
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface IOrganisationsProvider<T> {
2
+ getOrganisations(): T[];
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { ISeoInfoBase } from "@/common/ISeoInfoBase";
2
+ import { ISortState } from "./ISortState";
3
+ import { SortingOptions } from "./SortingOptions";
4
+ export interface ISeoInfoBaseOrganisations<T> extends ISeoInfoBase {
5
+ hasRankedResultsFor(organisations: readonly T[], disciplineId?: number): boolean;
6
+ isSortingOptionSelected(option: SortingOptions, sortState: ISortState): boolean;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { SortingOptions } from "./SortingOptions";
2
+ export interface ISortState {
3
+ isSelected(sortingOption: SortingOptions): boolean;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { ISearchPolicyChain } from "@/common/ISearchPolicyChain";
2
+ import { ISeoIndexabilityPolicy } from "@/common/ISeoIndexabilityPolicy";
3
+ export declare class SearchPolicyChain implements ISearchPolicyChain {
4
+ policies: ISeoIndexabilityPolicy[];
5
+ shouldIndex(): Promise<boolean>;
6
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchPolicyChain = void 0;
4
+ var SearchPolicyChain = /** @class */ (function () {
5
+ function SearchPolicyChain() {
6
+ this.policies = [];
7
+ }
8
+ SearchPolicyChain.prototype.shouldIndex = function () {
9
+ throw new Error("Method not implemented.");
10
+ };
11
+ return SearchPolicyChain;
12
+ }());
13
+ exports.SearchPolicyChain = SearchPolicyChain;
@@ -0,0 +1,14 @@
1
+ import { BaseSeoIndexabilityPolicy } from "../common/BaseSeoIndexabilityPolicy";
2
+ import { IFilterSelectionState } from "../common/IFilterSelectionState";
3
+ import { ISeoInfoBase } from "../common/ISeoInfoBase";
4
+ import { IOrganisationsProvider } from "./IOrganisationsProvider";
5
+ import { IRankingApiClient } from "@/sitemap-generator/IRankingApiClient";
6
+ import { ISortState } from "./ISortState";
7
+ export declare abstract class SeoIndexabilityPolicy<T> extends BaseSeoIndexabilityPolicy {
8
+ protected readonly seoInfoBase: ISeoInfoBase;
9
+ protected readonly filterState: IFilterSelectionState;
10
+ protected readonly organisationsProvider: IOrganisationsProvider<T>;
11
+ protected readonly rankingApiClient: IRankingApiClient;
12
+ protected readonly sortState: ISortState;
13
+ constructor(seoInfoBase: ISeoInfoBase, filterState: IFilterSelectionState, organisationsProvider: IOrganisationsProvider<T>, rankingApiClient: IRankingApiClient, sortState: ISortState);
14
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SeoIndexabilityPolicy = void 0;
19
+ var BaseSeoIndexabilityPolicy_1 = require("../common/BaseSeoIndexabilityPolicy");
20
+ var SeoIndexabilityPolicy = /** @class */ (function (_super) {
21
+ __extends(SeoIndexabilityPolicy, _super);
22
+ function SeoIndexabilityPolicy(seoInfoBase, filterState, organisationsProvider, rankingApiClient, sortState) {
23
+ var _this = _super.call(this, seoInfoBase, filterState) || this;
24
+ _this.seoInfoBase = seoInfoBase;
25
+ _this.filterState = filterState;
26
+ _this.organisationsProvider = organisationsProvider;
27
+ _this.rankingApiClient = rankingApiClient;
28
+ _this.sortState = sortState;
29
+ return _this;
30
+ }
31
+ return SeoIndexabilityPolicy;
32
+ }(BaseSeoIndexabilityPolicy_1.BaseSeoIndexabilityPolicy));
33
+ exports.SeoIndexabilityPolicy = SeoIndexabilityPolicy;
@@ -0,0 +1,16 @@
1
+ import { SeoIndexabilityPolicy } from "@/organisations/SeoIndexabilityPolicy";
2
+ import { IFilterSelectionState } from "@/common/IFilterSelectionState";
3
+ import { ISeoInfoBase } from "@/common/ISeoInfoBase";
4
+ import { IOrganisationsProvider } from "@/organisations/IOrganisationsProvider";
5
+ import { IRankingApiClient } from "@/sitemap-generator/IRankingApiClient";
6
+ import { FilterKeyValuePairs } from "@/organisations/FilterKeyValuePairs";
7
+ import { ISortState } from "@/organisations/ISortState";
8
+ export declare abstract class SeoRuleBasedIndexabilityPolicy<T> extends SeoIndexabilityPolicy<T> {
9
+ protected readonly seoInfoBase: ISeoInfoBase;
10
+ protected readonly filterState: IFilterSelectionState;
11
+ protected readonly organisationsProvider: IOrganisationsProvider<T>;
12
+ protected readonly rankingApiClient: IRankingApiClient;
13
+ protected readonly sortState: ISortState;
14
+ constructor(seoInfoBase: ISeoInfoBase, filterState: IFilterSelectionState, organisationsProvider: IOrganisationsProvider<T>, rankingApiClient: IRankingApiClient, sortState: ISortState);
15
+ protected abstract matchesRule(pairs: FilterKeyValuePairs, ...values: []): boolean;
16
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SeoRuleBasedIndexabilityPolicy = void 0;
19
+ var SeoIndexabilityPolicy_1 = require("@/organisations/SeoIndexabilityPolicy");
20
+ var SeoRuleBasedIndexabilityPolicy = /** @class */ (function (_super) {
21
+ __extends(SeoRuleBasedIndexabilityPolicy, _super);
22
+ function SeoRuleBasedIndexabilityPolicy(seoInfoBase, filterState, organisationsProvider, rankingApiClient, sortState) {
23
+ var _this = _super.call(this, seoInfoBase, filterState, organisationsProvider, rankingApiClient, sortState) || this;
24
+ _this.seoInfoBase = seoInfoBase;
25
+ _this.filterState = filterState;
26
+ _this.organisationsProvider = organisationsProvider;
27
+ _this.rankingApiClient = rankingApiClient;
28
+ _this.sortState = sortState;
29
+ return _this;
30
+ }
31
+ return SeoRuleBasedIndexabilityPolicy;
32
+ }(SeoIndexabilityPolicy_1.SeoIndexabilityPolicy));
33
+ exports.SeoRuleBasedIndexabilityPolicy = SeoRuleBasedIndexabilityPolicy;
@@ -0,0 +1,4 @@
1
+ export declare enum SortingOptions {
2
+ OUR_PICKS = "Our picks",
3
+ UNIVERSITY_META_RANKING = "University Meta Ranking"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SortingOptions = void 0;
4
+ var SortingOptions;
5
+ (function (SortingOptions) {
6
+ SortingOptions["OUR_PICKS"] = "Our picks";
7
+ SortingOptions["UNIVERSITY_META_RANKING"] = "University Meta Ranking";
8
+ })(SortingOptions || (exports.SortingOptions = SortingOptions = {}));
@@ -0,0 +1,2 @@
1
+ import { IOrganisationsProvider } from "./IOrganisationsProvider";
2
+ export { IOrganisationsProvider };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // export * from "./IOrganisationsProvider";
3
+ // export * from "./ISeoInfoBaseOrganisations";
4
+ // export * from "./ISortState";
5
+ // export * from "./SortingOptions";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { ISearchPolicyChain } from "@/common/ISearchPolicyChain";
2
+ import { ISeoIndexabilityPolicy } from "@/common/ISeoIndexabilityPolicy";
3
+ import { ISeoInfoBase } from "@/common/ISeoInfoBase";
4
+ import { IFilterSelectionState } from "@/common/IFilterSelectionState";
5
+ import { ISearchApplicationState } from "@/common/ISearchApplicationState";
6
+ import { IFilterOptions } from "@/common/IFilterOptions";
7
+ export declare class SearchIndexabilityManager implements ISearchPolicyChain {
8
+ private readonly seoInfoBase;
9
+ private readonly filterState;
10
+ private readonly applicationState;
11
+ private readonly filterOptions;
12
+ constructor(seoInfoBase: ISeoInfoBase, filterState: IFilterSelectionState, applicationState: ISearchApplicationState, filterOptions: IFilterOptions);
13
+ policies: ISeoIndexabilityPolicy[];
14
+ shouldIndex(): Promise<boolean>;
15
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.SearchIndexabilityManager = void 0;
40
+ var AreaPolicy_1 = require("./policies/AreaPolicy");
41
+ var CountryPolicy_1 = require("./policies/CountryPolicy");
42
+ var DisciplineAreaPolicy_1 = require("./policies/DisciplineAreaPolicy");
43
+ var DisciplineCountryPolicy_1 = require("./policies/DisciplineCountryPolicy");
44
+ var DisciplinePolicy_1 = require("./policies/DisciplinePolicy");
45
+ var UniversityCountryPolicy_1 = require("./policies/UniversityCountryPolicy");
46
+ var UnfilteredPolicy_1 = require("./policies/UnfilteredPolicy");
47
+ var SearchIndexabilityManager = /** @class */ (function () {
48
+ function SearchIndexabilityManager(seoInfoBase, filterState, applicationState, filterOptions) {
49
+ this.seoInfoBase = seoInfoBase;
50
+ this.filterState = filterState;
51
+ this.applicationState = applicationState;
52
+ this.filterOptions = filterOptions;
53
+ this.policies = [
54
+ new AreaPolicy_1.AreaPolicy(this.seoInfoBase, this.filterState, this.filterOptions),
55
+ new CountryPolicy_1.CountryPolicy(this.seoInfoBase, this.filterState),
56
+ new DisciplineAreaPolicy_1.DisciplineAreaPolicy(this.seoInfoBase, this.filterState),
57
+ new DisciplineCountryPolicy_1.DisciplineCountryPolicy(this.seoInfoBase, this.filterState, this.applicationState),
58
+ new DisciplinePolicy_1.DisciplinePolicy(this.seoInfoBase, this.filterState),
59
+ new UniversityCountryPolicy_1.UniversityCountryPolicy(this.seoInfoBase, this.filterState),
60
+ new UnfilteredPolicy_1.UnfilteredPolicy(this.seoInfoBase, this.filterState)
61
+ ];
62
+ }
63
+ SearchIndexabilityManager.prototype.shouldIndex = function () {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ var results;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0: return [4 /*yield*/, Promise.all(this.policies.map(function (policy) { return policy.shouldIndex(); }))];
69
+ case 1:
70
+ results = _a.sent();
71
+ return [2 /*return*/, results.some(function (result) { return result; })];
72
+ }
73
+ });
74
+ });
75
+ };
76
+ return SearchIndexabilityManager;
77
+ }());
78
+ exports.SearchIndexabilityManager = SearchIndexabilityManager;
File without changes
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // export * from "./SearchIndexabilityManager";
3
+ // import { SearchIndexabilityManager } from "./SearchIndexabilityManager";
4
+ // export {
5
+ // SearchIndexabilityManager
6
+ // }
@@ -0,0 +1,15 @@
1
+ import { BaseSeoIndexabilityPolicy } from '@/common/BaseSeoIndexabilityPolicy';
2
+ import { IFilterSelectionState } from '@/common/IFilterSelectionState';
3
+ import { ISeoInfoBase } from '@/common/ISeoInfoBase';
4
+ import { ISeoIndexabilityPolicy } from '@/common/ISeoIndexabilityPolicy';
5
+ import { IFilterOptions } from '@/common/IFilterOptions';
6
+ export declare class AreaPolicy extends BaseSeoIndexabilityPolicy implements ISeoIndexabilityPolicy {
7
+ protected readonly seoInfoBase: ISeoInfoBase;
8
+ protected readonly filterState: IFilterSelectionState;
9
+ protected readonly filterOptions: IFilterOptions;
10
+ private static readonly AUSTRALIA_CODE;
11
+ constructor(seoInfoBase: ISeoInfoBase, filterState: IFilterSelectionState, filterOptions: IFilterOptions);
12
+ protected matchesFilters(): Promise<boolean>;
13
+ private isPartOfAustralia;
14
+ generatePaths(): string[];
15
+ }