@studyportals/search-api-interface 3.4.2-0 → 3.4.2-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.cjs +490 -0
- package/package.json +37 -30
- package/src/organisations/IOrganisationSearchFilters.d.ts +0 -1
- package/src/organisations/IOrganisationSearchFilters.js +0 -1
- package/src/organisations/IOrganisationSearchFilters.js.map +1 -1
- package/src/organisations/OrganisationSearchFilters.d.ts +0 -2
- package/src/organisations/OrganisationSearchFilters.js +0 -6
- package/src/organisations/OrganisationSearchFilters.js.map +1 -1
- package/src/organisations/OrganisationSearchInput.d.ts +0 -1
package/index.cjs
ADDED
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var domainClient = require('@studyportals/domain-client');
|
|
4
|
+
|
|
5
|
+
exports.HitsTotalRelation = void 0;
|
|
6
|
+
(function (HitsTotalRelation) {
|
|
7
|
+
HitsTotalRelation["EXACTLY"] = "exactly";
|
|
8
|
+
HitsTotalRelation["MORE_THAN"] = "more than";
|
|
9
|
+
})(exports.HitsTotalRelation || (exports.HitsTotalRelation = {}));
|
|
10
|
+
|
|
11
|
+
exports.DegreeTypeEnum = void 0;
|
|
12
|
+
(function (DegreeTypeEnum) {
|
|
13
|
+
DegreeTypeEnum[DegreeTypeEnum["MASTER"] = 0] = "MASTER";
|
|
14
|
+
DegreeTypeEnum[DegreeTypeEnum["BACHELOR"] = 1] = "BACHELOR";
|
|
15
|
+
DegreeTypeEnum[DegreeTypeEnum["PHD"] = 2] = "PHD";
|
|
16
|
+
DegreeTypeEnum[DegreeTypeEnum["DISTANCE_LEARNING"] = 3] = "DISTANCE_LEARNING";
|
|
17
|
+
DegreeTypeEnum[DegreeTypeEnum["SHORT_COURSES"] = 4] = "SHORT_COURSES";
|
|
18
|
+
})(exports.DegreeTypeEnum || (exports.DegreeTypeEnum = {}));
|
|
19
|
+
|
|
20
|
+
exports.DeliveryMethodEnum = void 0;
|
|
21
|
+
(function (DeliveryMethodEnum) {
|
|
22
|
+
DeliveryMethodEnum["ONLINE"] = "online";
|
|
23
|
+
DeliveryMethodEnum["ON_CAMPUS"] = "oncampus";
|
|
24
|
+
DeliveryMethodEnum["BLENDED"] = "blended";
|
|
25
|
+
})(exports.DeliveryMethodEnum || (exports.DeliveryMethodEnum = {}));
|
|
26
|
+
|
|
27
|
+
class IOrganisationSearchFilters {
|
|
28
|
+
organisationId;
|
|
29
|
+
degree;
|
|
30
|
+
disciplines;
|
|
31
|
+
deliveryMethods;
|
|
32
|
+
countryIsoCodes;
|
|
33
|
+
countryIsoCodesOfMainLocations;
|
|
34
|
+
regionIds;
|
|
35
|
+
areaIds;
|
|
36
|
+
cityIds;
|
|
37
|
+
virtualPath;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class OrganisationSearchFilters {
|
|
41
|
+
organisationId;
|
|
42
|
+
degree;
|
|
43
|
+
disciplines;
|
|
44
|
+
deliveryMethods;
|
|
45
|
+
countryIsoCodes;
|
|
46
|
+
countryIsoCodesOfMainLocations;
|
|
47
|
+
regionIds;
|
|
48
|
+
areaIds;
|
|
49
|
+
cityIds;
|
|
50
|
+
virtualPath;
|
|
51
|
+
from(input) {
|
|
52
|
+
this.organisationId = input.organisationId ? input.organisationId.toString() : undefined;
|
|
53
|
+
this.degree = input.degree;
|
|
54
|
+
this.deliveryMethods = input.deliveryMethods;
|
|
55
|
+
this.disciplines = this.numbersToStringsOrUndefined(input.disciplines);
|
|
56
|
+
this.countryIsoCodes = input.countryIsoCodes;
|
|
57
|
+
this.countryIsoCodesOfMainLocations = input.countryIsoCodesOfMainLocations;
|
|
58
|
+
this.regionIds = this.numbersToStringsOrUndefined(input.regionIds);
|
|
59
|
+
this.areaIds = this.numbersToStringsOrUndefined(input.areaIds);
|
|
60
|
+
this.cityIds = this.numbersToStringsOrUndefined(input.cityIds);
|
|
61
|
+
this.virtualPath = input.virtualPath;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
consideringId(id) {
|
|
65
|
+
this.organisationId = id;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
consideringDegree(degree) {
|
|
69
|
+
this.degree = degree;
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
consideringDisciplines(disciplines) {
|
|
73
|
+
this.disciplines = disciplines;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
consideringDeliveryMethods(deliveryMethods) {
|
|
77
|
+
this.deliveryMethods = deliveryMethods;
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
consideringCountryIsoCodes(countryIsoCodes) {
|
|
81
|
+
this.countryIsoCodes = countryIsoCodes;
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
consideringCountryIsoCodesOfMainLocations(countryIsoCodes) {
|
|
85
|
+
this.countryIsoCodesOfMainLocations = countryIsoCodes;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
consideringRegionIds(regionIds) {
|
|
89
|
+
this.regionIds = regionIds;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
consideringAreaIds(areaIds) {
|
|
93
|
+
this.areaIds = areaIds;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
consideringCityIds(cityIds) {
|
|
97
|
+
this.cityIds = cityIds;
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
consideringVirtualPath(virtualPath) {
|
|
101
|
+
this.virtualPath = virtualPath;
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
numbersToStringsOrUndefined(values) {
|
|
105
|
+
if (values === undefined)
|
|
106
|
+
return;
|
|
107
|
+
return values.map(value => value.toString());
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
class SearchApiClientBase {
|
|
112
|
+
domain;
|
|
113
|
+
apiUriBase;
|
|
114
|
+
constructor(domain, apiUriBase) {
|
|
115
|
+
this.domain = domain;
|
|
116
|
+
this.apiUriBase = apiUriBase;
|
|
117
|
+
}
|
|
118
|
+
constructUri(relativeUri) {
|
|
119
|
+
return `${this.apiUriBase}/${this.domain}/${relativeUri}`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
class SearchApiOrganisationClient extends SearchApiClientBase {
|
|
124
|
+
requestFactory;
|
|
125
|
+
requestSender;
|
|
126
|
+
organisationCardFactory = new domainClient.OrganisationCardClient();
|
|
127
|
+
constructor(apiUriBase, requestFactory, requestSender) {
|
|
128
|
+
super("organisations", apiUriBase);
|
|
129
|
+
this.requestFactory = requestFactory;
|
|
130
|
+
this.requestSender = requestSender;
|
|
131
|
+
this.organisationCardFactory = new domainClient.OrganisationCardClient("N/A", "N/A", 1);
|
|
132
|
+
}
|
|
133
|
+
async searchCards(filters, resultSize, resultOffset) {
|
|
134
|
+
const request = this.requestFactory.get(this.constructUri("search"))
|
|
135
|
+
.query({ ...filters, resultSize, resultOffset });
|
|
136
|
+
const result = await this.requestSender.sendAndExtractBody(request);
|
|
137
|
+
return {
|
|
138
|
+
...result,
|
|
139
|
+
organisations: this.organisationCardFactory.fromDescriptions([...result.organisations])
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async searchIds(filters, resultSize, resultOffset) {
|
|
143
|
+
const request = this.requestFactory.get(this.constructUri("search/ids"))
|
|
144
|
+
.query({ ...filters, resultSize, resultOffset });
|
|
145
|
+
return await this.requestSender.sendAndExtractBody(request);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
class IProgrammeResult {
|
|
150
|
+
is_premium;
|
|
151
|
+
card;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
class IProgrammeSearchFilters {
|
|
155
|
+
attendances;
|
|
156
|
+
degreeTypes;
|
|
157
|
+
disciplines;
|
|
158
|
+
durations;
|
|
159
|
+
educationalLevels;
|
|
160
|
+
educationalForms;
|
|
161
|
+
densities;
|
|
162
|
+
text;
|
|
163
|
+
areaIds;
|
|
164
|
+
regionIds;
|
|
165
|
+
countryIsoCodes;
|
|
166
|
+
organisationIds;
|
|
167
|
+
specialProgrammes;
|
|
168
|
+
tuitionFeeMin;
|
|
169
|
+
tuitionFeeMax;
|
|
170
|
+
nationalityCountryIso;
|
|
171
|
+
sortBy;
|
|
172
|
+
suggestionSize;
|
|
173
|
+
facets;
|
|
174
|
+
facetsDurations;
|
|
175
|
+
campaignTypes;
|
|
176
|
+
textSearchAlgorithm;
|
|
177
|
+
showHidden;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
exports.ProgrammeSortType = void 0;
|
|
181
|
+
(function (ProgrammeSortType) {
|
|
182
|
+
ProgrammeSortType["DEFAULT"] = "default";
|
|
183
|
+
ProgrammeSortType["TUITION"] = "tuition";
|
|
184
|
+
})(exports.ProgrammeSortType || (exports.ProgrammeSortType = {}));
|
|
185
|
+
|
|
186
|
+
class ProgrammeSearchFilters {
|
|
187
|
+
attendances;
|
|
188
|
+
degreeTypes;
|
|
189
|
+
disciplines;
|
|
190
|
+
durations;
|
|
191
|
+
educationalLevels;
|
|
192
|
+
educationalForms;
|
|
193
|
+
densities;
|
|
194
|
+
text;
|
|
195
|
+
areaIds;
|
|
196
|
+
regionIds;
|
|
197
|
+
countryIsoCodes;
|
|
198
|
+
organisationIds;
|
|
199
|
+
specialProgrammes;
|
|
200
|
+
tuitionFeeMin;
|
|
201
|
+
tuitionFeeMax;
|
|
202
|
+
nationalityCountryIso;
|
|
203
|
+
sortBy;
|
|
204
|
+
suggestionSize;
|
|
205
|
+
facets;
|
|
206
|
+
facetsDurations;
|
|
207
|
+
textSearchAlgorithm;
|
|
208
|
+
showHidden;
|
|
209
|
+
campaignTypes;
|
|
210
|
+
from(input) {
|
|
211
|
+
this.attendances = input.attendances;
|
|
212
|
+
this.degreeTypes = input.degreeTypes;
|
|
213
|
+
this.durations = input.durations;
|
|
214
|
+
this.disciplines = this.numbersToStringsOrUndefined(input.disciplines);
|
|
215
|
+
this.educationalLevels = input.educationalLevels;
|
|
216
|
+
this.educationalForms = input.educationalForms;
|
|
217
|
+
this.densities = input.densities;
|
|
218
|
+
this.text = input.text;
|
|
219
|
+
this.areaIds = this.numbersToStringsOrUndefined(input.areaIds);
|
|
220
|
+
this.regionIds = this.numbersToStringsOrUndefined(input.regionIds);
|
|
221
|
+
this.countryIsoCodes = input.countryIsoCodes;
|
|
222
|
+
this.organisationIds = input.organisationIds ? input.organisationIds.map(id => id.toString()) : undefined;
|
|
223
|
+
this.specialProgrammes = input.specialProgrammes;
|
|
224
|
+
this.nationalityCountryIso = input.nationalityCountryIso;
|
|
225
|
+
this.tuitionFeeMin = input.tuitionFeeMin;
|
|
226
|
+
this.tuitionFeeMax = input.tuitionFeeMax;
|
|
227
|
+
this.sortBy = input.sortBy || exports.ProgrammeSortType.DEFAULT;
|
|
228
|
+
this.suggestionSize = input.suggestionSize;
|
|
229
|
+
this.facets = input.facets;
|
|
230
|
+
this.facetsDurations = input.facetsDurations;
|
|
231
|
+
this.textSearchAlgorithm = input.textSearchAlgorithm;
|
|
232
|
+
this.showHidden = input.showHidden;
|
|
233
|
+
this.campaignTypes = input.campaignTypes;
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
numbersToStringsOrUndefined(values) {
|
|
237
|
+
if (values === undefined)
|
|
238
|
+
return;
|
|
239
|
+
return values.map(value => value.toString());
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
class SearchApiProgrammeClient extends SearchApiClientBase {
|
|
244
|
+
requestFactory;
|
|
245
|
+
requestSender;
|
|
246
|
+
programmeCardFactory = new domainClient.ProgrammeCardClient();
|
|
247
|
+
constructor(apiUriBase, requestFactory, requestSender, portalMap) {
|
|
248
|
+
super("programmes", apiUriBase);
|
|
249
|
+
this.requestFactory = requestFactory;
|
|
250
|
+
this.requestSender = requestSender;
|
|
251
|
+
this.programmeCardFactory = new domainClient.ProgrammeCardClient("N/A", "N/A", 1, portalMap);
|
|
252
|
+
}
|
|
253
|
+
async searchCards(filters, resultSize, resultOffset) {
|
|
254
|
+
const request = this.requestFactory.get(this.constructUri("search"))
|
|
255
|
+
.query({ ...filters, resultSize, resultOffset });
|
|
256
|
+
const result = await this.requestSender.sendAndExtractBody(request);
|
|
257
|
+
const programmeResults = result.programmes.map(result => ({
|
|
258
|
+
card: this.programmeCardFactory.fromDescription(result.card),
|
|
259
|
+
is_premium: result.is_premium
|
|
260
|
+
}));
|
|
261
|
+
return {
|
|
262
|
+
...result,
|
|
263
|
+
programmes: programmeResults,
|
|
264
|
+
facets: result.facets ?? []
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
async searchIds(filters, resultSize, resultOffset) {
|
|
268
|
+
const request = this.requestFactory.get(this.constructUri("search/ids"))
|
|
269
|
+
.query({ ...filters, resultSize, resultOffset });
|
|
270
|
+
return await this.requestSender.sendAndExtractBody(request);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
exports.TextSearchAlgorithmType = void 0;
|
|
275
|
+
(function (TextSearchAlgorithmType) {
|
|
276
|
+
TextSearchAlgorithmType["KEYWORD"] = "keyword";
|
|
277
|
+
TextSearchAlgorithmType["HYBRID"] = "hybrid";
|
|
278
|
+
TextSearchAlgorithmType["SIMILARITY_SEARCH"] = "similarity";
|
|
279
|
+
})(exports.TextSearchAlgorithmType || (exports.TextSearchAlgorithmType = {}));
|
|
280
|
+
|
|
281
|
+
exports.ProgrammeFilterType = void 0;
|
|
282
|
+
(function (ProgrammeFilterType) {
|
|
283
|
+
ProgrammeFilterType["ATTENDANCES"] = "attendances";
|
|
284
|
+
ProgrammeFilterType["DEGREE_TYPES"] = "degreeTypes";
|
|
285
|
+
ProgrammeFilterType["DISCIPLINES"] = "disciplines";
|
|
286
|
+
ProgrammeFilterType["DURATIONS"] = "durations";
|
|
287
|
+
ProgrammeFilterType["EDUCATIONAL_LEVELS"] = "educationalLevels";
|
|
288
|
+
ProgrammeFilterType["EDUCATIONAL_FORMS"] = "educationalForms";
|
|
289
|
+
ProgrammeFilterType["DENSITIES"] = "densities";
|
|
290
|
+
ProgrammeFilterType["TEXT"] = "text";
|
|
291
|
+
ProgrammeFilterType["AREA_IDS"] = "areaIds";
|
|
292
|
+
ProgrammeFilterType["REGION_IDS"] = "regionIds";
|
|
293
|
+
ProgrammeFilterType["COUNTRY_ISO_CODES"] = "countryIsoCodes";
|
|
294
|
+
ProgrammeFilterType["ORGANISATION_IDS"] = "organisationIds";
|
|
295
|
+
ProgrammeFilterType["SPECIAL_PROGRAMMES"] = "specialProgrammes";
|
|
296
|
+
ProgrammeFilterType["TUITION_FEE_MIN"] = "tuitionFeeMin";
|
|
297
|
+
ProgrammeFilterType["TUITION_FEE_MAX"] = "tuitionFeeMax";
|
|
298
|
+
ProgrammeFilterType["NATIONALITY_COUNTRY_ISO"] = "nationalityCountryIso";
|
|
299
|
+
})(exports.ProgrammeFilterType || (exports.ProgrammeFilterType = {}));
|
|
300
|
+
|
|
301
|
+
class ScholarshipSearchFilters {
|
|
302
|
+
title;
|
|
303
|
+
disciplineIds;
|
|
304
|
+
destinationCountryIsoCodes;
|
|
305
|
+
destinationRegionIds;
|
|
306
|
+
originCountryIsoCodes;
|
|
307
|
+
universityProviderIds;
|
|
308
|
+
degree;
|
|
309
|
+
formats;
|
|
310
|
+
types;
|
|
311
|
+
from(input) {
|
|
312
|
+
this.title = input.title;
|
|
313
|
+
this.disciplineIds = this.numbersToStringsOrUndefined(input.disciplineIds);
|
|
314
|
+
this.destinationCountryIsoCodes = input.destinationCountryIsoCodes;
|
|
315
|
+
this.destinationRegionIds = this.numbersToStringsOrUndefined(input.destinationRegionIds);
|
|
316
|
+
this.originCountryIsoCodes = input.originCountryIsoCodes;
|
|
317
|
+
this.universityProviderIds = this.numbersToStringsOrUndefined(input.universityProviderIds);
|
|
318
|
+
this.degree = input.degree;
|
|
319
|
+
this.formats = input.formats;
|
|
320
|
+
this.types = input.types;
|
|
321
|
+
return this;
|
|
322
|
+
}
|
|
323
|
+
consideringTitle(title) {
|
|
324
|
+
this.title = title;
|
|
325
|
+
return this;
|
|
326
|
+
}
|
|
327
|
+
consideringDisciplineIds(disciplines) {
|
|
328
|
+
this.disciplineIds = disciplines;
|
|
329
|
+
return this;
|
|
330
|
+
}
|
|
331
|
+
consideringDestinationCountryIsoCodes(destinationCountries) {
|
|
332
|
+
this.destinationCountryIsoCodes = destinationCountries;
|
|
333
|
+
return this;
|
|
334
|
+
}
|
|
335
|
+
consideringDestinationRegionIds(destinationStates) {
|
|
336
|
+
this.destinationRegionIds = destinationStates;
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
consideringOriginCountryIsoCodes(originCountries) {
|
|
340
|
+
this.originCountryIsoCodes = originCountries;
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
consideringUniversityProviderIds(providerOrganisationIds) {
|
|
344
|
+
this.universityProviderIds = providerOrganisationIds;
|
|
345
|
+
return this;
|
|
346
|
+
}
|
|
347
|
+
consideringDegree(degree) {
|
|
348
|
+
this.degree = degree;
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
351
|
+
consideringFormats(formats) {
|
|
352
|
+
this.formats = formats;
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
consideringTypes(types) {
|
|
356
|
+
this.types = types;
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
numbersToStringsOrUndefined(values) {
|
|
360
|
+
if (values === undefined)
|
|
361
|
+
return;
|
|
362
|
+
return values.map(value => value.toString());
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
exports.ScholarshipFormat = void 0;
|
|
367
|
+
(function (ScholarshipFormat) {
|
|
368
|
+
ScholarshipFormat[ScholarshipFormat["TUITION_FEE_REDUCTION"] = 0] = "TUITION_FEE_REDUCTION";
|
|
369
|
+
ScholarshipFormat[ScholarshipFormat["LIVING_EXPENSES"] = 1] = "LIVING_EXPENSES";
|
|
370
|
+
ScholarshipFormat[ScholarshipFormat["ACCOMODATION"] = 2] = "ACCOMODATION";
|
|
371
|
+
ScholarshipFormat[ScholarshipFormat["TRAVEL_EXPENSES"] = 3] = "TRAVEL_EXPENSES";
|
|
372
|
+
ScholarshipFormat[ScholarshipFormat["SPOUSE_CHILD_CARE"] = 4] = "SPOUSE_CHILD_CARE";
|
|
373
|
+
ScholarshipFormat[ScholarshipFormat["HEALTH"] = 5] = "HEALTH";
|
|
374
|
+
ScholarshipFormat[ScholarshipFormat["APPLICATION"] = 6] = "APPLICATION";
|
|
375
|
+
ScholarshipFormat[ScholarshipFormat["OTHER"] = 7] = "OTHER";
|
|
376
|
+
})(exports.ScholarshipFormat || (exports.ScholarshipFormat = {}));
|
|
377
|
+
|
|
378
|
+
exports.ScholarshipType = void 0;
|
|
379
|
+
(function (ScholarshipType) {
|
|
380
|
+
ScholarshipType[ScholarshipType["FULL_TUITION_FEE_WAIVER"] = 0] = "FULL_TUITION_FEE_WAIVER";
|
|
381
|
+
ScholarshipType[ScholarshipType["PARTIAL_FEE_WAIVER"] = 1] = "PARTIAL_FEE_WAIVER";
|
|
382
|
+
ScholarshipType[ScholarshipType["FULL_RIDE"] = 2] = "FULL_RIDE";
|
|
383
|
+
ScholarshipType[ScholarshipType["MILITARY"] = 3] = "MILITARY";
|
|
384
|
+
ScholarshipType[ScholarshipType["SPORTS"] = 4] = "SPORTS";
|
|
385
|
+
ScholarshipType[ScholarshipType["STEM"] = 5] = "STEM";
|
|
386
|
+
ScholarshipType[ScholarshipType["RELIGIOUS"] = 6] = "RELIGIOUS";
|
|
387
|
+
ScholarshipType[ScholarshipType["HERITAGE"] = 7] = "HERITAGE";
|
|
388
|
+
ScholarshipType[ScholarshipType["LEARNING_DISABILITIES"] = 8] = "LEARNING_DISABILITIES";
|
|
389
|
+
ScholarshipType[ScholarshipType["AUTOMATIC"] = 9] = "AUTOMATIC";
|
|
390
|
+
ScholarshipType[ScholarshipType["MERIT_BASED"] = 10] = "MERIT_BASED";
|
|
391
|
+
ScholarshipType[ScholarshipType["NEED_BASED"] = 11] = "NEED_BASED";
|
|
392
|
+
ScholarshipType[ScholarshipType["NO_ESSAY_REQUIRED"] = 12] = "NO_ESSAY_REQUIRED";
|
|
393
|
+
ScholarshipType[ScholarshipType["NO_GPA_REQUIREMENTS"] = 13] = "NO_GPA_REQUIREMENTS";
|
|
394
|
+
ScholarshipType[ScholarshipType["NO_RECOMMENDATIONS_REQUIRED"] = 14] = "NO_RECOMMENDATIONS_REQUIRED";
|
|
395
|
+
})(exports.ScholarshipType || (exports.ScholarshipType = {}));
|
|
396
|
+
|
|
397
|
+
class SearchApiScholarshipClient extends SearchApiClientBase {
|
|
398
|
+
requestFactory;
|
|
399
|
+
requestSender;
|
|
400
|
+
scholarshipCardFactory;
|
|
401
|
+
constructor(apiUriBase, requestFactory, requestSender, portalMap) {
|
|
402
|
+
super("scholarships", apiUriBase);
|
|
403
|
+
this.requestFactory = requestFactory;
|
|
404
|
+
this.requestSender = requestSender;
|
|
405
|
+
this.scholarshipCardFactory = new domainClient.ScholarshipCardV2Client("N/A", "N/A", 1, portalMap);
|
|
406
|
+
}
|
|
407
|
+
async searchCards(filters, resultSize, resultOffset) {
|
|
408
|
+
const request = this.requestFactory.get(this.constructUri("search"))
|
|
409
|
+
.query({ ...filters, resultSize, resultOffset });
|
|
410
|
+
const result = await this.requestSender.sendAndExtractBody(request);
|
|
411
|
+
return {
|
|
412
|
+
...result,
|
|
413
|
+
scholarships: this.scholarshipCardFactory.fromDescriptions([...result.scholarships])
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
async count(filters) {
|
|
417
|
+
const request = this.requestFactory.get(this.constructUri("count"))
|
|
418
|
+
.query({ ...filters });
|
|
419
|
+
return await this.requestSender.sendAndExtractBody(request);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
class SearchApiCityClient extends SearchApiClientBase {
|
|
424
|
+
requestFactory;
|
|
425
|
+
requestSender;
|
|
426
|
+
constructor(apiUriBase, requestFactory, requestSender) {
|
|
427
|
+
super("cities", apiUriBase);
|
|
428
|
+
this.requestFactory = requestFactory;
|
|
429
|
+
this.requestSender = requestSender;
|
|
430
|
+
}
|
|
431
|
+
async search(filters, resultSize, resultOffset) {
|
|
432
|
+
const request = this.requestFactory.get(this.constructUri("search"))
|
|
433
|
+
.query({ ...filters, resultSize, resultOffset });
|
|
434
|
+
const result = await this.requestSender.sendAndExtractBody(request);
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
class CitySearchFilters {
|
|
440
|
+
id;
|
|
441
|
+
nameSearchTerm;
|
|
442
|
+
virtualPath;
|
|
443
|
+
areaIds;
|
|
444
|
+
countryIsoCodes;
|
|
445
|
+
from(input) {
|
|
446
|
+
this.id = input.id?.toString();
|
|
447
|
+
this.nameSearchTerm = input.nameSearchTerm;
|
|
448
|
+
this.virtualPath = input.virtualPath;
|
|
449
|
+
this.areaIds = this.numbersToStringsOrUndefined(input.areaIds);
|
|
450
|
+
this.countryIsoCodes = input.countryIsoCodes;
|
|
451
|
+
return this;
|
|
452
|
+
}
|
|
453
|
+
consideringId(id) {
|
|
454
|
+
this.id = id;
|
|
455
|
+
return this;
|
|
456
|
+
}
|
|
457
|
+
consideringNameSearchTerm(searchTerm) {
|
|
458
|
+
this.nameSearchTerm = searchTerm;
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
consideringVirtualPath(virtualPath) {
|
|
462
|
+
this.virtualPath = virtualPath;
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
465
|
+
consideringAreaIds(areaIds) {
|
|
466
|
+
this.areaIds = areaIds;
|
|
467
|
+
return this;
|
|
468
|
+
}
|
|
469
|
+
consideringCountryIsoCodes(countryIsoCodes) {
|
|
470
|
+
this.countryIsoCodes = countryIsoCodes;
|
|
471
|
+
return this;
|
|
472
|
+
}
|
|
473
|
+
numbersToStringsOrUndefined(values) {
|
|
474
|
+
if (!values)
|
|
475
|
+
return;
|
|
476
|
+
return values.map(value => value.toString());
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
exports.CitySearchFilters = CitySearchFilters;
|
|
481
|
+
exports.IOrganisationSearchFilters = IOrganisationSearchFilters;
|
|
482
|
+
exports.IProgrammeResult = IProgrammeResult;
|
|
483
|
+
exports.IProgrammeSearchFilters = IProgrammeSearchFilters;
|
|
484
|
+
exports.OrganisationSearchFilters = OrganisationSearchFilters;
|
|
485
|
+
exports.ProgrammeSearchFilters = ProgrammeSearchFilters;
|
|
486
|
+
exports.ScholarshipSearchFilters = ScholarshipSearchFilters;
|
|
487
|
+
exports.SearchApiCityClient = SearchApiCityClient;
|
|
488
|
+
exports.SearchApiOrganisationClient = SearchApiOrganisationClient;
|
|
489
|
+
exports.SearchApiProgrammeClient = SearchApiProgrammeClient;
|
|
490
|
+
exports.SearchApiScholarshipClient = SearchApiScholarshipClient;
|
package/package.json
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
+
"name": "@studyportals/search-api-interface",
|
|
3
|
+
"version": "3.4.2-1",
|
|
4
|
+
"description": "Typescript library containing resources that facilitate integration with SearchApi",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
"import": "./bin/index.js",
|
|
8
|
+
"require": "./bin/index.cjs"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"compile": "rm -fR bin && npx tsc",
|
|
12
|
+
"deploy-patch": "npm version patch && npm run deploy",
|
|
13
|
+
"deploy-minor": "npm version minor && npm run deploy",
|
|
14
|
+
"deploy-major": "npm version major && npm run deploy",
|
|
15
|
+
"deploy-beta": "npm version prerelease && npm run prepare-deployment && npm publish ./bin --tag beta",
|
|
16
|
+
"deploy": "npm run prepare-deployment && npm publish ./bin",
|
|
17
|
+
"prepare-deployment": "npm run compile && npm run convert-to-cjs && cp package.json bin/package.json && npm run remove-aliases",
|
|
18
|
+
"remove-aliases": "npx tsc-alias -p tsconfig.json",
|
|
19
|
+
"convert-to-cjs": "npx rollup ./bin/index.js --file ./bin/index.cjs --format cjs",
|
|
20
|
+
"lint": "eslint . --ext .ts",
|
|
21
|
+
"lint:fix": "eslint . --ext .ts --fix"
|
|
22
|
+
},
|
|
23
|
+
"author": "Seal Team Six",
|
|
24
|
+
"license": "BSD-3-Clause",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@studyportals/code-style": "^1.7.0",
|
|
27
|
+
"@types/superagent": "^4.1.15",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
29
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
30
|
+
"eslint": "^8.17.0",
|
|
31
|
+
"rollup": "^4.50.1",
|
|
32
|
+
"typescript": "^5.5.4",
|
|
33
|
+
"typescript-transform-paths": "^3.4.6"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@studyportals/domain-client": "^7.4.0",
|
|
37
|
+
"@studyportals/search-filters": "^6.3.1"
|
|
38
|
+
}
|
|
32
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IOrganisationSearchFilters.js","sourceRoot":"","sources":["../../../src/organisations/IOrganisationSearchFilters.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,0BAA0B;IAC7B,cAAc,CAAqB;IACnC,MAAM,CAA6B;IACnC,WAAW,CAAuB;IAClC,eAAe,CAAmC;IAClD,eAAe,CAAuB;IACtC,8BAA8B,CAAuB;IACrD,SAAS,CAAuB;IAChC,OAAO,CAAuB;IAC9B,OAAO,CAAuB;IAC9B,WAAW,CAAqB;
|
|
1
|
+
{"version":3,"file":"IOrganisationSearchFilters.js","sourceRoot":"","sources":["../../../src/organisations/IOrganisationSearchFilters.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,0BAA0B;IAC7B,cAAc,CAAqB;IACnC,MAAM,CAA6B;IACnC,WAAW,CAAuB;IAClC,eAAe,CAAmC;IAClD,eAAe,CAAuB;IACtC,8BAA8B,CAAuB;IACrD,SAAS,CAAuB;IAChC,OAAO,CAAuB;IAC9B,OAAO,CAAuB;IAC9B,WAAW,CAAqB;CACzC"}
|
|
@@ -12,7 +12,6 @@ export declare class OrganisationSearchFilters implements IOrganisationSearchFil
|
|
|
12
12
|
regionIds: string[] | undefined;
|
|
13
13
|
areaIds: string[] | undefined;
|
|
14
14
|
cityIds: string[] | undefined;
|
|
15
|
-
cityIdOfMainLocation: string | undefined;
|
|
16
15
|
virtualPath: string | undefined;
|
|
17
16
|
from(input: OrganisationSearchInput): OrganisationSearchFilters;
|
|
18
17
|
consideringId(id: string): OrganisationSearchFilters;
|
|
@@ -24,7 +23,6 @@ export declare class OrganisationSearchFilters implements IOrganisationSearchFil
|
|
|
24
23
|
consideringRegionIds(regionIds: string[]): OrganisationSearchFilters;
|
|
25
24
|
consideringAreaIds(areaIds: string[]): OrganisationSearchFilters;
|
|
26
25
|
consideringCityIds(cityIds: string[]): OrganisationSearchFilters;
|
|
27
|
-
consideringCityIdOfMainLocation(cityIdOfMainLocation: string): OrganisationSearchFilters;
|
|
28
26
|
consideringVirtualPath(virtualPath: string): OrganisationSearchFilters;
|
|
29
27
|
private numbersToStringsOrUndefined;
|
|
30
28
|
}
|
|
@@ -8,7 +8,6 @@ export class OrganisationSearchFilters {
|
|
|
8
8
|
regionIds;
|
|
9
9
|
areaIds;
|
|
10
10
|
cityIds;
|
|
11
|
-
cityIdOfMainLocation;
|
|
12
11
|
virtualPath;
|
|
13
12
|
from(input) {
|
|
14
13
|
this.organisationId = input.organisationId ? input.organisationId.toString() : undefined;
|
|
@@ -21,7 +20,6 @@ export class OrganisationSearchFilters {
|
|
|
21
20
|
this.areaIds = this.numbersToStringsOrUndefined(input.areaIds);
|
|
22
21
|
this.cityIds = this.numbersToStringsOrUndefined(input.cityIds);
|
|
23
22
|
this.virtualPath = input.virtualPath;
|
|
24
|
-
this.cityIdOfMainLocation = input.cityIdOfMainLocation ? input.cityIdOfMainLocation.toString() : undefined;
|
|
25
23
|
return this;
|
|
26
24
|
}
|
|
27
25
|
consideringId(id) {
|
|
@@ -60,10 +58,6 @@ export class OrganisationSearchFilters {
|
|
|
60
58
|
this.cityIds = cityIds;
|
|
61
59
|
return this;
|
|
62
60
|
}
|
|
63
|
-
consideringCityIdOfMainLocation(cityIdOfMainLocation) {
|
|
64
|
-
this.cityIdOfMainLocation = cityIdOfMainLocation;
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
61
|
consideringVirtualPath(virtualPath) {
|
|
68
62
|
this.virtualPath = virtualPath;
|
|
69
63
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrganisationSearchFilters.js","sourceRoot":"","sources":["../../../src/organisations/OrganisationSearchFilters.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,yBAAyB;IAC9B,cAAc,CAAqB;IACnC,MAAM,CAA6B;IACnC,WAAW,CAAuB;IAClC,eAAe,CAAmC;IAClD,eAAe,CAAuB;IACtC,8BAA8B,CAAuB;IACrD,SAAS,CAAuB;IAChC,OAAO,CAAuB;IAC9B,OAAO,CAAuB;IAC9B,
|
|
1
|
+
{"version":3,"file":"OrganisationSearchFilters.js","sourceRoot":"","sources":["../../../src/organisations/OrganisationSearchFilters.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,yBAAyB;IAC9B,cAAc,CAAqB;IACnC,MAAM,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