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