@eventconnectors/ndtrc_model 1.1.0 → 1.4.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.
Files changed (41) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +105 -0
  3. package/dist/index.cjs +934 -0
  4. package/dist/index.d.cts +58227 -0
  5. package/dist/index.d.ts +58227 -0
  6. package/dist/index.js +829 -0
  7. package/package.json +51 -10
  8. package/.claude/settings.local.json +0 -14
  9. package/CLAUDE.md +0 -54
  10. package/eventconnectors-ndtrc_model-1.0.4.tgz +0 -0
  11. package/index.js +0 -36
  12. package/src/__tests__/model.test.js +0 -327
  13. package/src/model/ConvertedEntry.js +0 -22
  14. package/src/model/FetchedEntry.js +0 -55
  15. package/src/model/ff/Acl.js +0 -13
  16. package/src/model/ff/ItemLink.js +0 -25
  17. package/src/model/ff/Route.js +0 -95
  18. package/src/model/ndtrc/Address.js +0 -70
  19. package/src/model/ndtrc/Calendar.js +0 -255
  20. package/src/model/ndtrc/Categories.js +0 -54
  21. package/src/model/ndtrc/ContactInfo.js +0 -188
  22. package/src/model/ndtrc/ExtraPriceInformation.js +0 -16
  23. package/src/model/ndtrc/File.js +0 -155
  24. package/src/model/ndtrc/GISCoordinate.js +0 -19
  25. package/src/model/ndtrc/Location.js +0 -23
  26. package/src/model/ndtrc/Performer.js +0 -9
  27. package/src/model/ndtrc/PriceElement.js +0 -64
  28. package/src/model/ndtrc/Promotion.js +0 -51
  29. package/src/model/ndtrc/RouteInfo.js +0 -34
  30. package/src/model/ndtrc/SubItemGroup.js +0 -102
  31. package/src/model/ndtrc/TRCItem.js +0 -136
  32. package/src/model/ndtrc/TRCItemCategories.js +0 -105
  33. package/src/model/ndtrc/TRCItemDetail.js +0 -10
  34. package/src/model/ndtrc/TRCItemGroup.js +0 -74
  35. package/src/model/ndtrc/TRCItemRelation.js +0 -13
  36. package/src/model/ndtrc/Translations.js +0 -8
  37. package/src/model/ndtrc/enums.js +0 -33
  38. package/src/resources/schema/NDTRC-types-EVENTS.txt +0 -0
  39. package/src/resources/schema/NDTRC-types-locaties.txt +0 -0
  40. package/src/util/CategoryMap.js +0 -194
  41. package/src/util/StringUtils.js +0 -12
@@ -1,105 +0,0 @@
1
- const StringUtils = require('../../util/StringUtils'); // Import StringUtils voor validaties
2
-
3
- class TRCItemCategories {
4
- constructor({ types = [], categories = [], soldout = null, canceled = null } = {}) {
5
- this.types = types.map(type => new TRCItemCategories.Type(type));
6
- this.categories = categories.map(category => new TRCItemCategories.Category(category));
7
- this.soldout = soldout;
8
- this.canceled = canceled;
9
- }
10
-
11
- cleanEmptyItems() {
12
- this.categories = this.categories.filter(category => {
13
- if (!category || StringUtils.isEmpty(category.catid)) return false;
14
-
15
- const dataType = category.datatype?.toLowerCase();
16
- if (dataType === 'freetext' && !category.value) return false;
17
- if (dataType === 'multichoice' && !category.categoryvalues.length) return false;
18
- if (dataType === 'choice' && !category.valueid) return false;
19
-
20
- return true;
21
- });
22
-
23
- this.types = this.types.filter(type => type && !StringUtils.isEmpty(type.catid));
24
- }
25
- }
26
-
27
- TRCItemCategories.Type = class Type {
28
- constructor({ catid = '', isDefault = false, categoryTranslations = [] } = {}) {
29
- this.catid = catid;
30
- this.isDefault = isDefault;
31
- this.categoryTranslations = categoryTranslations.map(
32
- translation => new TRCItemCategories.CategoryTranslation(translation)
33
- );
34
- }
35
- };
36
-
37
- TRCItemCategories.Category = class Category {
38
- constructor({
39
- catid = '',
40
- valueid = '',
41
- value = '',
42
- datatype = '',
43
- categoryvalues = [],
44
- categoryTranslations = [],
45
- parentCategoryTranslations = [],
46
- valueCategoryTranslations = []
47
- } = {}) {
48
- this.catid = catid;
49
- this.valueid = valueid;
50
- this.value = value;
51
- this.datatype = datatype;
52
- this.categoryvalues = categoryvalues.map(
53
- value => new TRCItemCategories.CategoryValue(value)
54
- );
55
- this.categoryTranslations = categoryTranslations.map(
56
- translation => new TRCItemCategories.CategoryTranslation(translation)
57
- );
58
- this.parentCategoryTranslations = parentCategoryTranslations.map(
59
- translation => new TRCItemCategories.CategoryTranslation(translation)
60
- );
61
- this.valueCategoryTranslations = valueCategoryTranslations.map(
62
- translation => new TRCItemCategories.CategoryTranslation(translation)
63
- );
64
- }
65
- };
66
-
67
- TRCItemCategories.Category.DataType = {
68
- YESNO: 'yesno',
69
- NULLABLE_YESNO: 'nullableyesno',
70
- CHOICE: 'choice',
71
- MULTICHOICE: 'multichoice',
72
- FREETEXT: 'freetext',
73
- INTEGER: 'integer',
74
- DECIMAL: 'decimal',
75
- DATE: 'date'
76
- };
77
-
78
- TRCItemCategories.CategoryValue = class CategoryValue {
79
- constructor({ catid = '', categorytranslations = [] } = {}) {
80
- this.catid = catid;
81
- this.categorytranslations = categorytranslations.map(
82
- translation => new TRCItemCategories.CategoryTranslation(translation)
83
- );
84
- }
85
- };
86
-
87
- TRCItemCategories.CategoryTranslation = class CategoryTranslation {
88
- constructor({
89
- catid = '',
90
- lang = '',
91
- label = '',
92
- unit = '',
93
- value = '',
94
- explanation = ''
95
- } = {}) {
96
- this.catid = catid;
97
- this.lang = lang;
98
- this.label = label;
99
- this.unit = unit;
100
- this.value = value;
101
- this.explanation = explanation;
102
- }
103
- };
104
-
105
- module.exports = TRCItemCategories;
@@ -1,10 +0,0 @@
1
- class TRCItemDetail {
2
- constructor({ lang = '', longdescription = '', shortdescription = '', title = '' } = {}) {
3
- this.lang = lang;
4
- this.longdescription = longdescription;
5
- this.shortdescription = shortdescription;
6
- this.title = title;
7
- }
8
- }
9
-
10
- module.exports = TRCItemDetail;
@@ -1,74 +0,0 @@
1
- const moment = require('moment');
2
- const Calendar = require('./Calendar');
3
- const Contactinfo = require('./ContactInfo');
4
- const TRCItemCategories = require('./TRCItemCategories');
5
- const File = require('./File');
6
- const TRCItemDetail = require('./TRCItemDetail');
7
- const PriceElement = require('./PriceElement');
8
- const Translations = require('./Translations');
9
- const Promotion = require('./Promotion');
10
- const TRCItem = require('./TRCItem');
11
-
12
- class TRCItemGroup {
13
- constructor({
14
- trcid = '',
15
- creationdate = null,
16
- availablefrom = null,
17
- availableto = null,
18
- lastupdated = null,
19
- lastimportedon = null,
20
- createdby = '',
21
- lastupdatedby = '',
22
- owner = '',
23
- legalowner = '',
24
- externalid = '',
25
- validator = '',
26
- wfstatus = null,
27
- calendar = null,
28
- contactinfo = null,
29
- trcItemCategories = null,
30
- files = [],
31
- trcItemDetails = [],
32
- keywords = '',
33
- markers = '',
34
- userorganisation = '',
35
- priceElements = [],
36
- translations = null,
37
- promotions = [],
38
- eventLinks = []
39
- } = {}) {
40
- this.trcid = trcid;
41
- this.creationdate = creationdate ? moment(creationdate) : null;
42
- this.availablefrom = availablefrom ? moment(availablefrom) : null;
43
- this.availableto = availableto ? moment(availableto) : null;
44
- this.lastupdated = lastupdated ? moment(lastupdated) : null;
45
- this.lastimportedon = lastimportedon ? moment(lastimportedon) : null;
46
- this.createdby = createdby;
47
- this.lastupdatedby = lastupdatedby;
48
- this.owner = owner;
49
- this.legalowner = legalowner;
50
- this.externalid = externalid;
51
- this.validator = validator;
52
- this.wfstatus = wfstatus;
53
- this.calendar = calendar ? new Calendar(calendar) : null;
54
- this.contactinfo = contactinfo ? new Contactinfo(contactinfo) : null;
55
- this.trcItemCategories = trcItemCategories ? new TRCItemCategories(trcItemCategories) : null;
56
- this.files = files.map(file => new File(file));
57
- this.trcItemDetails = trcItemDetails.map(detail => new TRCItemDetail(detail));
58
- this.keywords = keywords;
59
- this.markers = markers;
60
- this.userorganisation = userorganisation;
61
- this.priceElements = priceElements.map(element => new PriceElement(element));
62
- this.translations = translations ? new Translations(translations) : new Translations();
63
- this.promotions = promotions.map(promotion => new Promotion(promotion));
64
- this.eventLinks = eventLinks.map(link => new TRCItemGroup.EventLink(link));
65
- }
66
- }
67
-
68
- TRCItemGroup.EventLink = class EventLink {
69
- constructor({ eventId = '' } = {}) {
70
- this.eventId = eventId;
71
- }
72
- };
73
-
74
- module.exports = TRCItemGroup;
@@ -1,13 +0,0 @@
1
- const SubItemGroup = require('./SubItemGroup');
2
-
3
- class TrcitemRelation {
4
- constructor({ subItemGroups = [] } = {}) {
5
- this.subItemGroups = subItemGroups.map(group => new SubItemGroup(group));
6
- }
7
-
8
- cleanEmptyItems() {
9
- this.subItemGroups.forEach(group => group.cleanEmptyItems());
10
- }
11
- }
12
-
13
- module.exports = TrcitemRelation;
@@ -1,8 +0,0 @@
1
- class Translations {
2
- constructor({ primaryLanguage = 'nl', availableLanguages = ['nl'] } = {}) {
3
- this.primaryLanguage = primaryLanguage;
4
- this.availableLanguages = availableLanguages;
5
- }
6
- }
7
-
8
- module.exports = Translations;
@@ -1,33 +0,0 @@
1
- // enums.js
2
-
3
- const Status = Object.freeze({
4
- NORMAL: 'normal',
5
- CANCELLED: 'cancelled',
6
- SOLDOUT: 'soldout',
7
- MOVEDTO: 'movedto',
8
- PREMIERE: 'premiere',
9
- REPPRISE: 'reprise',
10
- });
11
-
12
- const CalendarType = Object.freeze({
13
- NONE: 'NONE',
14
- ALWAYSOPEN: 'ALWAYSOPEN',
15
- ONREQUEST: 'ONREQUEST',
16
- OPENINGTIMES: 'OPENINGTIMES',
17
- PATTERNDATES: 'PATTERNDATES',
18
- SINGLEDATES: 'SINGLEDATES',
19
- });
20
-
21
- const RecurrencyType = Object.freeze({
22
- DAILY: 'daily',
23
- WEEKLY: 'weekly',
24
- MONTHLY_SIMPLE: 'monthlySimple',
25
- MONTHLY_COMPLEX: 'monthlyComplex',
26
- YEARLY: 'yearly',
27
- });
28
-
29
- module.exports = {
30
- Status,
31
- CalendarType,
32
- RecurrencyType,
33
- };
File without changes
File without changes
@@ -1,194 +0,0 @@
1
- const CategoryMap = {
2
- categoryMap: {
3
- "hedendaags|klassiek": {
4
- catId: "2.6.3",
5
- tags: "music;classicalmusic;musicevent",
6
- },
7
- oud: { catId: "2.6.3", tags: "music;classicalmusic;musicevent" },
8
- hedendaags: { catId: "2.6.3", tags: "music;classicalmusic;musicevent" },
9
- concert: { catId: "2.6.5", tags: "music;poprock;musicevent" },
10
- wereldmuziek: { catId: "2.6.2", tags: "music;jazz;worldmusic;musicevent" },
11
- ballet: { catId: "2.9.2", tags: "theatreproduction;dance" },
12
- clubnacht: { catId: "2.6.1", tags: "music;clubbing;dancemusic;musicevent" },
13
- film: { catId: "2.5.2", tags: "filmevent;documentaryfilm" },
14
- expositie: { catId: "2.3.14", tags: "exhibition" },
15
- festival: { catId: "2.4.1", tags: "festivals" },
16
- "dance / elektronisch": {
17
- catId: "2.6.1",
18
- tags: "music;clubbing;dancemusic;musicevent",
19
- },
20
- heavy: { catId: "2.6.5", tags: "music;poprock;musicevent" },
21
- "hiphop / reggae / soul": {
22
- catId: "2.6.6",
23
- tags: "music;rbsoul;clubbing;hiphop;musicevent",
24
- },
25
- "indie / alternative": { catId: "2.6.5", tags: "music;poprock;musicevent" },
26
- pop: { catId: "2.6.5", tags: "music;poprock;musicevent" },
27
- "elektronisch|pop": { catId: "2.6.5", tags: "music;poprock;musicevent" },
28
- "world / roots / jazz": {
29
- catId: "2.6.2",
30
- tags: "music;jazz;worldmusic;musicevent",
31
- },
32
- "world / roots": {
33
- catId: "2.6.2",
34
- tags: "music;jazz;worldmusic;musicevent",
35
- },
36
- jazz: { catId: "2.6.2", tags: "music;jazz;worldmusic;musicevent" },
37
- "bimhuis tipt": {
38
- catId: "2.6.2",
39
- tags: "music;jazz;worldmusic;musicevent",
40
- },
41
- muziek: { catId: "2.6.5", tags: "music;poprock;musicevent" },
42
- cabaret: { catId: "2.9.1", tags: "performingarts;comedy;comedyevents" },
43
- danstheater: { catId: "2.9.2", tags: "dance;performingarts" },
44
- jeugd: { catId: "2.9.3", tags: "performingarts;kids" },
45
- jeugdvoorstelling: { catId: "2.9.3", tags: "performingarts;kids" },
46
- musical: { catId: "2.9.4", tags: "musical;performingarts" },
47
- theater: { catId: "2.9.6", tags: "theatreproduction;performingarts" },
48
- jeugdtheater: {
49
- catId: "2.9.6",
50
- tags: "theatreproduction;performingarts;kids",
51
- },
52
- "expanding theatre": {
53
- catId: "2.9.6",
54
- tags: "theatreproduction;performingarts",
55
- },
56
- "poppen- objecttheater": {
57
- catId: "2.9.6",
58
- tags: "theatreproduction;performingarts",
59
- },
60
- muziektheater: { catId: "2.9.4", tags: "theatreproduction;performingarts" },
61
- specials: { catId: "2.9.8", tags: "theatreproduction;performingarts" },
62
- toneelmuziektheater: {
63
- catId: "2.9.6",
64
- tags: "theatreproduction;performingarts",
65
- },
66
- internationaalmuziektheater: {
67
- catId: "2.9.6",
68
- tags: "theatreproduction;performingarts",
69
- },
70
- muziektheaterinternationaal: {
71
- catId: "2.9.6",
72
- tags: "theatreproduction;performingarts",
73
- },
74
- opera: { catId: "2.9.5", tags: "opera;performingarts" },
75
- show: { catId: "2.9.4", tags: "musical;performingarts" },
76
- educatie: { catId: "2.3.9", tags: "performingarts;spokenword" },
77
- dans: { catId: "2.9.2", tags: "dance;performingarts" },
78
- jeugddans: { catId: "2.9.2", tags: "dance;performingarts;kids" },
79
- dansjeugd: { catId: "2.9.2", tags: "dance;performingarts;kids" },
80
- dansjongeren: { catId: "2.9.2", tags: "dance;performingarts" },
81
- dansinternationaal: { catId: "2.9.2", tags: "dance;performingarts" },
82
- "dans (lnp)": { catId: "2.9.2", tags: "dance;performingarts" },
83
- performance: { catId: "2.9.6", tags: "theatreproduction;performingarts" },
84
- toneel: { catId: "2.9.6", tags: "theatreproduction;performingarts" },
85
- toneelinternationaal: {
86
- catId: "2.9.6",
87
- tags: "theatreproduction;performingarts",
88
- },
89
- internationaaltoneel: {
90
- catId: "2.9.6",
91
- tags: "theatreproduction;performingarts",
92
- },
93
- jeugdtoneel: { catId: "2.9.6", tags: "theatreproduction;performingarts" },
94
- toneeldiversen: {
95
- catId: "2.9.6",
96
- tags: "theatreproduction;performingarts",
97
- },
98
- kleinkunst: { catId: "2.9.6", tags: "theatreproduction;performingarts" },
99
- diversentoneel: {
100
- catId: "2.9.6",
101
- tags: "theatreproduction;performingarts",
102
- },
103
- "poppen- en objecttheater": {
104
- catId: "2.9.6",
105
- tags: "theatreproduction;performingarts",
106
- },
107
- "2.6.3": { catId: "2.6.3", tags: "music;classicalmusic;musicevent" },
108
- familie: { catId: "2.9.3", tags: "performingarts;kids" },
109
- special: { catId: "2.6.8", tags: "music" },
110
- vocal: { catId: "2.6.3", tags: "music;classicalmusic;musicevent" },
111
- zwaargewicht: { catId: "2.9.8", tags: "performingarts" },
112
- impro: { catId: "2.9.1", tags: "performingarts;comedy;comedyevents" },
113
- regulars: { catId: "2.9.8", tags: "performingarts" },
114
- laboratorium: { catId: "2.9.8", tags: "performingarts" },
115
- "theatrale lezing": { catId: "2.3.9", tags: "performingarts;spokenword" },
116
- "nieuw talent": { catId: "2.9.8", tags: "performingarts" },
117
- "van eigen bodem": { catId: "2.6.5", tags: "music;poprock" },
118
- "net bevestigd": { catId: "2.6.5", tags: "music;poprock" },
119
- kindervoorstelling: { catId: "2.9.3", tags: "performingarts;kids" },
120
- comedy: { catId: "2.9.1", tags: "performingarts;comedy;comedyevents" },
121
- storytelling: { catId: "2.3.9", tags: "performingarts;spokenword" },
122
- "nieuwe makers": {
123
- catId: "2.9.6",
124
- tags: "theatreproduction;performingarts",
125
- },
126
- },
127
-
128
- categoryType: {
129
- Beurs: "2.3.1",
130
- Braderie: "2.3.2",
131
- Ceremonie: "2.3.24",
132
- Circus: "2.3.3",
133
- Congres: "2.3.4",
134
- "Corso of Optocht": "2.3.5",
135
- Culinair: "2.3.6",
136
- "Cultureel festival": "2.4.1",
137
- Excursie: "2.7.2",
138
- Fietstocht: "2.3.16",
139
- Filmfestival: "2.4.2",
140
- Folklore: "2.3.7",
141
- "Grootstedelijk evenement": "2.3.23",
142
- Huifkartocht: "2.3.19",
143
- Jeugdfestival: "2.4.5",
144
- Kermis: "2.3.8",
145
- Koopavond: "2.3.22",
146
- Koopzondag: "2.3.21",
147
- "Lezing/Debat": "2.3.9",
148
- Markt: "2.3.10",
149
- Muziekfestival: "2.4.3",
150
- "Open Dag": "2.3.11",
151
- Rommelmarkt: "2.4.6",
152
- Rondleiding: "2.3.12",
153
- Sportevenement: "2.3.13",
154
- Theaterfestival: "2.4.4",
155
- Varia: "2.3.18",
156
- Wandeltocht: "2.3.17",
157
- Winkelen: "2.3.20",
158
- Workshop: "2.3.15",
159
- Film: "2.5.2",
160
- Dance: "2.6.1",
161
- "Gezelschap/orkest": "2.6.9",
162
- Jazz: "2.6.10",
163
- "Jazz of Wereldmuziek": "2.6.2",
164
- "Klassieke muziek": "2.6.3",
165
- "Lichte muziek": "2.6.4",
166
- "Muziek overig": "2.6.8",
167
- "Pop en Rock": "2.6.5",
168
- "R&B en Soul": "2.6.6",
169
- Cabaret: "2.9.1",
170
- "Dans en Ballet": "2.9.2",
171
- Jeugdtheater: "2.9.3",
172
- "Musical of Show": "2.9.4",
173
- Opera: "2.9.5",
174
- Straattheater: "2.9.10",
175
- "Theater en Toneel": "2.9.6",
176
- "Theater overig": "2.9.8",
177
- Tentoonstelling: "2.3.14",
178
- },
179
-
180
- transformCategoryType() {
181
- const transformedCategoryType = {};
182
- for (const [key, value] of Object.entries(this.categoryType)) {
183
- const matchingEntry = Object.entries(this.categoryMap).find(
184
- ([_, entry]) => entry.catId === value
185
- );
186
- transformedCategoryType[key] = matchingEntry
187
- ? matchingEntry[1]
188
- : { catId: value, tags: "" };
189
- }
190
- return transformedCategoryType;
191
- },
192
- };
193
-
194
- module.exports = { CategoryMap };
@@ -1,12 +0,0 @@
1
- class StringUtils {
2
- /**
3
- * Controleert of een string leeg, null of undefined is.
4
- * @param {string|null|undefined} str
5
- * @returns {boolean} true als de string leeg is.
6
- */
7
- static isEmpty(str) {
8
- return !str || str.trim().length === 0;
9
- }
10
- }
11
-
12
- module.exports = StringUtils;