@themeparks/typelib 1.0.4 → 1.1.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.
@@ -0,0 +1,345 @@
1
+ // THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY
2
+
3
+ export enum LanguageCodeEnum {
4
+ "en" = 'en',
5
+ "en-gb" = 'en-gb',
6
+ "en-us" = 'en-us',
7
+ "de" = 'de',
8
+ "fr" = 'fr',
9
+ "es" = 'es',
10
+ "it" = 'it',
11
+ "nl" = 'nl',
12
+ "ja" = 'ja',
13
+ "ko" = 'ko',
14
+ "zh" = 'zh',
15
+ }
16
+
17
+ /** Supported language codes for ThemeParks.wiki */
18
+ export type LanguageCode = keyof typeof LanguageCodeEnum;
19
+
20
+ // Function to convert string to LanguageCodeEnum
21
+ export function StringToLanguageCode(value: string): LanguageCodeEnum {
22
+ const lowerValue = value.toLowerCase();
23
+ switch (lowerValue) {
24
+ case 'en':
25
+ return LanguageCodeEnum.en;
26
+ case 'en-gb':
27
+ return LanguageCodeEnum["en-gb"];
28
+ case 'en-us':
29
+ return LanguageCodeEnum["en-us"];
30
+ case 'de':
31
+ return LanguageCodeEnum.de;
32
+ case 'fr':
33
+ return LanguageCodeEnum.fr;
34
+ case 'es':
35
+ return LanguageCodeEnum.es;
36
+ case 'it':
37
+ return LanguageCodeEnum.it;
38
+ case 'nl':
39
+ return LanguageCodeEnum.nl;
40
+ case 'ja':
41
+ return LanguageCodeEnum.ja;
42
+ case 'ko':
43
+ return LanguageCodeEnum.ko;
44
+ case 'zh':
45
+ return LanguageCodeEnum.zh;
46
+ }
47
+ throw new Error('Unknown LanguageCode value: ' + value);
48
+ }
49
+
50
+ /** A string with multiple language translations */
51
+ export interface MultilangString extends Partial<Record<LanguageCode, string>> {}
52
+
53
+ /** A string that may be localised or a simple string */
54
+ export type LocalisedString = MultilangString | string;
55
+
56
+ export enum EntityTypeEnum {
57
+ "DESTINATION" = 'DESTINATION',
58
+ "PARK" = 'PARK',
59
+ "ATTRACTION" = 'ATTRACTION',
60
+ "RESTAURANT" = 'RESTAURANT',
61
+ "SHOW" = 'SHOW',
62
+ "HOTEL" = 'HOTEL',
63
+ }
64
+
65
+ /** Possible types of entity in ThemeParks.wiki */
66
+ export type EntityType = keyof typeof EntityTypeEnum;
67
+
68
+ // Function to convert string to EntityTypeEnum
69
+ export function StringToEntityType(value: string): EntityTypeEnum {
70
+ const lowerValue = value.toLowerCase();
71
+ switch (lowerValue) {
72
+ case 'destination':
73
+ return EntityTypeEnum.DESTINATION;
74
+ case 'park':
75
+ return EntityTypeEnum.PARK;
76
+ case 'attraction':
77
+ return EntityTypeEnum.ATTRACTION;
78
+ case 'restaurant':
79
+ return EntityTypeEnum.RESTAURANT;
80
+ case 'show':
81
+ return EntityTypeEnum.SHOW;
82
+ case 'hotel':
83
+ return EntityTypeEnum.HOTEL;
84
+ }
85
+ throw new Error('Unknown EntityType value: ' + value);
86
+ }
87
+
88
+ export enum AttractionTypeEnum {
89
+ "UNKNOWN" = 'UNKNOWN',
90
+ "RIDE" = 'RIDE',
91
+ "SHOW" = 'SHOW',
92
+ "TRANSPORT" = 'TRANSPORT',
93
+ "PARADE" = 'PARADE',
94
+ "MEET_AND_GREET" = 'MEET_AND_GREET',
95
+ "OTHER" = 'OTHER',
96
+ }
97
+
98
+ /** Possible types of attraction in ThemeParks.wiki */
99
+ export type AttractionType = keyof typeof AttractionTypeEnum;
100
+
101
+ // Function to convert string to AttractionTypeEnum
102
+ export function StringToAttractionType(value: string): AttractionTypeEnum {
103
+ const lowerValue = value.toLowerCase();
104
+ switch (lowerValue) {
105
+ case 'unknown':
106
+ return AttractionTypeEnum.UNKNOWN;
107
+ case 'ride':
108
+ return AttractionTypeEnum.RIDE;
109
+ case 'show':
110
+ return AttractionTypeEnum.SHOW;
111
+ case 'transport':
112
+ return AttractionTypeEnum.TRANSPORT;
113
+ case 'parade':
114
+ return AttractionTypeEnum.PARADE;
115
+ case 'meet_and_greet':
116
+ return AttractionTypeEnum.MEET_AND_GREET;
117
+ case 'other':
118
+ return AttractionTypeEnum.OTHER;
119
+ }
120
+ throw new Error('Unknown AttractionType value: ' + value);
121
+ }
122
+
123
+ export type EntityLocation = {
124
+
125
+ /** Latitude coordinate of the entity location */
126
+ latitude?: number | null;
127
+
128
+ /** Longitude coordinate of the entity location */
129
+ longitude?: number | null;
130
+ }
131
+
132
+ export type TagData = {
133
+
134
+ /** Tag identifier */
135
+ tag: string;
136
+
137
+ /** Human readable tag name */
138
+ tagName: string;
139
+
140
+ /** Unique identifier */
141
+ id?: string;
142
+
143
+ /** Tag value - can be string, number or object */
144
+ value?: any;
145
+ }
146
+
147
+ export type Entity = {
148
+
149
+ /** Unique entity identifier */
150
+ id: string;
151
+
152
+ /** Entity name */
153
+ name: LocalisedString;
154
+
155
+ /** Type of entity */
156
+ entityType: EntityType;
157
+
158
+ /** Parent entity identifier, must always be set when entityType is not DESTINATION */
159
+ parentId?: string | null;
160
+
161
+ /** Destination identifier, must always be set when entityType is not DESTINATION */
162
+ destinationId?: string | null;
163
+
164
+ /** Park identifier, must be set if any parent entity in the hierarchy is a park */
165
+ parkId?: string | null;
166
+
167
+ /** Entity timezone */
168
+ timezone: string;
169
+
170
+ /** Entity location coordinates */
171
+ location?: EntityLocation;
172
+
173
+ /** Array of tags associated with the entity */
174
+ tags?: TagData[];
175
+ }
176
+
177
+
178
+ // Runtime Schema Registration
179
+ import { registerTypeSchema } from "../type_register.js";
180
+
181
+ registerTypeSchema("LanguageCode", {
182
+ "type": "string",
183
+ "enum": [
184
+ "en",
185
+ "en-gb",
186
+ "en-us",
187
+ "de",
188
+ "fr",
189
+ "es",
190
+ "it",
191
+ "nl",
192
+ "ja",
193
+ "ko",
194
+ "zh"
195
+ ],
196
+ "description": "Supported language codes for ThemeParks.wiki"
197
+ });
198
+
199
+ registerTypeSchema("MultilangString", {
200
+ "type": "object",
201
+ "description": "A string with multiple language translations",
202
+ "propertyNames": {
203
+ "$ref": "#/properties/LanguageCode"
204
+ },
205
+ "additionalProperties": {
206
+ "type": "string",
207
+ "description": "The string in the specified language"
208
+ }
209
+ });
210
+
211
+ registerTypeSchema("LocalisedString", {
212
+ "oneOf": [
213
+ {
214
+ "$ref": "#/properties/MultilangString"
215
+ },
216
+ {
217
+ "type": "string",
218
+ "description": "A simple string, no localisation. English where available, or native language if not."
219
+ }
220
+ ],
221
+ "description": "A string that may be localised or a simple string"
222
+ });
223
+
224
+ registerTypeSchema("EntityType", {
225
+ "type": "string",
226
+ "enum": [
227
+ "DESTINATION",
228
+ "PARK",
229
+ "ATTRACTION",
230
+ "RESTAURANT",
231
+ "SHOW",
232
+ "HOTEL"
233
+ ],
234
+ "description": "Possible types of entity in ThemeParks.wiki"
235
+ });
236
+
237
+ registerTypeSchema("AttractionType", {
238
+ "type": "string",
239
+ "enum": [
240
+ "UNKNOWN",
241
+ "RIDE",
242
+ "SHOW",
243
+ "TRANSPORT",
244
+ "PARADE",
245
+ "MEET_AND_GREET",
246
+ "OTHER"
247
+ ],
248
+ "description": "Possible types of attraction in ThemeParks.wiki"
249
+ });
250
+
251
+ registerTypeSchema("EntityLocation", {
252
+ "type": "object",
253
+ "properties": {
254
+ "latitude": {
255
+ "type": "number",
256
+ "description": "Latitude coordinate of the entity location",
257
+ "nullable": true
258
+ },
259
+ "longitude": {
260
+ "type": "number",
261
+ "description": "Longitude coordinate of the entity location",
262
+ "nullable": true
263
+ }
264
+ }
265
+ });
266
+
267
+ registerTypeSchema("TagData", {
268
+ "type": "object",
269
+ "required": [
270
+ "tag",
271
+ "tagName"
272
+ ],
273
+ "properties": {
274
+ "tag": {
275
+ "type": "string",
276
+ "description": "Tag identifier"
277
+ },
278
+ "tagName": {
279
+ "type": "string",
280
+ "description": "Human readable tag name"
281
+ },
282
+ "id": {
283
+ "type": "string",
284
+ "description": "Unique identifier"
285
+ },
286
+ "value": {
287
+ "description": "Tag value - can be string, number or object"
288
+ }
289
+ }
290
+ });
291
+
292
+ registerTypeSchema("Entity", {
293
+ "type": "object",
294
+ "required": [
295
+ "id",
296
+ "name",
297
+ "entityType",
298
+ "timezone"
299
+ ],
300
+ "properties": {
301
+ "id": {
302
+ "type": "string",
303
+ "description": "Unique entity identifier"
304
+ },
305
+ "name": {
306
+ "$ref": "#/properties/LocalisedString",
307
+ "description": "Entity name"
308
+ },
309
+ "entityType": {
310
+ "$ref": "#/properties/EntityType",
311
+ "description": "Type of entity"
312
+ },
313
+ "parentId": {
314
+ "type": "string",
315
+ "nullable": true,
316
+ "description": "Parent entity identifier, must always be set when entityType is not DESTINATION"
317
+ },
318
+ "destinationId": {
319
+ "type": "string",
320
+ "nullable": true,
321
+ "description": "Destination identifier, must always be set when entityType is not DESTINATION"
322
+ },
323
+ "parkId": {
324
+ "type": "string",
325
+ "nullable": true,
326
+ "description": "Park identifier, must be set if any parent entity in the hierarchy is a park"
327
+ },
328
+ "timezone": {
329
+ "type": "string",
330
+ "description": "Entity timezone"
331
+ },
332
+ "location": {
333
+ "$ref": "#/properties/EntityLocation",
334
+ "description": "Entity location coordinates"
335
+ },
336
+ "tags": {
337
+ "type": "array",
338
+ "items": {
339
+ "$ref": "#/properties/TagData"
340
+ },
341
+ "description": "Array of tags associated with the entity"
342
+ }
343
+ }
344
+ });
345
+
@@ -0,0 +1,13 @@
1
+ // THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY
2
+
3
+ // Import all type files to trigger schema registration
4
+ import './entities.types.js';
5
+ import './livedata.types.js';
6
+ import './pricedata.types.js';
7
+ import './schedule.types.js';
8
+
9
+ // Re-export types
10
+ export * from './entities.types.js';
11
+ export * from './livedata.types.js';
12
+ export * from './pricedata.types.js';
13
+ export * from './schedule.types.js';