@studyportals/domain-client 7.1.1-beta.0 → 7.1.1-beta.2
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/index.js +34 -81
- package/package.json +1 -1
- package/protobuf/Area.js +1 -4
- package/protobuf/Article.js +30 -33
- package/protobuf/Body.js +1 -4
- package/protobuf/CampaignInformation.js +1 -4
- package/protobuf/ClickTracking.js +1 -4
- package/protobuf/CommercialEntity.js +1 -4
- package/protobuf/Cover.js +1 -4
- package/protobuf/Deadline.js +1 -4
- package/protobuf/Degree.js +1 -4
- package/protobuf/Description.js +13 -16
- package/protobuf/Discipline.js +10 -13
- package/protobuf/Duration.js +1 -4
- package/protobuf/EnglishRequirement.js +1 -4
- package/protobuf/EssentialInformation.js +1 -4
- package/protobuf/File.js +3 -6
- package/protobuf/GPARequirement.js +1 -4
- package/protobuf/InternalLink.js +3 -6
- package/protobuf/Link.js +1 -4
- package/protobuf/LivingCost.js +1 -4
- package/protobuf/Location.js +8 -11
- package/protobuf/Logo.js +1 -4
- package/protobuf/MiniProgrammeCard.js +10 -13
- package/protobuf/OptionalLink.js +1 -4
- package/protobuf/Organisation.js +86 -89
- package/protobuf/OrganisationInformation.js +1 -4
- package/protobuf/OrganisationRanking.js +7 -10
- package/protobuf/Person.js +4 -7
- package/protobuf/ProgrammeCard.js +43 -46
- package/protobuf/ProgrammeGrid.js +9 -12
- package/protobuf/Ranking.js +6 -9
- package/protobuf/RankingInstitute.js +4 -7
- package/protobuf/Review.js +4 -7
- package/protobuf/ReviewRating.js +1 -4
- package/protobuf/RichText.js +1 -4
- package/protobuf/SocialLink.js +1 -4
- package/protobuf/StartDate.js +4 -7
- package/protobuf/Timing.js +7 -10
- package/protobuf/Topic.js +1 -4
- package/protobuf/TrackedLink.js +4 -7
- package/protobuf/Tracking.js +4 -7
- package/protobuf/TuitionFee.js +1 -4
- package/protobuf/Unibuddy.js +1 -4
- package/protobuf/index.js +42 -58
- package/src/clients/article-detail-page-client.js +4 -8
- package/src/clients/index.js +4 -20
- package/src/clients/organisation-page-client.js +4 -8
- package/src/clients/protobuf-client.js +3 -7
- package/src/clients/public-mini-programme-card-client.js +4 -8
- package/src/domain-client.js +9 -13
- package/src/exceptions/bad-request-exception.js +1 -5
- package/src/exceptions/client-exception.js +1 -5
- package/src/exceptions/internal-server-exception.js +1 -5
- package/src/exceptions/not-found-exception.js +1 -5
- package/src/exceptions/property-not-available-exception.js +1 -5
- package/src/factories/DateFactory.js +1 -5
- package/src/factories/InternalLinkFactory.js +1 -5
- package/src/i-api-response.js +1 -2
- package/src/i-class-factory.js +1 -2
- package/src/i-model-description.js +1 -4
- package/src/model-client.js +8 -12
- package/src/model-factory.js +10 -14
- package/src/models/bestfit-programme/bestfit-programme-client.js +2 -6
- package/src/models/bestfit-programme/i-best-fit-programme.js +1 -2
- package/src/models/bestfit-programme/i-city.js +1 -2
- package/src/models/bestfit-programme/i-living-cost.js +1 -2
- package/src/models/city-search-document/city-search-document-client.js +2 -6
- package/src/models/city-search-document/i-city-search-document.js +1 -2
- package/src/models/common/i-city.js +1 -2
- package/src/models/common/i-country.js +1 -2
- package/src/models/common/i-english-requirements.js +1 -2
- package/src/models/common/i-g-p-a-requirement.js +1 -2
- package/src/models/common/i-internal-link.js +1 -2
- package/src/models/common/i-logo.js +1 -2
- package/src/models/common/i-review-rating.js +1 -2
- package/src/models/common/i-tuition-fee.js +1 -2
- package/src/models/copilot-country/copilot-country-client.js +2 -6
- package/src/models/copilot-country/i-copilot-country.js +1 -2
- package/src/models/copilot-country/i-copilot-ranking-card.js +1 -2
- package/src/models/copilot-programme/copilot-programme-client.js +2 -6
- package/src/models/copilot-programme/i-copilot-programme.js +1 -2
- package/src/models/customerio-organisation/customerio-organisation-client.js +2 -6
- package/src/models/customerio-organisation/i-customer-io-organisation.js +1 -2
- package/src/models/customerio-organisation/i-review.js +1 -2
- package/src/models/customerio-programme/customerio-programme-client.js +2 -6
- package/src/models/customerio-programme/i-customer-io-programme.js +1 -2
- package/src/models/customerio-programme/i-internal-link.js +1 -2
- package/src/models/faq-static-content/i-faq-static-content.js +1 -2
- package/src/models/faq-static-content/i-faq.js +1 -2
- package/src/models/faq-static-content/i-static-content-url.js +1 -2
- package/src/models/faq-static-content/i-static-content.js +1 -2
- package/src/models/faq-static-content/public-faq-static-content-client.js +2 -6
- package/src/models/organisation-card/i-organisation-card.js +1 -2
- package/src/models/organisation-card/i-ranking-discipline.js +1 -2
- package/src/models/organisation-card/organisation-card-client.js +2 -6
- package/src/models/organisation-for-search/i-organisation-for-search.js +1 -2
- package/src/models/organisation-for-search/public-organisation-for-search-client.js +2 -6
- package/src/models/organisation-search-document/i-organisation-search-document.js +1 -2
- package/src/models/organisation-search-document/organisation-search-document-client.js +2 -6
- package/src/models/programme-card/i-click-tracking-data.js +1 -2
- package/src/models/programme-card/i-cover.js +1 -2
- package/src/models/programme-card/i-deadline.js +1 -2
- package/src/models/programme-card/i-duration.js +1 -2
- package/src/models/programme-card/i-internal-link.js +1 -2
- package/src/models/programme-card/i-link.js +1 -2
- package/src/models/programme-card/i-location.js +1 -2
- package/src/models/programme-card/i-logo.js +1 -2
- package/src/models/programme-card/i-optional-link.js +1 -2
- package/src/models/programme-card/i-programme-card.js +1 -2
- package/src/models/programme-card/i-start-date.js +1 -2
- package/src/models/programme-card/i-timing.js +1 -2
- package/src/models/programme-card/i-tracked-link.js +1 -2
- package/src/models/programme-card/i-tracking.js +1 -2
- package/src/models/programme-card/i-tuition-fee.js +1 -2
- package/src/models/programme-card/programme-card-client.js +2 -6
- package/src/models/ranking-cards/i-ranking.js +1 -2
- package/src/models/scholarship-card/i-scholarship-card-v2.js +1 -2
- package/src/models/scholarship-card/i-scholarship-card.js +1 -2
- package/src/models/scholarship-card/public-scholarship-card-client.js +2 -6
- package/src/models/scholarship-card/scholarship-card-v2-client.js +2 -6
- package/src/models/scholarship-search-document/i-scholarship-search-document.js +1 -2
- package/src/models/scholarship-search-document/scholarship-search-document-client.js +2 -6
- package/src/models/search-discipline/i-search-discipline.js +1 -2
- package/src/models/search-discipline/public-search-discipline-client.js +2 -6
- package/src/models/search-projection/i-geo-targeting-configuration.js +1 -2
- package/src/models/search-projection/i-geo-targeting-values.js +1 -2
- package/src/models/search-projection/i-organisation-values.js +1 -2
- package/src/models/search-projection/i-premium-values.js +1 -2
- package/src/models/search-projection/i-search-projection.js +1 -2
- package/src/models/search-projection/i-tuition-values.js +1 -2
- package/src/models/search-projection/search-projection-client.js +2 -6
- package/src/models/sitemap-articles-info/i-sitemap-article-info.js +1 -2
- package/src/models/sitemap-articles-info/sitemap-articles-info-client.js +2 -6
- package/src/models/sitemap-cities-info/i-sitemap-city-info.js +1 -2
- package/src/models/sitemap-cities-info/sitemap-cities-info-client.js +2 -6
- package/src/models/sitemap-countries-info/i-sitemap-country-info.js +1 -2
- package/src/models/sitemap-countries-info/sitemap-countries-info-client.js +2 -6
- package/src/models/sitemap-country-degree-info/i-degree-info.js +1 -2
- package/src/models/sitemap-country-degree-info/i-sitemap-country-degree-info.js +1 -2
- package/src/models/sitemap-country-degree-info/sitemap-country-degree-info-client.js +2 -6
- package/src/models/sitemap-disciplines-info/i-sitemap-discipline-info.js +1 -2
- package/src/models/sitemap-disciplines-info/sitemap-disciplines-info-client.js +2 -6
- package/src/models/sitemap-organisations-info/i-sitemap-organisation-info.js +1 -2
- package/src/models/sitemap-organisations-info/sitemap-organisations-info-client.js +2 -6
- package/src/models/sitemap-programme-info/i-sitemap-programme-info.js +1 -2
- package/src/models/sitemap-programme-info/sitemap-programme-info-client.js +2 -6
- package/src/models/sitemap-rankings-info/i-sitemap-rankings-info.js +1 -2
- package/src/models/sitemap-rankings-info/sitemap-rankings-info-client.js +2 -6
- package/src/types/portal-map.js +1 -2
- package/src/types/portal-type.js +2 -5
- package/src/types.js +1 -2
package/protobuf/index.js
CHANGED
|
@@ -1,61 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @file Automatically generated by barrelsby.
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
__exportStar(require("./ProgrammeCard.js"), exports);
|
|
48
|
-
__exportStar(require("./ProgrammeGrid.js"), exports);
|
|
49
|
-
__exportStar(require("./Ranking.js"), exports);
|
|
50
|
-
__exportStar(require("./RankingInstitute.js"), exports);
|
|
51
|
-
__exportStar(require("./Review.js"), exports);
|
|
52
|
-
__exportStar(require("./ReviewRating.js"), exports);
|
|
53
|
-
__exportStar(require("./RichText.js"), exports);
|
|
54
|
-
__exportStar(require("./SocialLink.js"), exports);
|
|
55
|
-
__exportStar(require("./StartDate.js"), exports);
|
|
56
|
-
__exportStar(require("./Timing.js"), exports);
|
|
57
|
-
__exportStar(require("./Topic.js"), exports);
|
|
58
|
-
__exportStar(require("./TrackedLink.js"), exports);
|
|
59
|
-
__exportStar(require("./Tracking.js"), exports);
|
|
60
|
-
__exportStar(require("./TuitionFee.js"), exports);
|
|
61
|
-
__exportStar(require("./Unibuddy.js"), exports);
|
|
4
|
+
export * from "./Area.js";
|
|
5
|
+
export * from "./Article.js";
|
|
6
|
+
export * from "./Body.js";
|
|
7
|
+
export * from "./CampaignInformation.js";
|
|
8
|
+
export * from "./ClickTracking.js";
|
|
9
|
+
export * from "./CommercialEntity.js";
|
|
10
|
+
export * from "./Cover.js";
|
|
11
|
+
export * from "./Deadline.js";
|
|
12
|
+
export * from "./Degree.js";
|
|
13
|
+
export * from "./Description.js";
|
|
14
|
+
export * from "./Discipline.js";
|
|
15
|
+
export * from "./Duration.js";
|
|
16
|
+
export * from "./EnglishRequirement.js";
|
|
17
|
+
export * from "./EssentialInformation.js";
|
|
18
|
+
export * from "./File.js";
|
|
19
|
+
export * from "./GPARequirement.js";
|
|
20
|
+
export * from "./InternalLink.js";
|
|
21
|
+
export * from "./Link.js";
|
|
22
|
+
export * from "./LivingCost.js";
|
|
23
|
+
export * from "./Location.js";
|
|
24
|
+
export * from "./Logo.js";
|
|
25
|
+
export * from "./MiniProgrammeCard.js";
|
|
26
|
+
export * from "./OptionalLink.js";
|
|
27
|
+
export * from "./Organisation.js";
|
|
28
|
+
export * from "./OrganisationInformation.js";
|
|
29
|
+
export * from "./OrganisationRanking.js";
|
|
30
|
+
export * from "./Person.js";
|
|
31
|
+
export * from "./ProgrammeCard.js";
|
|
32
|
+
export * from "./ProgrammeGrid.js";
|
|
33
|
+
export * from "./Ranking.js";
|
|
34
|
+
export * from "./RankingInstitute.js";
|
|
35
|
+
export * from "./Review.js";
|
|
36
|
+
export * from "./ReviewRating.js";
|
|
37
|
+
export * from "./RichText.js";
|
|
38
|
+
export * from "./SocialLink.js";
|
|
39
|
+
export * from "./StartDate.js";
|
|
40
|
+
export * from "./Timing.js";
|
|
41
|
+
export * from "./Topic.js";
|
|
42
|
+
export * from "./TrackedLink.js";
|
|
43
|
+
export * from "./Tracking.js";
|
|
44
|
+
export * from "./TuitionFee.js";
|
|
45
|
+
export * from "./Unibuddy.js";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const protobuf_1 = require("../../protobuf/index.js");
|
|
5
|
-
const protobuf_client_1 = require("./protobuf-client.js");
|
|
6
|
-
class ArticleDetailPageClient extends protobuf_client_1.ProtobufClient {
|
|
1
|
+
import { Article } from "../../protobuf/index.js";
|
|
2
|
+
import { ProtobufClient } from "./protobuf-client.js";
|
|
3
|
+
export class ArticleDetailPageClient extends ProtobufClient {
|
|
7
4
|
constructModel(data) {
|
|
8
|
-
return
|
|
5
|
+
return Article.fromJSON(data);
|
|
9
6
|
}
|
|
10
7
|
getModelName() {
|
|
11
8
|
return 'article-detail-page';
|
|
@@ -17,4 +14,3 @@ class ArticleDetailPageClient extends protobuf_client_1.ProtobufClient {
|
|
|
17
14
|
return false;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.ArticleDetailPageClient = ArticleDetailPageClient;
|
package/src/clients/index.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @file Automatically generated by barrelsby.
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("./article-detail-page-client.js"), exports);
|
|
21
|
-
__exportStar(require("./organisation-page-client.js"), exports);
|
|
22
|
-
__exportStar(require("./protobuf-client.js"), exports);
|
|
23
|
-
__exportStar(require("./public-mini-programme-card-client.js"), exports);
|
|
4
|
+
export * from "./article-detail-page-client.js";
|
|
5
|
+
export * from "./organisation-page-client.js";
|
|
6
|
+
export * from "./protobuf-client.js";
|
|
7
|
+
export * from "./public-mini-programme-card-client.js";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const protobuf_1 = require("../../protobuf/index.js");
|
|
5
|
-
const protobuf_client_1 = require("./protobuf-client.js");
|
|
6
|
-
class OrganisationPageClient extends protobuf_client_1.ProtobufClient {
|
|
1
|
+
import { Organisation } from "../../protobuf/index.js";
|
|
2
|
+
import { ProtobufClient } from "./protobuf-client.js";
|
|
3
|
+
export class OrganisationPageClient extends ProtobufClient {
|
|
7
4
|
constructModel(data) {
|
|
8
|
-
return
|
|
5
|
+
return Organisation.fromJSON(data);
|
|
9
6
|
}
|
|
10
7
|
getModelName() {
|
|
11
8
|
return 'organisation-page';
|
|
@@ -17,4 +14,3 @@ class OrganisationPageClient extends protobuf_client_1.ProtobufClient {
|
|
|
17
14
|
return false;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.OrganisationPageClient = OrganisationPageClient;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ProtobufClient = void 0;
|
|
4
|
-
const domain_client_1 = require("../domain-client.js");
|
|
5
|
-
class ProtobufClient {
|
|
1
|
+
import { DomainClient } from "../domain-client.js";
|
|
2
|
+
export class ProtobufClient {
|
|
6
3
|
static portalMap = new Map();
|
|
7
4
|
domainClient;
|
|
8
5
|
constructor(baseUrl, seed, apiKey, portalMap) {
|
|
9
6
|
if (portalMap) {
|
|
10
7
|
ProtobufClient.portalMap = portalMap;
|
|
11
8
|
}
|
|
12
|
-
this.domainClient = new
|
|
9
|
+
this.domainClient = new DomainClient(baseUrl, apiKey, this.getModelName(), this.getVersion(), this.isPublic(), seed);
|
|
13
10
|
}
|
|
14
11
|
async fetch(id) {
|
|
15
12
|
const results = await this.domainClient.doRequest([id]);
|
|
@@ -27,4 +24,3 @@ class ProtobufClient {
|
|
|
27
24
|
return path;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.ProtobufClient = ProtobufClient;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const protobuf_1 = require("../../protobuf/index.js");
|
|
5
|
-
const protobuf_client_1 = require("./protobuf-client.js");
|
|
6
|
-
class PublicMiniProgrammeCardClient extends protobuf_client_1.ProtobufClient {
|
|
1
|
+
import { MiniProgrammeCard } from "../../protobuf/index.js";
|
|
2
|
+
import { ProtobufClient } from "./protobuf-client.js";
|
|
3
|
+
export class PublicMiniProgrammeCardClient extends ProtobufClient {
|
|
7
4
|
constructModel(data) {
|
|
8
|
-
return
|
|
5
|
+
return MiniProgrammeCard.fromJSON(data);
|
|
9
6
|
}
|
|
10
7
|
getModelName() {
|
|
11
8
|
return 'mini-programme-card';
|
|
@@ -17,4 +14,3 @@ class PublicMiniProgrammeCardClient extends protobuf_client_1.ProtobufClient {
|
|
|
17
14
|
return true;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.PublicMiniProgrammeCardClient = PublicMiniProgrammeCardClient;
|
package/src/domain-client.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const bad_request_exception_1 = require("./exceptions/bad-request-exception.js");
|
|
5
|
-
const internal_server_exception_1 = require("./exceptions/internal-server-exception.js");
|
|
6
|
-
const not_found_exception_1 = require("./exceptions/not-found-exception.js");
|
|
1
|
+
import { BadRequestException } from "./exceptions/bad-request-exception.js";
|
|
2
|
+
import { InternalServerException } from "./exceptions/internal-server-exception.js";
|
|
3
|
+
import { NotFoundException } from "./exceptions/not-found-exception.js";
|
|
7
4
|
const decoder = new TextDecoder();
|
|
8
|
-
class DomainClient {
|
|
5
|
+
export class DomainClient {
|
|
9
6
|
baseUrl;
|
|
10
7
|
apiKey;
|
|
11
8
|
model;
|
|
@@ -55,10 +52,10 @@ class DomainClient {
|
|
|
55
52
|
}
|
|
56
53
|
catch (error) {
|
|
57
54
|
console.error('Error fetching data from API:', error);
|
|
58
|
-
if (error instanceof
|
|
55
|
+
if (error instanceof InternalServerException || error instanceof BadRequestException || error instanceof NotFoundException) {
|
|
59
56
|
throw error;
|
|
60
57
|
}
|
|
61
|
-
throw new
|
|
58
|
+
throw new InternalServerException('Unable to fetch data from the API', error);
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
61
|
async decompressModelData(compressedData) {
|
|
@@ -71,13 +68,13 @@ class DomainClient {
|
|
|
71
68
|
}
|
|
72
69
|
handleErrors(response) {
|
|
73
70
|
if (!response.status) {
|
|
74
|
-
throw new
|
|
71
|
+
throw new InternalServerException(response.message);
|
|
75
72
|
}
|
|
76
73
|
if (response.status === 400) {
|
|
77
|
-
throw new
|
|
74
|
+
throw new BadRequestException(response.message);
|
|
78
75
|
}
|
|
79
76
|
if (response.status === 404) {
|
|
80
|
-
throw new
|
|
77
|
+
throw new NotFoundException(response.message);
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
buildUrl(ids) {
|
|
@@ -92,4 +89,3 @@ class DomainClient {
|
|
|
92
89
|
return this.isPublic && this.apiKey === undefined;
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
|
-
exports.DomainClient = DomainClient;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BadRequestException = void 0;
|
|
4
|
-
class BadRequestException extends Error {
|
|
1
|
+
export class BadRequestException extends Error {
|
|
5
2
|
}
|
|
6
|
-
exports.BadRequestException = BadRequestException;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternalServerException = void 0;
|
|
4
|
-
class InternalServerException extends Error {
|
|
1
|
+
export class InternalServerException extends Error {
|
|
5
2
|
}
|
|
6
|
-
exports.InternalServerException = InternalServerException;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropertyNotAvailableException = void 0;
|
|
4
|
-
class PropertyNotAvailableException extends Error {
|
|
1
|
+
export class PropertyNotAvailableException extends Error {
|
|
5
2
|
}
|
|
6
|
-
exports.PropertyNotAvailableException = PropertyNotAvailableException;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateFactory = void 0;
|
|
4
|
-
class DateFactory {
|
|
1
|
+
export class DateFactory {
|
|
5
2
|
create(data, parameters) {
|
|
6
3
|
return new Date(parameters[0]);
|
|
7
4
|
}
|
|
8
5
|
}
|
|
9
|
-
exports.DateFactory = DateFactory;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternalLinkFactory = void 0;
|
|
4
|
-
class InternalLinkFactory {
|
|
1
|
+
export class InternalLinkFactory {
|
|
5
2
|
portalMap;
|
|
6
3
|
constructor(portalMap) {
|
|
7
4
|
this.portalMap = portalMap;
|
|
@@ -23,4 +20,3 @@ class InternalLinkFactory {
|
|
|
23
20
|
return url || '';
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
exports.InternalLinkFactory = InternalLinkFactory;
|
package/src/i-api-response.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/src/i-class-factory.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isModelDescription = isModelDescription;
|
|
4
1
|
// eslint-disable-next-line
|
|
5
|
-
function isModelDescription(arg) {
|
|
2
|
+
export function isModelDescription(arg) {
|
|
6
3
|
// eslint-disable-next-line
|
|
7
4
|
return arg && arg.class && (arg.func || arg.parameters);
|
|
8
5
|
}
|
package/src/model-client.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const client_exception_1 = require("./exceptions/client-exception.js");
|
|
6
|
-
const model_factory_1 = require("./model-factory.js");
|
|
7
|
-
class ModelClient {
|
|
1
|
+
import { DomainClient } from "./domain-client.js";
|
|
2
|
+
import { ClientException } from "./exceptions/client-exception.js";
|
|
3
|
+
import { ModelFactory } from "./model-factory.js";
|
|
4
|
+
export class ModelClient {
|
|
8
5
|
domainClient;
|
|
9
6
|
modelFactory;
|
|
10
7
|
constructor(baseUrl, apiKey, seed, portalMap) {
|
|
11
8
|
if (!baseUrl || !seed) {
|
|
12
9
|
return;
|
|
13
10
|
}
|
|
14
|
-
this.modelFactory = new
|
|
15
|
-
this.domainClient = new
|
|
11
|
+
this.modelFactory = new ModelFactory(portalMap);
|
|
12
|
+
this.domainClient = new DomainClient(baseUrl, apiKey, this.getModelName(), this.getVersion(), this.isPublic(), seed);
|
|
16
13
|
}
|
|
17
14
|
async fetch(id) {
|
|
18
15
|
const modelDescriptions = await this.fetchDescription(id);
|
|
@@ -20,7 +17,7 @@ class ModelClient {
|
|
|
20
17
|
}
|
|
21
18
|
async fetchDescription(id) {
|
|
22
19
|
if (!this.domainClient) {
|
|
23
|
-
throw new
|
|
20
|
+
throw new ClientException("Offline mode active: did you provide all parameters " +
|
|
24
21
|
"in the constructor?");
|
|
25
22
|
}
|
|
26
23
|
const result = await this.domainClient.doRequest([id]);
|
|
@@ -32,7 +29,7 @@ class ModelClient {
|
|
|
32
29
|
}
|
|
33
30
|
async fetchMultipleDescriptions(ids) {
|
|
34
31
|
if (!this.domainClient) {
|
|
35
|
-
throw new
|
|
32
|
+
throw new ClientException('Offline mode active: did you provide all parameters ' +
|
|
36
33
|
'in the constructor?');
|
|
37
34
|
}
|
|
38
35
|
return await this.domainClient.doRequest(ids);
|
|
@@ -44,4 +41,3 @@ class ModelClient {
|
|
|
44
41
|
return this.modelFactory.fromDescriptions(descriptions);
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
exports.ModelClient = ModelClient;
|
package/src/model-factory.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const i_model_description_1 = require("./i-model-description.js");
|
|
7
|
-
const property_not_available_exception_1 = require("./exceptions/property-not-available-exception.js");
|
|
8
|
-
class ModelFactory {
|
|
1
|
+
import { InternalLinkFactory } from "./factories/InternalLinkFactory.js";
|
|
2
|
+
import { DateFactory } from "./factories/DateFactory.js";
|
|
3
|
+
import { isModelDescription } from "./i-model-description.js";
|
|
4
|
+
import { PropertyNotAvailableException } from "./exceptions/property-not-available-exception.js";
|
|
5
|
+
export class ModelFactory {
|
|
9
6
|
customClassFactories;
|
|
10
7
|
constructor(portalMap = new Map()) {
|
|
11
8
|
const factories = new Map();
|
|
12
|
-
factories.set('IInternalLink', new
|
|
13
|
-
factories.set('SerializableDateTime', new
|
|
9
|
+
factories.set('IInternalLink', new InternalLinkFactory(portalMap));
|
|
10
|
+
factories.set('SerializableDateTime', new DateFactory());
|
|
14
11
|
this.customClassFactories = factories;
|
|
15
12
|
}
|
|
16
13
|
fromDescription(data) {
|
|
@@ -39,7 +36,7 @@ class ModelFactory {
|
|
|
39
36
|
const canShowFunction = 'canShow' + propertyName;
|
|
40
37
|
const value = data.func[functionName];
|
|
41
38
|
let returnValue;
|
|
42
|
-
if (
|
|
39
|
+
if (isModelDescription(value)) {
|
|
43
40
|
returnValue = this.unpackClass(value);
|
|
44
41
|
}
|
|
45
42
|
else if (Array.isArray(value)) {
|
|
@@ -51,7 +48,7 @@ class ModelFactory {
|
|
|
51
48
|
if (canShowFunction in data.func) {
|
|
52
49
|
return () => {
|
|
53
50
|
if (data.func[canShowFunction] === false) {
|
|
54
|
-
throw new
|
|
51
|
+
throw new PropertyNotAvailableException(`Property '${propertyName}' not available`);
|
|
55
52
|
}
|
|
56
53
|
return returnValue;
|
|
57
54
|
};
|
|
@@ -62,11 +59,10 @@ class ModelFactory {
|
|
|
62
59
|
}
|
|
63
60
|
unpackArray(list) {
|
|
64
61
|
return list.map(item => {
|
|
65
|
-
if (
|
|
62
|
+
if (isModelDescription(item)) {
|
|
66
63
|
return this.unpackClass(item);
|
|
67
64
|
}
|
|
68
65
|
return item;
|
|
69
66
|
});
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
|
-
exports.ModelFactory = ModelFactory;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.BestfitProgrammeClient = void 0;
|
|
4
|
-
const model_client_1 = require("../../model-client.js");
|
|
5
|
-
class BestfitProgrammeClient extends model_client_1.ModelClient {
|
|
1
|
+
import { ModelClient } from "../../model-client.js";
|
|
2
|
+
export class BestfitProgrammeClient extends ModelClient {
|
|
6
3
|
getModelName() {
|
|
7
4
|
return 'bestfit-programme';
|
|
8
5
|
}
|
|
@@ -13,4 +10,3 @@ class BestfitProgrammeClient extends model_client_1.ModelClient {
|
|
|
13
10
|
return false;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.BestfitProgrammeClient = BestfitProgrammeClient;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CitySearchDocumentClient = void 0;
|
|
4
|
-
const model_client_1 = require("../../model-client.js");
|
|
5
|
-
class CitySearchDocumentClient extends model_client_1.ModelClient {
|
|
1
|
+
import { ModelClient } from "../../model-client.js";
|
|
2
|
+
export class CitySearchDocumentClient extends ModelClient {
|
|
6
3
|
getModelName() {
|
|
7
4
|
return 'city-search-document';
|
|
8
5
|
}
|
|
@@ -13,4 +10,3 @@ class CitySearchDocumentClient extends model_client_1.ModelClient {
|
|
|
13
10
|
return false;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.CitySearchDocumentClient = CitySearchDocumentClient;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CopilotCountryClient = void 0;
|
|
4
|
-
const model_client_1 = require("../../model-client.js");
|
|
5
|
-
class CopilotCountryClient extends model_client_1.ModelClient {
|
|
1
|
+
import { ModelClient } from "../../model-client.js";
|
|
2
|
+
export class CopilotCountryClient extends ModelClient {
|
|
6
3
|
getModelName() {
|
|
7
4
|
return 'copilot-country';
|
|
8
5
|
}
|
|
@@ -13,4 +10,3 @@ class CopilotCountryClient extends model_client_1.ModelClient {
|
|
|
13
10
|
return false;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.CopilotCountryClient = CopilotCountryClient;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CopilotProgrammeClient = void 0;
|
|
4
|
-
const model_client_1 = require("../../model-client.js");
|
|
5
|
-
class CopilotProgrammeClient extends model_client_1.ModelClient {
|
|
1
|
+
import { ModelClient } from "../../model-client.js";
|
|
2
|
+
export class CopilotProgrammeClient extends ModelClient {
|
|
6
3
|
getModelName() {
|
|
7
4
|
return 'copilot-programme';
|
|
8
5
|
}
|
|
@@ -13,4 +10,3 @@ class CopilotProgrammeClient extends model_client_1.ModelClient {
|
|
|
13
10
|
return false;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.CopilotProgrammeClient = CopilotProgrammeClient;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|