@studyportals/domain-client 5.4.4-beta.5 → 5.5.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.
- package/index.d.ts +83 -85
- package/index.js +63 -63
- package/index.js.map +1 -1
- package/package.json +55 -55
- package/src/domain-client.d.ts +14 -14
- package/src/domain-client.js +60 -60
- package/src/exceptions/bad-request-exception.d.ts +2 -2
- package/src/exceptions/bad-request-exception.js +6 -6
- package/src/exceptions/client-exception.d.ts +2 -2
- package/src/exceptions/client-exception.js +6 -6
- package/src/exceptions/internal-server-exception.d.ts +2 -2
- package/src/exceptions/internal-server-exception.js +6 -6
- package/src/exceptions/not-found-exception.d.ts +2 -2
- package/src/exceptions/not-found-exception.js +6 -6
- package/src/exceptions/property-not-available-exception.d.ts +2 -2
- package/src/exceptions/property-not-available-exception.js +6 -6
- package/src/factories/DateFactory.d.ts +5 -5
- package/src/factories/DateFactory.js +9 -9
- package/src/factories/InternalLinkFactory.d.ts +9 -9
- package/src/factories/InternalLinkFactory.js +19 -19
- package/src/i-api-response.d.ts +6 -6
- package/src/i-api-response.js +2 -2
- package/src/i-class-factory.d.ts +4 -4
- package/src/i-class-factory.js +2 -2
- package/src/i-model-description.d.ts +7 -7
- package/src/i-model-description.js +9 -9
- package/src/model-client.d.ts +16 -16
- package/src/model-client.js +45 -45
- package/src/model-factory.d.ts +11 -11
- package/src/model-factory.js +71 -71
- package/src/models/bestfit-programme/bestfit-programme-client.d.ts +7 -7
- package/src/models/bestfit-programme/bestfit-programme-client.js +16 -16
- package/src/models/bestfit-programme/i-best-fit-programme.d.ts +82 -82
- package/src/models/bestfit-programme/i-best-fit-programme.js +2 -2
- package/src/models/bestfit-programme/i-city.d.ts +14 -14
- package/src/models/bestfit-programme/i-city.js +2 -2
- package/src/models/bestfit-programme/i-living-cost.d.ts +20 -20
- package/src/models/bestfit-programme/i-living-cost.js +2 -2
- package/src/models/common/i-city.d.ts +14 -14
- package/src/models/common/i-city.js +2 -2
- package/src/models/common/i-country.d.ts +20 -20
- package/src/models/common/i-country.js +2 -2
- package/src/models/common/i-english-requirements.d.ts +51 -51
- package/src/models/common/i-english-requirements.js +2 -2
- package/src/models/common/i-g-p-a-requirement.d.ts +20 -20
- package/src/models/common/i-g-p-a-requirement.js +2 -2
- package/src/models/common/i-internal-link.d.ts +28 -28
- package/src/models/common/i-internal-link.js +2 -2
- package/src/models/common/i-logo.d.ts +14 -14
- package/src/models/common/i-logo.js +2 -2
- package/src/models/common/i-tuition-fee.d.ts +50 -50
- package/src/models/common/i-tuition-fee.js +2 -2
- package/src/models/copilot-country/copilot-country-client.d.ts +7 -7
- package/src/models/copilot-country/copilot-country-client.js +16 -16
- package/src/models/copilot-country/i-copilot-country.d.ts +39 -39
- package/src/models/copilot-country/i-copilot-country.js +2 -2
- package/src/models/copilot-country/i-copilot-ranking-card.d.ts +38 -38
- package/src/models/copilot-country/i-copilot-ranking-card.js +2 -2
- package/src/models/copilot-programme/copilot-programme-client.d.ts +7 -7
- package/src/models/copilot-programme/copilot-programme-client.js +16 -16
- package/src/models/copilot-programme/i-copilot-programme.d.ts +125 -125
- package/src/models/copilot-programme/i-copilot-programme.js +2 -2
- package/src/models/customerio-organisation/customerio-organisation-client.d.ts +7 -7
- package/src/models/customerio-organisation/customerio-organisation-client.js +16 -16
- package/src/models/customerio-organisation/i-customer-io-organisation.d.ts +35 -35
- package/src/models/customerio-organisation/i-customer-io-organisation.js +2 -2
- package/src/models/customerio-organisation/i-review.d.ts +7 -7
- package/src/models/customerio-organisation/i-review.js +2 -2
- package/src/models/customerio-programme/customerio-programme-client.d.ts +7 -7
- package/src/models/customerio-programme/customerio-programme-client.js +16 -16
- package/src/models/customerio-programme/i-customer-io-programme.d.ts +107 -107
- package/src/models/customerio-programme/i-customer-io-programme.js +2 -2
- package/src/models/customerio-programme/i-internal-link.d.ts +28 -28
- package/src/models/customerio-programme/i-internal-link.js +2 -2
- package/src/models/faq-static-content/i-faq-static-content.d.ts +9 -9
- package/src/models/faq-static-content/i-faq-static-content.js +2 -2
- package/src/models/faq-static-content/i-faq.d.ts +4 -4
- package/src/models/faq-static-content/i-faq.js +2 -2
- package/src/models/faq-static-content/i-static-content-url.d.ts +4 -4
- package/src/models/faq-static-content/i-static-content-url.js +2 -2
- package/src/models/faq-static-content/public-faq-static-content-client.d.ts +7 -7
- package/src/models/faq-static-content/public-faq-static-content-client.js +16 -16
- package/src/models/organisation-card/i-organisation-card.d.ts +36 -36
- package/src/models/organisation-card/i-organisation-card.js +2 -2
- package/src/models/organisation-card/i-ranking-discipline.d.ts +4 -4
- package/src/models/organisation-card/i-ranking-discipline.js +2 -2
- package/src/models/organisation-card/organisation-card-client.d.ts +7 -7
- package/src/models/organisation-card/organisation-card-client.js +16 -16
- package/src/models/organisation-for-search/i-organisation-for-search.d.ts +32 -32
- package/src/models/organisation-for-search/i-organisation-for-search.js +2 -2
- package/src/models/organisation-for-search/public-organisation-for-search-client.d.ts +7 -7
- package/src/models/organisation-for-search/public-organisation-for-search-client.js +16 -16
- package/src/models/organisation-search-document/i-organisation-search-document.d.ts +122 -122
- package/src/models/organisation-search-document/i-organisation-search-document.js +2 -2
- package/src/models/organisation-search-document/organisation-search-document-client.d.ts +7 -7
- package/src/models/organisation-search-document/organisation-search-document-client.js +16 -16
- package/src/models/programme-card/i-click-tracking-data.d.ts +5 -5
- package/src/models/programme-card/i-click-tracking-data.js +2 -2
- package/src/models/programme-card/i-cover.d.ts +14 -14
- package/src/models/programme-card/i-cover.js +2 -2
- package/src/models/programme-card/i-deadline.d.ts +20 -20
- package/src/models/programme-card/i-deadline.js +2 -2
- package/src/models/programme-card/i-duration.d.ts +40 -40
- package/src/models/programme-card/i-duration.js +2 -2
- package/src/models/programme-card/i-internal-link.d.ts +28 -28
- package/src/models/programme-card/i-internal-link.js +2 -2
- package/src/models/programme-card/i-link.d.ts +22 -22
- package/src/models/programme-card/i-link.js +2 -2
- package/src/models/programme-card/i-location.d.ts +12 -12
- package/src/models/programme-card/i-location.js +2 -2
- package/src/models/programme-card/i-logo.d.ts +14 -14
- package/src/models/programme-card/i-logo.js +2 -2
- package/src/models/programme-card/i-optional-link.d.ts +23 -23
- package/src/models/programme-card/i-optional-link.js +2 -2
- package/src/models/programme-card/i-programme-card.d.ts +205 -205
- package/src/models/programme-card/i-programme-card.js +2 -2
- package/src/models/programme-card/i-start-date.d.ts +33 -33
- package/src/models/programme-card/i-start-date.js +2 -2
- package/src/models/programme-card/i-timing.d.ts +45 -45
- package/src/models/programme-card/i-timing.js +2 -2
- package/src/models/programme-card/i-tracked-link.d.ts +29 -29
- package/src/models/programme-card/i-tracked-link.js +2 -2
- package/src/models/programme-card/i-tracking.d.ts +46 -46
- package/src/models/programme-card/i-tracking.js +2 -2
- package/src/models/programme-card/i-tuition-fee.d.ts +50 -50
- package/src/models/programme-card/i-tuition-fee.js +2 -2
- package/src/models/programme-card/programme-card-client.d.ts +7 -7
- package/src/models/programme-card/programme-card-client.js +16 -16
- package/src/models/ranking-cards/i-ranking.d.ts +18 -18
- package/src/models/ranking-cards/i-ranking.js +2 -2
- package/src/models/scholarship-card/i-scholarship-card.d.ts +15 -15
- package/src/models/scholarship-card/i-scholarship-card.js +2 -2
- package/src/models/scholarship-card/public-scholarship-card-client.d.ts +7 -7
- package/src/models/scholarship-card/public-scholarship-card-client.js +16 -16
- package/src/models/scholarship-card/{public-scholarship-card-v2-client.d.ts → scholarship-card-v2-client.d.ts} +7 -7
- package/src/models/scholarship-card/scholarship-card-v2-client.js +17 -0
- package/src/models/scholarship-card/scholarship-card-v2-client.js.map +1 -0
- package/src/models/scholarship-search-document/i-scholarship-search-document.d.ts +38 -38
- package/src/models/scholarship-search-document/i-scholarship-search-document.js +2 -2
- package/src/models/scholarship-search-document/scholarship-search-document-client.d.ts +7 -7
- package/src/models/scholarship-search-document/scholarship-search-document-client.js +16 -16
- package/src/models/search-discipline/i-search-discipline.d.ts +26 -26
- package/src/models/search-discipline/i-search-discipline.js +2 -2
- package/src/models/search-discipline/public-search-discipline-client.d.ts +7 -7
- package/src/models/search-discipline/public-search-discipline-client.js +16 -16
- package/src/models/search-projection/i-geo-targeting-configuration.d.ts +38 -38
- package/src/models/search-projection/i-geo-targeting-configuration.js +2 -2
- package/src/models/search-projection/i-geo-targeting-values.d.ts +30 -30
- package/src/models/search-projection/i-geo-targeting-values.js +2 -2
- package/src/models/search-projection/i-organisation-values.d.ts +46 -46
- package/src/models/search-projection/i-organisation-values.js +2 -2
- package/src/models/search-projection/i-premium-values.d.ts +35 -35
- package/src/models/search-projection/i-premium-values.js +2 -2
- package/src/models/search-projection/i-search-projection.d.ts +186 -186
- package/src/models/search-projection/i-search-projection.js +2 -2
- package/src/models/search-projection/i-tuition-values.d.ts +50 -50
- package/src/models/search-projection/i-tuition-values.js +2 -2
- package/src/models/search-projection/search-projection-client.d.ts +7 -7
- package/src/models/search-projection/search-projection-client.js +16 -16
- package/src/models/sitemap-articles-info/i-sitemap-article-info.d.ts +26 -26
- package/src/models/sitemap-articles-info/i-sitemap-article-info.js +2 -2
- package/src/models/sitemap-articles-info/sitemap-articles-info-client.d.ts +7 -7
- package/src/models/sitemap-articles-info/sitemap-articles-info-client.js +16 -16
- package/src/models/sitemap-cities-info/i-sitemap-city-info.d.ts +14 -14
- package/src/models/sitemap-cities-info/i-sitemap-city-info.js +2 -2
- package/src/models/sitemap-cities-info/sitemap-cities-info-client.d.ts +7 -7
- package/src/models/sitemap-cities-info/sitemap-cities-info-client.js +16 -16
- package/src/models/sitemap-countries-info/i-sitemap-country-info.d.ts +14 -14
- package/src/models/sitemap-countries-info/i-sitemap-country-info.js +2 -2
- package/src/models/sitemap-countries-info/sitemap-countries-info-client.d.ts +7 -7
- package/src/models/sitemap-countries-info/sitemap-countries-info-client.js +16 -16
- package/src/models/sitemap-country-degree-info/i-degree-info.d.ts +14 -14
- package/src/models/sitemap-country-degree-info/i-degree-info.js +2 -2
- package/src/models/sitemap-country-degree-info/i-sitemap-country-degree-info.d.ts +11 -11
- package/src/models/sitemap-country-degree-info/i-sitemap-country-degree-info.js +2 -2
- package/src/models/sitemap-country-degree-info/sitemap-country-degree-info-client.d.ts +7 -7
- package/src/models/sitemap-country-degree-info/sitemap-country-degree-info-client.js +16 -16
- package/src/models/sitemap-disciplines-info/i-sitemap-discipline-info.d.ts +14 -14
- package/src/models/sitemap-disciplines-info/i-sitemap-discipline-info.js +2 -2
- package/src/models/sitemap-disciplines-info/sitemap-disciplines-info-client.d.ts +7 -7
- package/src/models/sitemap-disciplines-info/sitemap-disciplines-info-client.js +16 -16
- package/src/models/sitemap-organisations-info/i-sitemap-organisation-info.d.ts +26 -26
- package/src/models/sitemap-organisations-info/i-sitemap-organisation-info.js +2 -2
- package/src/models/sitemap-organisations-info/sitemap-organisations-info-client.d.ts +7 -7
- package/src/models/sitemap-organisations-info/sitemap-organisations-info-client.js +16 -16
- package/src/models/sitemap-programme-info/i-sitemap-programme-info.d.ts +26 -26
- package/src/models/sitemap-programme-info/i-sitemap-programme-info.js +2 -2
- package/src/models/sitemap-programme-info/sitemap-programme-info-client.d.ts +7 -7
- package/src/models/sitemap-programme-info/sitemap-programme-info-client.js +16 -16
- package/src/models/sitemap-rankings-info/i-sitemap-rankings-info.d.ts +14 -14
- package/src/models/sitemap-rankings-info/i-sitemap-rankings-info.js +2 -2
- package/src/models/sitemap-rankings-info/sitemap-rankings-info-client.d.ts +7 -7
- package/src/models/sitemap-rankings-info/sitemap-rankings-info-client.js +16 -16
- package/src/types/portal-map.d.ts +2 -2
- package/src/types/portal-map.js +2 -2
- package/src/types/portal-type.d.ts +7 -7
- package/src/types/portal-type.js +11 -11
- package/src/types.d.ts +4 -4
- package/src/types.js +2 -2
- package/src/models/scholarship-card/public-scholarship-card-v2-client.js +0 -17
- package/src/models/scholarship-card/public-scholarship-card-v2-client.js.map +0 -1
package/src/domain-client.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DomainClient = void 0;
|
|
4
|
-
const axios_1 = require("axios");
|
|
5
|
-
const bad_request_exception_1 = require("./exceptions/bad-request-exception");
|
|
6
|
-
const internal_server_exception_1 = require("./exceptions/internal-server-exception");
|
|
7
|
-
const not_found_exception_1 = require("./exceptions/not-found-exception");
|
|
8
|
-
class DomainClient {
|
|
9
|
-
constructor(baseUrl, apiKey, model, version, isPublic, seed) {
|
|
10
|
-
this.baseUrl = baseUrl;
|
|
11
|
-
this.apiKey = apiKey;
|
|
12
|
-
this.model = model;
|
|
13
|
-
this.version = version;
|
|
14
|
-
this.isPublic = isPublic;
|
|
15
|
-
this.seed = seed;
|
|
16
|
-
}
|
|
17
|
-
async doRequest(ids) {
|
|
18
|
-
const url = this.buildUrl(ids);
|
|
19
|
-
const config = { baseURL: this.baseUrl };
|
|
20
|
-
if (this.apiKey !== undefined) {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
22
|
-
config["headers"] = { 'x-api-key': this.apiKey };
|
|
23
|
-
}
|
|
24
|
-
const axiosResponse = await axios_1.default.get(url, config);
|
|
25
|
-
const response = axiosResponse.data;
|
|
26
|
-
this.handleErrors(response);
|
|
27
|
-
const models = [];
|
|
28
|
-
for (const id of ids) {
|
|
29
|
-
const modelData = response.data[id];
|
|
30
|
-
if (!modelData) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
models.push(modelData);
|
|
34
|
-
}
|
|
35
|
-
return models;
|
|
36
|
-
}
|
|
37
|
-
handleErrors(response) {
|
|
38
|
-
if (!response.status) {
|
|
39
|
-
throw new internal_server_exception_1.InternalServerException(response.message);
|
|
40
|
-
}
|
|
41
|
-
if (response.status === 400) {
|
|
42
|
-
throw new bad_request_exception_1.BadRequestException(response.message);
|
|
43
|
-
}
|
|
44
|
-
if (response.status === 404) {
|
|
45
|
-
throw new not_found_exception_1.NotFoundException(response.message);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
buildUrl(ids) {
|
|
49
|
-
const publicPrefix = this.shouldAddPublicPrefix() ? 'public/' : '';
|
|
50
|
-
let query = `${publicPrefix}${this.model}/${this.version}/?seed=${this.seed}`;
|
|
51
|
-
for (const id of ids) {
|
|
52
|
-
query += `&id=${id}`;
|
|
53
|
-
}
|
|
54
|
-
return query;
|
|
55
|
-
}
|
|
56
|
-
shouldAddPublicPrefix() {
|
|
57
|
-
return this.isPublic && this.apiKey === undefined;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.DomainClient = DomainClient;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DomainClient = void 0;
|
|
4
|
+
const axios_1 = require("axios");
|
|
5
|
+
const bad_request_exception_1 = require("./exceptions/bad-request-exception");
|
|
6
|
+
const internal_server_exception_1 = require("./exceptions/internal-server-exception");
|
|
7
|
+
const not_found_exception_1 = require("./exceptions/not-found-exception");
|
|
8
|
+
class DomainClient {
|
|
9
|
+
constructor(baseUrl, apiKey, model, version, isPublic, seed) {
|
|
10
|
+
this.baseUrl = baseUrl;
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
this.model = model;
|
|
13
|
+
this.version = version;
|
|
14
|
+
this.isPublic = isPublic;
|
|
15
|
+
this.seed = seed;
|
|
16
|
+
}
|
|
17
|
+
async doRequest(ids) {
|
|
18
|
+
const url = this.buildUrl(ids);
|
|
19
|
+
const config = { baseURL: this.baseUrl };
|
|
20
|
+
if (this.apiKey !== undefined) {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
22
|
+
config["headers"] = { 'x-api-key': this.apiKey };
|
|
23
|
+
}
|
|
24
|
+
const axiosResponse = await axios_1.default.get(url, config);
|
|
25
|
+
const response = axiosResponse.data;
|
|
26
|
+
this.handleErrors(response);
|
|
27
|
+
const models = [];
|
|
28
|
+
for (const id of ids) {
|
|
29
|
+
const modelData = response.data[id];
|
|
30
|
+
if (!modelData) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
models.push(modelData);
|
|
34
|
+
}
|
|
35
|
+
return models;
|
|
36
|
+
}
|
|
37
|
+
handleErrors(response) {
|
|
38
|
+
if (!response.status) {
|
|
39
|
+
throw new internal_server_exception_1.InternalServerException(response.message);
|
|
40
|
+
}
|
|
41
|
+
if (response.status === 400) {
|
|
42
|
+
throw new bad_request_exception_1.BadRequestException(response.message);
|
|
43
|
+
}
|
|
44
|
+
if (response.status === 404) {
|
|
45
|
+
throw new not_found_exception_1.NotFoundException(response.message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
buildUrl(ids) {
|
|
49
|
+
const publicPrefix = this.shouldAddPublicPrefix() ? 'public/' : '';
|
|
50
|
+
let query = `${publicPrefix}${this.model}/${this.version}/?seed=${this.seed}`;
|
|
51
|
+
for (const id of ids) {
|
|
52
|
+
query += `&id=${id}`;
|
|
53
|
+
}
|
|
54
|
+
return query;
|
|
55
|
+
}
|
|
56
|
+
shouldAddPublicPrefix() {
|
|
57
|
+
return this.isPublic && this.apiKey === undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.DomainClient = DomainClient;
|
|
61
61
|
//# sourceMappingURL=domain-client.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class BadRequestException extends Error {
|
|
2
|
-
}
|
|
1
|
+
export declare class BadRequestException extends Error {
|
|
2
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BadRequestException = void 0;
|
|
4
|
-
class BadRequestException extends Error {
|
|
5
|
-
}
|
|
6
|
-
exports.BadRequestException = BadRequestException;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BadRequestException = void 0;
|
|
4
|
+
class BadRequestException extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.BadRequestException = BadRequestException;
|
|
7
7
|
//# sourceMappingURL=bad-request-exception.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class ClientException extends Error {
|
|
2
|
-
}
|
|
1
|
+
export declare class ClientException extends Error {
|
|
2
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientException = void 0;
|
|
4
|
-
class ClientException extends Error {
|
|
5
|
-
}
|
|
6
|
-
exports.ClientException = ClientException;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientException = void 0;
|
|
4
|
+
class ClientException extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.ClientException = ClientException;
|
|
7
7
|
//# sourceMappingURL=client-exception.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class InternalServerException extends Error {
|
|
2
|
-
}
|
|
1
|
+
export declare class InternalServerException extends Error {
|
|
2
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternalServerException = void 0;
|
|
4
|
-
class InternalServerException extends Error {
|
|
5
|
-
}
|
|
6
|
-
exports.InternalServerException = InternalServerException;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalServerException = void 0;
|
|
4
|
+
class InternalServerException extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.InternalServerException = InternalServerException;
|
|
7
7
|
//# sourceMappingURL=internal-server-exception.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class NotFoundException extends Error {
|
|
2
|
-
}
|
|
1
|
+
export declare class NotFoundException extends Error {
|
|
2
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotFoundException = void 0;
|
|
4
|
-
class NotFoundException extends Error {
|
|
5
|
-
}
|
|
6
|
-
exports.NotFoundException = NotFoundException;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFoundException = void 0;
|
|
4
|
+
class NotFoundException extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.NotFoundException = NotFoundException;
|
|
7
7
|
//# sourceMappingURL=not-found-exception.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class PropertyNotAvailableException extends Error {
|
|
2
|
-
}
|
|
1
|
+
export declare class PropertyNotAvailableException extends Error {
|
|
2
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropertyNotAvailableException = void 0;
|
|
4
|
-
class PropertyNotAvailableException extends Error {
|
|
5
|
-
}
|
|
6
|
-
exports.PropertyNotAvailableException = PropertyNotAvailableException;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PropertyNotAvailableException = void 0;
|
|
4
|
+
class PropertyNotAvailableException extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.PropertyNotAvailableException = PropertyNotAvailableException;
|
|
7
7
|
//# sourceMappingURL=property-not-available-exception.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IClassFactory } from "../i-class-factory";
|
|
2
|
-
import { CallableReturnType, Model } from "../types";
|
|
3
|
-
export declare class DateFactory implements IClassFactory {
|
|
4
|
-
create(data: Model, parameters: string[]): CallableReturnType;
|
|
5
|
-
}
|
|
1
|
+
import { IClassFactory } from "../i-class-factory";
|
|
2
|
+
import { CallableReturnType, Model } from "../types";
|
|
3
|
+
export declare class DateFactory implements IClassFactory {
|
|
4
|
+
create(data: Model, parameters: string[]): CallableReturnType;
|
|
5
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateFactory = void 0;
|
|
4
|
-
class DateFactory {
|
|
5
|
-
create(data, parameters) {
|
|
6
|
-
return new Date(parameters[0]);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.DateFactory = DateFactory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateFactory = void 0;
|
|
4
|
+
class DateFactory {
|
|
5
|
+
create(data, parameters) {
|
|
6
|
+
return new Date(parameters[0]);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.DateFactory = DateFactory;
|
|
10
10
|
//# sourceMappingURL=DateFactory.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IClassFactory } from "../i-class-factory";
|
|
2
|
-
import { CallableReturnType, Model } from "../types";
|
|
3
|
-
import { PortalMap } from "../types/portal-map";
|
|
4
|
-
export declare class InternalLinkFactory implements IClassFactory {
|
|
5
|
-
private portalMap;
|
|
6
|
-
constructor(portalMap: PortalMap);
|
|
7
|
-
create(link: Model): CallableReturnType;
|
|
8
|
-
private getPortalBaseUrl;
|
|
9
|
-
}
|
|
1
|
+
import { IClassFactory } from "../i-class-factory";
|
|
2
|
+
import { CallableReturnType, Model } from "../types";
|
|
3
|
+
import { PortalMap } from "../types/portal-map";
|
|
4
|
+
export declare class InternalLinkFactory implements IClassFactory {
|
|
5
|
+
private portalMap;
|
|
6
|
+
constructor(portalMap: PortalMap);
|
|
7
|
+
create(link: Model): CallableReturnType;
|
|
8
|
+
private getPortalBaseUrl;
|
|
9
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InternalLinkFactory = void 0;
|
|
4
|
-
class InternalLinkFactory {
|
|
5
|
-
constructor(portalMap) {
|
|
6
|
-
this.portalMap = portalMap;
|
|
7
|
-
}
|
|
8
|
-
create(link) {
|
|
9
|
-
const portalBaseUrl = this.getPortalBaseUrl(link.getPortalType());
|
|
10
|
-
const path = link['getUrl']();
|
|
11
|
-
link['getUrl'] = () => portalBaseUrl + path;
|
|
12
|
-
return link;
|
|
13
|
-
}
|
|
14
|
-
getPortalBaseUrl(portalType) {
|
|
15
|
-
const url = this.portalMap.get(portalType);
|
|
16
|
-
return url || '';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.InternalLinkFactory = InternalLinkFactory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalLinkFactory = void 0;
|
|
4
|
+
class InternalLinkFactory {
|
|
5
|
+
constructor(portalMap) {
|
|
6
|
+
this.portalMap = portalMap;
|
|
7
|
+
}
|
|
8
|
+
create(link) {
|
|
9
|
+
const portalBaseUrl = this.getPortalBaseUrl(link.getPortalType());
|
|
10
|
+
const path = link['getUrl']();
|
|
11
|
+
link['getUrl'] = () => portalBaseUrl + path;
|
|
12
|
+
return link;
|
|
13
|
+
}
|
|
14
|
+
getPortalBaseUrl(portalType) {
|
|
15
|
+
const url = this.portalMap.get(portalType);
|
|
16
|
+
return url || '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.InternalLinkFactory = InternalLinkFactory;
|
|
20
20
|
//# sourceMappingURL=InternalLinkFactory.js.map
|
package/src/i-api-response.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IModelDescription } from "./i-model-description";
|
|
2
|
-
export interface IApiResponse {
|
|
3
|
-
status: number;
|
|
4
|
-
data: Record<number, IModelDescription>;
|
|
5
|
-
message: string;
|
|
6
|
-
}
|
|
1
|
+
import { IModelDescription } from "./i-model-description";
|
|
2
|
+
export interface IApiResponse {
|
|
3
|
+
status: number;
|
|
4
|
+
data: Record<number, IModelDescription>;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
package/src/i-api-response.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=i-api-response.js.map
|
package/src/i-class-factory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallableReturnType, Model } from "./types";
|
|
2
|
-
export interface IClassFactory {
|
|
3
|
-
create(data: Model, parameters?: any[]): CallableReturnType;
|
|
4
|
-
}
|
|
1
|
+
import { CallableReturnType, Model } from "./types";
|
|
2
|
+
export interface IClassFactory {
|
|
3
|
+
create(data: Model, parameters?: any[]): CallableReturnType;
|
|
4
|
+
}
|
package/src/i-class-factory.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=i-class-factory.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AcceptedType } from "./types";
|
|
2
|
-
export interface IModelDescription {
|
|
3
|
-
class: string;
|
|
4
|
-
func: Record<string, AcceptedType | IModelDescription>;
|
|
5
|
-
parameters?: any[];
|
|
6
|
-
}
|
|
7
|
-
export declare function isModelDescription(arg: any): arg is IModelDescription;
|
|
1
|
+
import { AcceptedType } from "./types";
|
|
2
|
+
export interface IModelDescription {
|
|
3
|
+
class: string;
|
|
4
|
+
func: Record<string, AcceptedType | IModelDescription>;
|
|
5
|
+
parameters?: any[];
|
|
6
|
+
}
|
|
7
|
+
export declare function isModelDescription(arg: any): arg is IModelDescription;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isModelDescription = void 0;
|
|
4
|
-
// eslint-disable-next-line
|
|
5
|
-
function isModelDescription(arg) {
|
|
6
|
-
// eslint-disable-next-line
|
|
7
|
-
return arg && arg.class && (arg.func || arg.parameters);
|
|
8
|
-
}
|
|
9
|
-
exports.isModelDescription = isModelDescription;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isModelDescription = void 0;
|
|
4
|
+
// eslint-disable-next-line
|
|
5
|
+
function isModelDescription(arg) {
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
return arg && arg.class && (arg.func || arg.parameters);
|
|
8
|
+
}
|
|
9
|
+
exports.isModelDescription = isModelDescription;
|
|
10
10
|
//# sourceMappingURL=i-model-description.js.map
|
package/src/model-client.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { IModelDescription } from "./i-model-description";
|
|
2
|
-
import { PortalMap } from "./types/portal-map";
|
|
3
|
-
export declare abstract class ModelClient<T> {
|
|
4
|
-
private readonly domainClient;
|
|
5
|
-
private readonly modelFactory;
|
|
6
|
-
constructor(baseUrl?: string, apiKey?: string, seed?: number, portalMap?: PortalMap);
|
|
7
|
-
fetch(id: number): Promise<T>;
|
|
8
|
-
fetchDescription(id: number): Promise<IModelDescription>;
|
|
9
|
-
fetchMultiple(ids: number[]): Promise<T[]>;
|
|
10
|
-
fetchMultipleDescriptions(ids: number[]): Promise<IModelDescription[]>;
|
|
11
|
-
fromDescription(description: IModelDescription): T;
|
|
12
|
-
fromDescriptions(descriptions: IModelDescription[]): T[];
|
|
13
|
-
protected abstract getModelName(): string;
|
|
14
|
-
protected abstract getVersion(): string;
|
|
15
|
-
abstract isPublic(): boolean;
|
|
16
|
-
}
|
|
1
|
+
import { IModelDescription } from "./i-model-description";
|
|
2
|
+
import { PortalMap } from "./types/portal-map";
|
|
3
|
+
export declare abstract class ModelClient<T> {
|
|
4
|
+
private readonly domainClient;
|
|
5
|
+
private readonly modelFactory;
|
|
6
|
+
constructor(baseUrl?: string, apiKey?: string, seed?: number, portalMap?: PortalMap);
|
|
7
|
+
fetch(id: number): Promise<T>;
|
|
8
|
+
fetchDescription(id: number): Promise<IModelDescription>;
|
|
9
|
+
fetchMultiple(ids: number[]): Promise<T[]>;
|
|
10
|
+
fetchMultipleDescriptions(ids: number[]): Promise<IModelDescription[]>;
|
|
11
|
+
fromDescription(description: IModelDescription): T;
|
|
12
|
+
fromDescriptions(descriptions: IModelDescription[]): T[];
|
|
13
|
+
protected abstract getModelName(): string;
|
|
14
|
+
protected abstract getVersion(): string;
|
|
15
|
+
abstract isPublic(): boolean;
|
|
16
|
+
}
|
package/src/model-client.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
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 {
|
|
8
|
-
constructor(baseUrl, apiKey, seed, portalMap) {
|
|
9
|
-
if (!baseUrl || !seed) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
this.modelFactory = new model_factory_1.ModelFactory(portalMap);
|
|
13
|
-
this.domainClient = new domain_client_1.DomainClient(baseUrl, apiKey, this.getModelName(), this.getVersion(), this.isPublic(), seed);
|
|
14
|
-
}
|
|
15
|
-
async fetch(id) {
|
|
16
|
-
const modelDescriptions = await this.fetchDescription(id);
|
|
17
|
-
return this.modelFactory.fromDescription(modelDescriptions);
|
|
18
|
-
}
|
|
19
|
-
async fetchDescription(id) {
|
|
20
|
-
if (!this.domainClient) {
|
|
21
|
-
throw new client_exception_1.ClientException("Offline mode active: did you provide all parameters " +
|
|
22
|
-
"in the constructor?");
|
|
23
|
-
}
|
|
24
|
-
const result = await this.domainClient.doRequest([id]);
|
|
25
|
-
return result[0];
|
|
26
|
-
}
|
|
27
|
-
async fetchMultiple(ids) {
|
|
28
|
-
const descriptions = await this.fetchMultipleDescriptions(ids);
|
|
29
|
-
return this.modelFactory.fromDescriptions(descriptions);
|
|
30
|
-
}
|
|
31
|
-
async fetchMultipleDescriptions(ids) {
|
|
32
|
-
if (!this.domainClient) {
|
|
33
|
-
throw new client_exception_1.ClientException('Offline mode active: did you provide all parameters ' +
|
|
34
|
-
'in the constructor?');
|
|
35
|
-
}
|
|
36
|
-
return await this.domainClient.doRequest(ids);
|
|
37
|
-
}
|
|
38
|
-
fromDescription(description) {
|
|
39
|
-
return this.modelFactory.fromDescription(description);
|
|
40
|
-
}
|
|
41
|
-
fromDescriptions(descriptions) {
|
|
42
|
-
return this.modelFactory.fromDescriptions(descriptions);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.ModelClient = ModelClient;
|
|
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 {
|
|
8
|
+
constructor(baseUrl, apiKey, seed, portalMap) {
|
|
9
|
+
if (!baseUrl || !seed) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
this.modelFactory = new model_factory_1.ModelFactory(portalMap);
|
|
13
|
+
this.domainClient = new domain_client_1.DomainClient(baseUrl, apiKey, this.getModelName(), this.getVersion(), this.isPublic(), seed);
|
|
14
|
+
}
|
|
15
|
+
async fetch(id) {
|
|
16
|
+
const modelDescriptions = await this.fetchDescription(id);
|
|
17
|
+
return this.modelFactory.fromDescription(modelDescriptions);
|
|
18
|
+
}
|
|
19
|
+
async fetchDescription(id) {
|
|
20
|
+
if (!this.domainClient) {
|
|
21
|
+
throw new client_exception_1.ClientException("Offline mode active: did you provide all parameters " +
|
|
22
|
+
"in the constructor?");
|
|
23
|
+
}
|
|
24
|
+
const result = await this.domainClient.doRequest([id]);
|
|
25
|
+
return result[0];
|
|
26
|
+
}
|
|
27
|
+
async fetchMultiple(ids) {
|
|
28
|
+
const descriptions = await this.fetchMultipleDescriptions(ids);
|
|
29
|
+
return this.modelFactory.fromDescriptions(descriptions);
|
|
30
|
+
}
|
|
31
|
+
async fetchMultipleDescriptions(ids) {
|
|
32
|
+
if (!this.domainClient) {
|
|
33
|
+
throw new client_exception_1.ClientException('Offline mode active: did you provide all parameters ' +
|
|
34
|
+
'in the constructor?');
|
|
35
|
+
}
|
|
36
|
+
return await this.domainClient.doRequest(ids);
|
|
37
|
+
}
|
|
38
|
+
fromDescription(description) {
|
|
39
|
+
return this.modelFactory.fromDescription(description);
|
|
40
|
+
}
|
|
41
|
+
fromDescriptions(descriptions) {
|
|
42
|
+
return this.modelFactory.fromDescriptions(descriptions);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ModelClient = ModelClient;
|
|
46
46
|
//# sourceMappingURL=model-client.js.map
|
package/src/model-factory.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IModelDescription } from "./i-model-description";
|
|
2
|
-
import { PortalMap } from "./types/portal-map";
|
|
3
|
-
export declare class ModelFactory<T> {
|
|
4
|
-
private customClassFactories;
|
|
5
|
-
constructor(portalMap?: PortalMap);
|
|
6
|
-
fromDescription(data: IModelDescription): T;
|
|
7
|
-
fromDescriptions(data: IModelDescription[]): T[];
|
|
8
|
-
private unpackClass;
|
|
9
|
-
private getCallable;
|
|
10
|
-
private unpackArray;
|
|
11
|
-
}
|
|
1
|
+
import { IModelDescription } from "./i-model-description";
|
|
2
|
+
import { PortalMap } from "./types/portal-map";
|
|
3
|
+
export declare class ModelFactory<T> {
|
|
4
|
+
private customClassFactories;
|
|
5
|
+
constructor(portalMap?: PortalMap);
|
|
6
|
+
fromDescription(data: IModelDescription): T;
|
|
7
|
+
fromDescriptions(data: IModelDescription[]): T[];
|
|
8
|
+
private unpackClass;
|
|
9
|
+
private getCallable;
|
|
10
|
+
private unpackArray;
|
|
11
|
+
}
|