@eventconnectors/ndtrc_model 1.0.6 → 1.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/LICENSE +190 -0
- package/README.md +105 -0
- package/dist/index.cjs +930 -0
- package/dist/index.d.cts +58174 -0
- package/dist/index.d.ts +58174 -0
- package/dist/index.js +826 -0
- package/package.json +52 -11
- package/.claude/settings.local.json +0 -14
- package/CLAUDE.md +0 -54
- package/eventconnectors-ndtrc_model-1.0.4.tgz +0 -0
- package/index.js +0 -31
- package/src/__tests__/model.test.js +0 -327
- package/src/model/ConvertedEntry.js +0 -22
- package/src/model/FetchedEntry.js +0 -55
- package/src/model/ndtrc/Address.js +0 -70
- package/src/model/ndtrc/Calendar.js +0 -255
- package/src/model/ndtrc/Categories.js +0 -54
- package/src/model/ndtrc/ContactInfo.js +0 -188
- package/src/model/ndtrc/ExtraPriceInformation.js +0 -16
- package/src/model/ndtrc/File.js +0 -155
- package/src/model/ndtrc/GISCoordinate.js +0 -19
- package/src/model/ndtrc/Location.js +0 -23
- package/src/model/ndtrc/Performer.js +0 -9
- package/src/model/ndtrc/PriceElement.js +0 -64
- package/src/model/ndtrc/Promotion.js +0 -51
- package/src/model/ndtrc/RouteInfo.js +0 -34
- package/src/model/ndtrc/SubItemGroup.js +0 -102
- package/src/model/ndtrc/TRCItem.js +0 -136
- package/src/model/ndtrc/TRCItemCategories.js +0 -105
- package/src/model/ndtrc/TRCItemDetail.js +0 -10
- package/src/model/ndtrc/TRCItemGroup.js +0 -74
- package/src/model/ndtrc/TRCItemRelation.js +0 -13
- package/src/model/ndtrc/Translations.js +0 -8
- package/src/model/ndtrc/enums.js +0 -33
- package/src/resources/schema/NDTRC-types-EVENTS.txt +0 -0
- package/src/resources/schema/NDTRC-types-locaties.txt +0 -0
- package/src/util/CategoryMap.js +0 -194
- package/src/util/StringUtils.js +0 -12
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
// Calendar.js
|
|
2
|
-
|
|
3
|
-
const moment = require("moment");
|
|
4
|
-
const Contactinfo = require("./ContactInfo");
|
|
5
|
-
|
|
6
|
-
class Calendar {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.singleDates = [];
|
|
9
|
-
this.patternDates = [];
|
|
10
|
-
|
|
11
|
-
this.opens = [];
|
|
12
|
-
this.closeds = [];
|
|
13
|
-
this.soldouts = [];
|
|
14
|
-
this.cancelleds = [];
|
|
15
|
-
|
|
16
|
-
this.excludeholidays = false;
|
|
17
|
-
this.cancelled = false;
|
|
18
|
-
this.soldout = false;
|
|
19
|
-
this.onrequest = false;
|
|
20
|
-
this.alwaysopen = false;
|
|
21
|
-
this.comment = null;
|
|
22
|
-
this.calendarType = null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static CalendarType = {
|
|
26
|
-
NONE: "NONE",
|
|
27
|
-
ALWAYSOPEN: "ALWAYSOPEN",
|
|
28
|
-
ONREQUEST: "ONREQUEST",
|
|
29
|
-
OPENINGTIMES: "OPENINGTIMES",
|
|
30
|
-
PATTERNDATES: "PATTERNDATES",
|
|
31
|
-
SINGLEDATES: "SINGLEDATES",
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
cleanupData() {
|
|
35
|
-
this.singleDates.forEach((singleDate) => {
|
|
36
|
-
if (singleDate.when) {
|
|
37
|
-
singleDate.when = singleDate.when.filter((when) => when.isValid());
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
this.patternDates.forEach((patternDate) => {
|
|
42
|
-
patternDate.opens.forEach((open) => {
|
|
43
|
-
open.whens = open.whens.filter((when) => when.isValid());
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (patternDate.opens.length && !patternDate.recurrencyType) {
|
|
47
|
-
patternDate.recurrencyType = PatternDate.RecurrencyType.WEEKLY;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
["opens", "closeds", "cancelleds", "soldouts"].forEach((prop) => {
|
|
52
|
-
this[prop].forEach((exceptionDate) => {
|
|
53
|
-
exceptionDate.whens = exceptionDate.whens.filter((when) =>
|
|
54
|
-
when.isValid()
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
determineCalendarType() {
|
|
61
|
-
if (this.calendarType !== null) return;
|
|
62
|
-
|
|
63
|
-
if (this.alwaysopen) {
|
|
64
|
-
this.calendarType = Calendar.CalendarType.ALWAYSOPEN;
|
|
65
|
-
} else if (this.onrequest) {
|
|
66
|
-
this.calendarType = Calendar.CalendarType.ONREQUEST;
|
|
67
|
-
} else if (this.singleDates.length > 0) {
|
|
68
|
-
this.calendarType = Calendar.CalendarType.SINGLEDATES;
|
|
69
|
-
} else if (this.patternDates.length > 0) {
|
|
70
|
-
const firstPattern = this.patternDates[0];
|
|
71
|
-
if (!firstPattern.enddate && !firstPattern.startdate) {
|
|
72
|
-
this.calendarType = Calendar.CalendarType.OPENINGTIMES;
|
|
73
|
-
} else {
|
|
74
|
-
this.calendarType = Calendar.CalendarType.PATTERNDATES;
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
this.calendarType = Calendar.CalendarType.NONE;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class SingleDate {
|
|
83
|
-
constructor(date = null, when = []) {
|
|
84
|
-
this.date = date ? moment(date) : null;
|
|
85
|
-
this.when = when;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
equals(other) {
|
|
89
|
-
if (this === other) return true;
|
|
90
|
-
if (!(other instanceof SingleDate)) return false;
|
|
91
|
-
|
|
92
|
-
if (!this.date.isSame(other.date)) return false;
|
|
93
|
-
if (this.when.length !== other.when.length) return false;
|
|
94
|
-
|
|
95
|
-
return this.when.every((when, index) => when.equals(other.when[index]));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
class PatternDate {
|
|
100
|
-
constructor() {
|
|
101
|
-
this.startdate = null;
|
|
102
|
-
this.enddate = null;
|
|
103
|
-
this.recurrencyType = null;
|
|
104
|
-
|
|
105
|
-
this.occurrence = null;
|
|
106
|
-
this.recurrence = null;
|
|
107
|
-
this.opens = [];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
static RecurrencyType = {
|
|
111
|
-
DAILY: "daily",
|
|
112
|
-
WEEKLY: "weekly",
|
|
113
|
-
MONTHLY_SIMPLE: "monthlySimple",
|
|
114
|
-
MONTHLY_COMPLEX: "monthlyComplex",
|
|
115
|
-
YEARLY: "yearly",
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
equals(other) {
|
|
119
|
-
if (this === other) return true;
|
|
120
|
-
if (!(other instanceof PatternDate)) return false;
|
|
121
|
-
|
|
122
|
-
const datesEqual =
|
|
123
|
-
(!this.startdate && !other.startdate) ||
|
|
124
|
-
this.startdate.isSame(other.startdate);
|
|
125
|
-
const endDatesEqual =
|
|
126
|
-
(!this.enddate && !other.enddate) || this.enddate.isSame(other.enddate);
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
datesEqual &&
|
|
130
|
-
endDatesEqual &&
|
|
131
|
-
this.recurrencyType === other.recurrencyType &&
|
|
132
|
-
this.occurrence === other.occurrence &&
|
|
133
|
-
this.recurrence === other.recurrence &&
|
|
134
|
-
this.opensEquals(other.opens)
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
opensEquals(otherOpens) {
|
|
139
|
-
if (this.opens.length !== otherOpens.length) return false;
|
|
140
|
-
return this.opens.every((open, index) => open.equals(otherOpens[index]));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
class Open {
|
|
145
|
-
constructor() {
|
|
146
|
-
this.month = null;
|
|
147
|
-
this.weeknumber = null;
|
|
148
|
-
this.daynumber = null;
|
|
149
|
-
this.day = null;
|
|
150
|
-
this.whens = [];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
equals(other) {
|
|
154
|
-
if (this === other) return true;
|
|
155
|
-
if (!(other instanceof Open)) return false;
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
this.month === other.month &&
|
|
159
|
-
this.weeknumber === other.weeknumber &&
|
|
160
|
-
this.daynumber === other.daynumber &&
|
|
161
|
-
this.day === other.day &&
|
|
162
|
-
this.whensEquals(other.whens)
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
whensEquals(otherWhens) {
|
|
167
|
-
if (this.whens.length !== otherWhens.length) return false;
|
|
168
|
-
return this.whens.every((when, index) => when.equals(otherWhens[index]));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
class When {
|
|
173
|
-
constructor(timestart = null, timeend = null, status = null, valid=null) {
|
|
174
|
-
this.timestart = timestart;
|
|
175
|
-
this.valid = valid;
|
|
176
|
-
this.timeend = timeend;
|
|
177
|
-
this.status = status;
|
|
178
|
-
this.statustranslations = [];
|
|
179
|
-
this.extrainformations = [];
|
|
180
|
-
this.url = Contactinfo.Url ? new Contactinfo.Url() : [];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
equals(other) {
|
|
184
|
-
if (this === other) return true;
|
|
185
|
-
if (!(other instanceof When)) return false;
|
|
186
|
-
|
|
187
|
-
return this.timestart === other.timestart && this.timeend === other.timeend;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
isValid() {
|
|
191
|
-
return this.isTimeValid(this.timestart) || this.isTimeValid(this.timeend);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
isTimeValid(time) {
|
|
195
|
-
return time && time.trim().length > 0;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
static Status = {
|
|
199
|
-
NORMAL: "normal",
|
|
200
|
-
CANCELLED: "cancelled",
|
|
201
|
-
SOLDOUT: "soldout",
|
|
202
|
-
MOVEDTO: "movedto",
|
|
203
|
-
PREMIERE: "premiere",
|
|
204
|
-
REPRISE: "reprise",
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
class StatusTranslation {
|
|
209
|
-
constructor(lang = null, text = null) {
|
|
210
|
-
this.lang = lang;
|
|
211
|
-
this.text = text;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
class ExtraInformation {
|
|
216
|
-
constructor(lang = null, text = null) {
|
|
217
|
-
this.lang = lang;
|
|
218
|
-
this.text = text;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
class ExceptionDate {
|
|
223
|
-
constructor(date = null, whens = []) {
|
|
224
|
-
this.date = date ? moment(date) : null;
|
|
225
|
-
this.whens = whens;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
class Comment {
|
|
230
|
-
constructor(label = null, commentTranslations = []) {
|
|
231
|
-
this.label = label;
|
|
232
|
-
this.commentTranslations = commentTranslations;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
class CommentTranslation {
|
|
237
|
-
constructor(label = null, lang = null) {
|
|
238
|
-
this.label = label;
|
|
239
|
-
this.lang = lang;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Export the classes
|
|
244
|
-
module.exports = {
|
|
245
|
-
Calendar,
|
|
246
|
-
SingleDate,
|
|
247
|
-
PatternDate,
|
|
248
|
-
Open,
|
|
249
|
-
When,
|
|
250
|
-
StatusTranslation,
|
|
251
|
-
ExtraInformation,
|
|
252
|
-
ExceptionDate,
|
|
253
|
-
Comment,
|
|
254
|
-
CommentTranslation,
|
|
255
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// FeedData.js
|
|
2
|
-
|
|
3
|
-
const categories = {
|
|
4
|
-
"evenementen": "2.3",
|
|
5
|
-
"Beurs": "2.3.1",
|
|
6
|
-
"Braderie": "2.3.2",
|
|
7
|
-
"Congres": "2.3.4",
|
|
8
|
-
"Corso of Optocht": "2.3.5",
|
|
9
|
-
"Culinair": "2.3.6",
|
|
10
|
-
"Excursie": "2.7.2",
|
|
11
|
-
"Kermis": "2.3.8",
|
|
12
|
-
"Lezing/Debat": "2.3.9",
|
|
13
|
-
"Markt": "2.3.10",
|
|
14
|
-
"Open Dag": "2.3.11",
|
|
15
|
-
"Rondleiding": "2.3.12",
|
|
16
|
-
"Sportevenement": "2.3.13",
|
|
17
|
-
"Workshop": "2.3.15",
|
|
18
|
-
"Wandeltocht": "2.3.17",
|
|
19
|
-
"Varia": "2.3.18",
|
|
20
|
-
"Grootstedelijk evenement": "2.3.23",
|
|
21
|
-
"Rommelmarkt": "2.4.6",
|
|
22
|
-
"Film": "2.5.2",
|
|
23
|
-
"Jeugd": "2.3.25",
|
|
24
|
-
"Wijkfeest": "2.3.26",
|
|
25
|
-
"Speeltuin": "2.3.27",
|
|
26
|
-
"Festivals": "2.4",
|
|
27
|
-
"Cultureel festival": "2.4.1",
|
|
28
|
-
"Filmfestival": "2.4.2",
|
|
29
|
-
"Muziekfestival": "2.4.3",
|
|
30
|
-
"Theaterfestival": "2.4.4",
|
|
31
|
-
"Jeugdfestival": "2.4.5",
|
|
32
|
-
"Festival": "2.4.7",
|
|
33
|
-
"Dancefestival": "2.4.8",
|
|
34
|
-
"Muziek": "2.6",
|
|
35
|
-
"Dance": "2.6.1",
|
|
36
|
-
"Jazz of Wereldmuziek": "2.6.2",
|
|
37
|
-
"Klassieke muziek": "2.6.3",
|
|
38
|
-
"Lichte muziek": "2.6.4",
|
|
39
|
-
"Pop en Rock": "2.6.5",
|
|
40
|
-
"R&B en Soul": "2.6.6",
|
|
41
|
-
"Muziek overig": "2.6.8",
|
|
42
|
-
"Gezelschap/orkest": "2.6.9",
|
|
43
|
-
"Theater": "2.9",
|
|
44
|
-
"Cabaret": "2.9.1",
|
|
45
|
-
"Dans en Ballet": "2.9.2",
|
|
46
|
-
"Jeugdtheater": "2.9.3",
|
|
47
|
-
"Musical of Show": "2.9.4",
|
|
48
|
-
"Opera": "2.9.5",
|
|
49
|
-
"Theater en Toneel": "2.9.6",
|
|
50
|
-
"Tentoonstellingen": "2.12",
|
|
51
|
-
"Tentoonstelling": "2.3.14"
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
module.exports = { categories };
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
const StringUtils = require('../../util/StringUtils'); // Import StringUtils voor validaties
|
|
2
|
-
|
|
3
|
-
class Contactinfo {
|
|
4
|
-
constructor({
|
|
5
|
-
label = '',
|
|
6
|
-
mails = [],
|
|
7
|
-
phones = [],
|
|
8
|
-
faxes = [],
|
|
9
|
-
urls = [],
|
|
10
|
-
addresses = [],
|
|
11
|
-
mail = null,
|
|
12
|
-
phone = null,
|
|
13
|
-
fax = null,
|
|
14
|
-
address = null
|
|
15
|
-
} = {}) {
|
|
16
|
-
this.label = label;
|
|
17
|
-
this.mails = mails.map(mail => new Contactinfo.Mail(mail));
|
|
18
|
-
this.phones = phones.map(phone => new Contactinfo.Phone(phone));
|
|
19
|
-
this.faxes = faxes.map(fax => new Contactinfo.Fax(fax));
|
|
20
|
-
this.urls = urls.map(url => new Contactinfo.Url(url));
|
|
21
|
-
this.addresses = addresses.map(address => new Contactinfo.Address(address));
|
|
22
|
-
this.mail = mail ? new Contactinfo.Mail(mail) : null;
|
|
23
|
-
this.phone = phone ? new Contactinfo.Phone(phone) : null;
|
|
24
|
-
this.fax = fax ? new Contactinfo.Fax(fax) : null;
|
|
25
|
-
this.address = address ? new Contactinfo.Address(address) : null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Converteert naar V1 formaat.
|
|
30
|
-
*/
|
|
31
|
-
convertToV1() {
|
|
32
|
-
if (this.mails.length && (!this.mail || this.mail.isEmpty())) {
|
|
33
|
-
this.mail = this.mails[0];
|
|
34
|
-
}
|
|
35
|
-
if (this.addresses.length && (!this.address || this.address.isEmpty())) {
|
|
36
|
-
this.address = this.addresses[0];
|
|
37
|
-
}
|
|
38
|
-
if (this.faxes.length && (!this.fax || this.fax.isEmpty())) {
|
|
39
|
-
this.fax = this.faxes[0];
|
|
40
|
-
}
|
|
41
|
-
if (this.phones.length && (!this.phone || this.phone.isEmpty())) {
|
|
42
|
-
this.phone = this.phones[0];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Converteert naar V2 formaat.
|
|
48
|
-
*/
|
|
49
|
-
convertToV2() {
|
|
50
|
-
this.mails = this.mail ? [this.mail] : [];
|
|
51
|
-
this.addresses = this.address ? [this.address] : [];
|
|
52
|
-
this.faxes = this.fax ? [this.fax] : [];
|
|
53
|
-
this.phones = this.phone ? [this.phone] : [];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Subklasse: Mail
|
|
59
|
-
*/
|
|
60
|
-
Contactinfo.Mail = class Mail {
|
|
61
|
-
constructor({
|
|
62
|
-
email = '',
|
|
63
|
-
descriptioncode = '',
|
|
64
|
-
reservations = false,
|
|
65
|
-
descriptionTranslations = []
|
|
66
|
-
} = {}) {
|
|
67
|
-
this.email = email;
|
|
68
|
-
this.descriptioncode = descriptioncode;
|
|
69
|
-
this.reservations = reservations;
|
|
70
|
-
this.descriptionTranslations = descriptionTranslations.map(
|
|
71
|
-
translation => new Contactinfo.DescriptionTranslation(translation)
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
isEmpty() {
|
|
76
|
-
return StringUtils.isEmpty(this.email);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Subklasse: Phone
|
|
82
|
-
*/
|
|
83
|
-
Contactinfo.Phone = class Phone {
|
|
84
|
-
constructor({
|
|
85
|
-
number = '',
|
|
86
|
-
descriptioncode = '',
|
|
87
|
-
reservations = false,
|
|
88
|
-
descriptionTranslations = []
|
|
89
|
-
} = {}) {
|
|
90
|
-
this.number = number;
|
|
91
|
-
this.descriptioncode = descriptioncode;
|
|
92
|
-
this.reservations = reservations;
|
|
93
|
-
this.descriptionTranslations = descriptionTranslations.map(
|
|
94
|
-
translation => new Contactinfo.DescriptionTranslation(translation)
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
isEmpty() {
|
|
99
|
-
return StringUtils.isEmpty(this.number);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Subklasse: Fax
|
|
105
|
-
*/
|
|
106
|
-
Contactinfo.Fax = class Fax {
|
|
107
|
-
constructor({
|
|
108
|
-
number = '',
|
|
109
|
-
descriptioncode = '',
|
|
110
|
-
reservations = false,
|
|
111
|
-
descriptionTranslations = []
|
|
112
|
-
} = {}) {
|
|
113
|
-
this.number = number;
|
|
114
|
-
this.descriptioncode = descriptioncode;
|
|
115
|
-
this.reservations = reservations;
|
|
116
|
-
this.descriptionTranslations = descriptionTranslations.map(
|
|
117
|
-
translation => new Contactinfo.DescriptionTranslation(translation)
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
isEmpty() {
|
|
122
|
-
return StringUtils.isEmpty(this.number);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Subklasse: Url
|
|
128
|
-
*/
|
|
129
|
-
Contactinfo.Url = class Url {
|
|
130
|
-
constructor({
|
|
131
|
-
url = null,
|
|
132
|
-
descriptioncode = '',
|
|
133
|
-
targetLanguage = '',
|
|
134
|
-
reservations = false,
|
|
135
|
-
urlServiceType = null,
|
|
136
|
-
descriptionTranslations = []
|
|
137
|
-
} = {}) {
|
|
138
|
-
this.url = url;
|
|
139
|
-
this.descriptioncode = descriptioncode;
|
|
140
|
-
this.targetLanguage = targetLanguage;
|
|
141
|
-
this.reservations = reservations;
|
|
142
|
-
this.urlServiceType = urlServiceType;
|
|
143
|
-
this.descriptionTranslations = descriptionTranslations.map(
|
|
144
|
-
translation => new Contactinfo.DescriptionTranslation(translation)
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
isEmpty() {
|
|
149
|
-
return this.url === null;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
static getTypeFromString(type) {
|
|
153
|
-
if (!Contactinfo.Url.URLServiceType[type]) {
|
|
154
|
-
throw new Error(`No enum found with type: ${type}`);
|
|
155
|
-
}
|
|
156
|
-
return Contactinfo.Url.URLServiceType[type];
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Enum: URLServiceType
|
|
162
|
-
*/
|
|
163
|
-
Contactinfo.Url.URLServiceType = {
|
|
164
|
-
general: 'general',
|
|
165
|
-
booking: 'booking',
|
|
166
|
-
review: 'review',
|
|
167
|
-
video: 'video',
|
|
168
|
-
webshop: 'webshop',
|
|
169
|
-
socialmedia: 'socialmedia',
|
|
170
|
-
lastminute: 'lastminute',
|
|
171
|
-
virtualtour: 'virtualtour',
|
|
172
|
-
dmo: 'dmo',
|
|
173
|
-
sustainability: 'sustainability',
|
|
174
|
-
venuefinder: 'venuefinder',
|
|
175
|
-
travelbase: 'travelbase'
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Subklasse: DescriptionTranslation
|
|
180
|
-
*/
|
|
181
|
-
Contactinfo.DescriptionTranslation = class DescriptionTranslation {
|
|
182
|
-
constructor({ lang = '', label = '' } = {}) {
|
|
183
|
-
this.lang = lang;
|
|
184
|
-
this.label = label;
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
module.exports = Contactinfo;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class ExtraPriceInformation {
|
|
2
|
-
constructor({ lang = '', text = '' } = {}) {
|
|
3
|
-
this.lang = lang;
|
|
4
|
-
this.text = text;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Controleert of de velden leeg zijn.
|
|
9
|
-
* @returns {boolean}
|
|
10
|
-
*/
|
|
11
|
-
isEmpty() {
|
|
12
|
-
return !this.lang && !this.text;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = ExtraPriceInformation;
|
package/src/model/ndtrc/File.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
class File {
|
|
2
|
-
constructor({
|
|
3
|
-
trcid = '',
|
|
4
|
-
main = false,
|
|
5
|
-
copyright = '',
|
|
6
|
-
filename = '',
|
|
7
|
-
hlink = '',
|
|
8
|
-
filetype = null,
|
|
9
|
-
mediatype = null,
|
|
10
|
-
targetLanguage = '',
|
|
11
|
-
title = null
|
|
12
|
-
} = {}) {
|
|
13
|
-
this.trcid = trcid;
|
|
14
|
-
this.main = main;
|
|
15
|
-
this.copyright = copyright;
|
|
16
|
-
this.filename = filename;
|
|
17
|
-
this.hlink = hlink;
|
|
18
|
-
this.filetype = filetype;
|
|
19
|
-
this.mediatype = mediatype;
|
|
20
|
-
this.targetLanguage = targetLanguage;
|
|
21
|
-
this.title = title ? new File.Title(title) : null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Schoont de data van de file op.
|
|
26
|
-
*/
|
|
27
|
-
cleanupData() {
|
|
28
|
-
if (this.filetype && !this.mediatype) {
|
|
29
|
-
if (['vimeo', 'youtube'].includes(this.filetype)) {
|
|
30
|
-
this.mediatype = File.MediaType.video;
|
|
31
|
-
} else if (
|
|
32
|
-
['jpg', 'jpeg', 'gif', 'png', 'bmp', 'jfif', 'tiff', 'webp'].includes(this.filetype)
|
|
33
|
-
) {
|
|
34
|
-
this.mediatype = File.MediaType.photo;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (this.hlink && this.filetype === File.FileType.youtube) {
|
|
39
|
-
this.hlink = File.normalizeYouTubeURL(this.hlink);
|
|
40
|
-
this.filename = File.youtubeVideoID(this.hlink);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Normaliseert een YouTube-URL naar een standaardformaat.
|
|
46
|
-
* @param {string} url
|
|
47
|
-
* @returns {string} Genormaliseerde YouTube-URL
|
|
48
|
-
*/
|
|
49
|
-
static normalizeYouTubeURL(url) {
|
|
50
|
-
if (!url?.trim()) return url;
|
|
51
|
-
|
|
52
|
-
const standardPattern = /https:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/;
|
|
53
|
-
const shortenedPattern = /https:\/\/youtu\.be\/([a-zA-Z0-9_-]+)/;
|
|
54
|
-
const embedPattern = /https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]+)/;
|
|
55
|
-
|
|
56
|
-
let match = url.match(standardPattern);
|
|
57
|
-
if (match) return `https://www.youtube.com/watch?v=${match[1]}`;
|
|
58
|
-
|
|
59
|
-
match = url.match(shortenedPattern);
|
|
60
|
-
if (match) return `https://www.youtube.com/watch?v=${match[1]}`;
|
|
61
|
-
|
|
62
|
-
match = url.match(embedPattern);
|
|
63
|
-
if (match) return `https://www.youtube.com/watch?v=${match[1]}`;
|
|
64
|
-
|
|
65
|
-
return url; // Als geen van de patronen overeenkomt, retourneer de oorspronkelijke URL
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Extraheert de video-ID van een YouTube-URL.
|
|
70
|
-
* @param {string} url
|
|
71
|
-
* @returns {string|null} YouTube-video-ID
|
|
72
|
-
*/
|
|
73
|
-
static youtubeVideoID(url) {
|
|
74
|
-
if (!url?.trim()) return null;
|
|
75
|
-
|
|
76
|
-
const standardPattern = /https:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/;
|
|
77
|
-
const shortenedPattern = /https:\/\/youtu\.be\/([a-zA-Z0-9_-]+)/;
|
|
78
|
-
const embedPattern = /https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]+)/;
|
|
79
|
-
|
|
80
|
-
let match = url.match(standardPattern);
|
|
81
|
-
if (match) return match[1];
|
|
82
|
-
|
|
83
|
-
match = url.match(shortenedPattern);
|
|
84
|
-
if (match) return match[1];
|
|
85
|
-
|
|
86
|
-
match = url.match(embedPattern);
|
|
87
|
-
if (match) return match[1];
|
|
88
|
-
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Subklasse: Title
|
|
95
|
-
*/
|
|
96
|
-
File.Title = class Title {
|
|
97
|
-
constructor({ label = '', titleTranslations = [] } = {}) {
|
|
98
|
-
this.label = label;
|
|
99
|
-
this.titleTranslations = titleTranslations.map(
|
|
100
|
-
translation => new File.Title.TitleTranslation(translation)
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Subklasse: TitleTranslation
|
|
107
|
-
*/
|
|
108
|
-
File.Title.TitleTranslation = class TitleTranslation {
|
|
109
|
-
constructor({ lang = '', label = '' } = {}) {
|
|
110
|
-
this.lang = lang;
|
|
111
|
-
this.label = label;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Enum: FileType
|
|
117
|
-
*/
|
|
118
|
-
File.FileType = {
|
|
119
|
-
jpeg: 'jpeg',
|
|
120
|
-
jpg: 'jpg',
|
|
121
|
-
gif: 'gif',
|
|
122
|
-
png: 'png',
|
|
123
|
-
mp3: 'mp3',
|
|
124
|
-
pdf: 'pdf',
|
|
125
|
-
gpx: 'gpx',
|
|
126
|
-
kml: 'kml',
|
|
127
|
-
youtube: 'youtube',
|
|
128
|
-
kmz: 'kmz',
|
|
129
|
-
vimeo: 'vimeo',
|
|
130
|
-
tif: 'tif',
|
|
131
|
-
bmp: 'bmp',
|
|
132
|
-
jfif: 'jfif',
|
|
133
|
-
tiff: 'tiff',
|
|
134
|
-
webp: 'webp'
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Enum: MediaType
|
|
139
|
-
*/
|
|
140
|
-
File.MediaType = {
|
|
141
|
-
poster: 'poster',
|
|
142
|
-
other: 'other',
|
|
143
|
-
audio: 'audio',
|
|
144
|
-
brochure: 'brochure',
|
|
145
|
-
floorplan: 'floorplan',
|
|
146
|
-
photo: 'photo',
|
|
147
|
-
logo: 'logo',
|
|
148
|
-
video: 'video',
|
|
149
|
-
roadmap: 'roadmap',
|
|
150
|
-
text: 'text',
|
|
151
|
-
attachment: 'attachment',
|
|
152
|
-
qr: 'qr'
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
module.exports = File;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const StringUtils = require('../../util/StringUtils'); // Import StringUtils voor validaties
|
|
2
|
-
|
|
3
|
-
class GISCoordinate {
|
|
4
|
-
constructor({ xcoordinate = '', ycoordinate = '', label = '' } = {}) {
|
|
5
|
-
this.xcoordinate = xcoordinate;
|
|
6
|
-
this.ycoordinate = ycoordinate;
|
|
7
|
-
this.label = label;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Controleert of de GIS-coördinaten leeg zijn.
|
|
12
|
-
* @returns {boolean}
|
|
13
|
-
*/
|
|
14
|
-
isEmpty() {
|
|
15
|
-
return StringUtils.isEmpty(this.xcoordinate) && StringUtils.isEmpty(this.ycoordinate);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = GISCoordinate;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const Address = require('./Address'); // Importeer de Address-klasse
|
|
2
|
-
|
|
3
|
-
class Location {
|
|
4
|
-
constructor({ address = null, label = '', locationItem = null, venueItem = null } = {}) {
|
|
5
|
-
this.address = address ? new Address(address) : null;
|
|
6
|
-
this.label = label;
|
|
7
|
-
this.locationItem = locationItem ? new Location.LocationItem(locationItem) : null;
|
|
8
|
-
this.venueItem = venueItem ? new Location.LocationItem(venueItem) : null;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Subklasse: LocationItem
|
|
14
|
-
*/
|
|
15
|
-
Location.LocationItem = class LocationItem {
|
|
16
|
-
constructor({ id = '', trcid = '', text = '' } = {}) {
|
|
17
|
-
this.id = id;
|
|
18
|
-
this.trcid = trcid;
|
|
19
|
-
this.text = text;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
module.exports = Location;
|