@tmlmobilidade/types 20260411.1248.30 → 20260418.1237.24

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.
@@ -2,6 +2,7 @@
2
2
  import { CommentSchema } from '../_common/comment.js';
3
3
  import { DocumentSchema } from '../_common/document.js';
4
4
  import { createGtfsMapper } from '../gtfs-new/mapper.js';
5
+ import { StopIdSchema } from '../stops/stop-id.js';
5
6
  import { StopSchema } from '../stops/stop.js';
6
7
  import { z } from 'zod';
7
8
  import { StopsParametersListSchema } from './parameters.js';
@@ -27,7 +28,7 @@ export const PathSchema = z.object({
27
28
  allow_pickup: z.boolean().default(true),
28
29
  distance_delta: z.number().nullable().default(null),
29
30
  stop: StopSchema.nullable().optional(),
30
- stop_id: z.string(),
31
+ stop_id: StopIdSchema,
31
32
  timepoint: z.boolean().default(true),
32
33
  zones: z.array(z.string()).optional(),
33
34
  });
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const StopFlagSchema: z.ZodObject<{
3
+ agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
4
+ is_harmonized: z.ZodDefault<z.ZodBoolean>;
5
+ short_name: z.ZodString;
6
+ stop_id: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ short_name: string;
9
+ stop_id: string;
10
+ agency_ids: string[];
11
+ is_harmonized: boolean;
12
+ }, {
13
+ short_name: string;
14
+ stop_id: string;
15
+ agency_ids?: string[] | undefined;
16
+ is_harmonized?: boolean | undefined;
17
+ }>;
18
+ export type StopFlag = z.infer<typeof StopFlagSchema>;
@@ -0,0 +1,9 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const StopFlagSchema = z.object({
5
+ agency_ids: z.array(z.string()).default([]),
6
+ is_harmonized: z.boolean().default(false),
7
+ short_name: z.string(),
8
+ stop_id: z.string(),
9
+ });
@@ -1,9 +1,11 @@
1
1
  export * from './connections.js';
2
2
  export * from './equipment.js';
3
3
  export * from './facilities.js';
4
+ export * from './flag.js';
4
5
  export * from './jurisdiction.js';
5
6
  export * from './name-abbreviations.js';
6
7
  export * from './parent-station.js';
7
8
  export * from './road-type.js';
8
9
  export * from './stop-area.js';
10
+ export * from './stop-id.js';
9
11
  export * from './stop.js';
@@ -1,9 +1,11 @@
1
1
  export * from './connections.js';
2
2
  export * from './equipment.js';
3
3
  export * from './facilities.js';
4
+ export * from './flag.js';
4
5
  export * from './jurisdiction.js';
5
6
  export * from './name-abbreviations.js';
6
7
  export * from './parent-station.js';
7
8
  export * from './road-type.js';
8
9
  export * from './stop-area.js';
10
+ export * from './stop-id.js';
9
11
  export * from './stop.js';
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const StopIdSchema: z.ZodNumber;
3
+ /**
4
+ * Represents a Stop ID, which is a unique identifier
5
+ * for a stop in the transportation system.
6
+ */
7
+ export type StopId = z.infer<typeof StopIdSchema>;
8
+ /**
9
+ * Validates the structure of a Stop ID.
10
+ * @param value The value to validate as a Stop ID.
11
+ * @returns The validated Stop ID if valid, or false if invalid.
12
+ */
13
+ export declare function validateStopIdStructure(value?: null | number | StopId | string): false | StopId;
@@ -0,0 +1,29 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const StopIdSchema = z
5
+ .number()
6
+ .min(100_000)
7
+ .max(999_999);
8
+ /**
9
+ * Validates the structure of a Stop ID.
10
+ * @param value The value to validate as a Stop ID.
11
+ * @returns The validated Stop ID if valid, or false if invalid.
12
+ */
13
+ export function validateStopIdStructure(value) {
14
+ // Return false if no value is provided
15
+ if (!value)
16
+ return false;
17
+ // Transform the value into a number if it's a string
18
+ if (typeof value === 'string')
19
+ value = parseInt(value, 10);
20
+ // Return false if the value is not a number or is NaN
21
+ if (typeof value !== 'number' || isNaN(value))
22
+ return false;
23
+ // Return false if the value is outside the valid range for Stop IDs
24
+ if (value < 100_000 || value > 999_999)
25
+ return false;
26
+ // Return the value as a Stop ID
27
+ // if it passes all checks.
28
+ return value;
29
+ }
@@ -6,13 +6,31 @@ export declare const StopSchema: z.ZodObject<{
6
6
  updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
7
7
  updated_by: z.ZodOptional<z.ZodString>;
8
8
  } & {
9
- _id: z.ZodString;
9
+ _id: z.ZodNumber;
10
+ flags: z.ZodDefault<z.ZodArray<z.ZodObject<{
11
+ agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
12
+ is_harmonized: z.ZodDefault<z.ZodBoolean>;
13
+ short_name: z.ZodString;
14
+ stop_id: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ short_name: string;
17
+ stop_id: string;
18
+ agency_ids: string[];
19
+ is_harmonized: boolean;
20
+ }, {
21
+ short_name: string;
22
+ stop_id: string;
23
+ agency_ids?: string[] | undefined;
24
+ is_harmonized?: boolean | undefined;
25
+ }>, "many">>;
10
26
  is_deleted: z.ZodDefault<z.ZodBoolean>;
11
27
  jurisdiction: z.ZodDefault<z.ZodEnum<["ip", "municipality", "other", "unknown"]>>;
12
28
  legacy_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
29
+ legacy_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13
30
  lifecycle_status: z.ZodDefault<z.ZodEnum<["draft", "active", "inactive", "provisional", "seasonal", "voided"]>>;
14
31
  name: z.ZodString;
15
32
  new_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
33
+ previous_go_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
16
34
  short_name: z.ZodString;
17
35
  tts_name: z.ZodString;
18
36
  district_id: z.ZodString;
@@ -259,7 +277,7 @@ export declare const StopSchema: z.ZodObject<{
259
277
  }>, "many">>;
260
278
  observations: z.ZodDefault<z.ZodNullable<z.ZodString>>;
261
279
  }, "strip", z.ZodTypeAny, {
262
- _id: string;
280
+ _id: number;
263
281
  created_at: number & {
264
282
  __brand: "UnixTimestamp";
265
283
  };
@@ -329,11 +347,19 @@ export declare const StopSchema: z.ZodObject<{
329
347
  parish_id: string | null;
330
348
  shelter_code: string | null;
331
349
  shelter_maintainer: string | null;
350
+ flags: {
351
+ short_name: string;
352
+ stop_id: string;
353
+ agency_ids: string[];
354
+ is_harmonized: boolean;
355
+ }[];
332
356
  is_deleted: boolean;
333
357
  jurisdiction: "unknown" | "municipality" | "ip" | "other";
334
358
  legacy_id: string | null;
359
+ legacy_ids: string[];
335
360
  lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
336
361
  new_name: string | null;
362
+ previous_go_id: string | null;
337
363
  tts_name: string;
338
364
  district_id: string;
339
365
  locality_id: string | null;
@@ -357,7 +383,7 @@ export declare const StopSchema: z.ZodObject<{
357
383
  image_ids: string[];
358
384
  updated_by?: string | undefined;
359
385
  }, {
360
- _id: string;
386
+ _id: number;
361
387
  created_at: number;
362
388
  updated_at: number;
363
389
  name: string;
@@ -414,11 +440,19 @@ export declare const StopSchema: z.ZodObject<{
414
440
  parish_id?: string | null | undefined;
415
441
  shelter_code?: string | null | undefined;
416
442
  shelter_maintainer?: string | null | undefined;
443
+ flags?: {
444
+ short_name: string;
445
+ stop_id: string;
446
+ agency_ids?: string[] | undefined;
447
+ is_harmonized?: boolean | undefined;
448
+ }[] | undefined;
417
449
  is_deleted?: boolean | undefined;
418
450
  jurisdiction?: "unknown" | "municipality" | "ip" | "other" | undefined;
419
451
  legacy_id?: string | null | undefined;
452
+ legacy_ids?: string[] | undefined;
420
453
  lifecycle_status?: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided" | undefined;
421
454
  new_name?: string | null | undefined;
455
+ previous_go_id?: string | null | undefined;
422
456
  locality_id?: string | null | undefined;
423
457
  bench_status?: "unknown" | "not_applicable" | "missing" | "damaged" | "ok" | undefined;
424
458
  electricity_status?: "unknown" | "available" | "unavailable" | undefined;
@@ -446,13 +480,31 @@ export declare const CreateStopSchema: z.ZodObject<Omit<{
446
480
  updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
447
481
  updated_by: z.ZodOptional<z.ZodString>;
448
482
  } & {
449
- _id: z.ZodString;
483
+ _id: z.ZodNumber;
484
+ flags: z.ZodDefault<z.ZodArray<z.ZodObject<{
485
+ agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
486
+ is_harmonized: z.ZodDefault<z.ZodBoolean>;
487
+ short_name: z.ZodString;
488
+ stop_id: z.ZodString;
489
+ }, "strip", z.ZodTypeAny, {
490
+ short_name: string;
491
+ stop_id: string;
492
+ agency_ids: string[];
493
+ is_harmonized: boolean;
494
+ }, {
495
+ short_name: string;
496
+ stop_id: string;
497
+ agency_ids?: string[] | undefined;
498
+ is_harmonized?: boolean | undefined;
499
+ }>, "many">>;
450
500
  is_deleted: z.ZodDefault<z.ZodBoolean>;
451
501
  jurisdiction: z.ZodDefault<z.ZodEnum<["ip", "municipality", "other", "unknown"]>>;
452
502
  legacy_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
503
+ legacy_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
453
504
  lifecycle_status: z.ZodDefault<z.ZodEnum<["draft", "active", "inactive", "provisional", "seasonal", "voided"]>>;
454
505
  name: z.ZodString;
455
506
  new_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
507
+ previous_go_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
456
508
  short_name: z.ZodString;
457
509
  tts_name: z.ZodString;
458
510
  district_id: z.ZodString;
@@ -762,11 +814,19 @@ export declare const CreateStopSchema: z.ZodObject<Omit<{
762
814
  parish_id: string | null;
763
815
  shelter_code: string | null;
764
816
  shelter_maintainer: string | null;
817
+ flags: {
818
+ short_name: string;
819
+ stop_id: string;
820
+ agency_ids: string[];
821
+ is_harmonized: boolean;
822
+ }[];
765
823
  is_deleted: boolean;
766
824
  jurisdiction: "unknown" | "municipality" | "ip" | "other";
767
825
  legacy_id: string | null;
826
+ legacy_ids: string[];
768
827
  lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
769
828
  new_name: string | null;
829
+ previous_go_id: string | null;
770
830
  tts_name: string;
771
831
  district_id: string;
772
832
  locality_id: string | null;
@@ -844,11 +904,19 @@ export declare const CreateStopSchema: z.ZodObject<Omit<{
844
904
  parish_id?: string | null | undefined;
845
905
  shelter_code?: string | null | undefined;
846
906
  shelter_maintainer?: string | null | undefined;
907
+ flags?: {
908
+ short_name: string;
909
+ stop_id: string;
910
+ agency_ids?: string[] | undefined;
911
+ is_harmonized?: boolean | undefined;
912
+ }[] | undefined;
847
913
  is_deleted?: boolean | undefined;
848
914
  jurisdiction?: "unknown" | "municipality" | "ip" | "other" | undefined;
849
915
  legacy_id?: string | null | undefined;
916
+ legacy_ids?: string[] | undefined;
850
917
  lifecycle_status?: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided" | undefined;
851
918
  new_name?: string | null | undefined;
919
+ previous_go_id?: string | null | undefined;
852
920
  locality_id?: string | null | undefined;
853
921
  bench_status?: "unknown" | "not_applicable" | "missing" | "damaged" | "ok" | undefined;
854
922
  electricity_status?: "unknown" | "available" | "unavailable" | undefined;
@@ -1097,11 +1165,29 @@ export declare const UpdateStopSchema: z.ZodObject<{
1097
1165
  parish_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
1098
1166
  shelter_code: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
1099
1167
  shelter_maintainer: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
1168
+ flags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
1169
+ agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1170
+ is_harmonized: z.ZodDefault<z.ZodBoolean>;
1171
+ short_name: z.ZodString;
1172
+ stop_id: z.ZodString;
1173
+ }, "strip", z.ZodTypeAny, {
1174
+ short_name: string;
1175
+ stop_id: string;
1176
+ agency_ids: string[];
1177
+ is_harmonized: boolean;
1178
+ }, {
1179
+ short_name: string;
1180
+ stop_id: string;
1181
+ agency_ids?: string[] | undefined;
1182
+ is_harmonized?: boolean | undefined;
1183
+ }>, "many">>>;
1100
1184
  is_deleted: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1101
1185
  jurisdiction: z.ZodOptional<z.ZodDefault<z.ZodEnum<["ip", "municipality", "other", "unknown"]>>>;
1102
1186
  legacy_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
1187
+ legacy_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
1103
1188
  lifecycle_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["draft", "active", "inactive", "provisional", "seasonal", "voided"]>>>;
1104
1189
  new_name: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
1190
+ previous_go_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
1105
1191
  tts_name: z.ZodOptional<z.ZodString>;
1106
1192
  district_id: z.ZodOptional<z.ZodString>;
1107
1193
  locality_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
@@ -1187,11 +1273,19 @@ export declare const UpdateStopSchema: z.ZodObject<{
1187
1273
  parish_id?: string | null | undefined;
1188
1274
  shelter_code?: string | null | undefined;
1189
1275
  shelter_maintainer?: string | null | undefined;
1276
+ flags?: {
1277
+ short_name: string;
1278
+ stop_id: string;
1279
+ agency_ids: string[];
1280
+ is_harmonized: boolean;
1281
+ }[] | undefined;
1190
1282
  is_deleted?: boolean | undefined;
1191
1283
  jurisdiction?: "unknown" | "municipality" | "ip" | "other" | undefined;
1192
1284
  legacy_id?: string | null | undefined;
1285
+ legacy_ids?: string[] | undefined;
1193
1286
  lifecycle_status?: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided" | undefined;
1194
1287
  new_name?: string | null | undefined;
1288
+ previous_go_id?: string | null | undefined;
1195
1289
  tts_name?: string | undefined;
1196
1290
  district_id?: string | undefined;
1197
1291
  locality_id?: string | null | undefined;
@@ -1265,11 +1359,19 @@ export declare const UpdateStopSchema: z.ZodObject<{
1265
1359
  parish_id?: string | null | undefined;
1266
1360
  shelter_code?: string | null | undefined;
1267
1361
  shelter_maintainer?: string | null | undefined;
1362
+ flags?: {
1363
+ short_name: string;
1364
+ stop_id: string;
1365
+ agency_ids?: string[] | undefined;
1366
+ is_harmonized?: boolean | undefined;
1367
+ }[] | undefined;
1268
1368
  is_deleted?: boolean | undefined;
1269
1369
  jurisdiction?: "unknown" | "municipality" | "ip" | "other" | undefined;
1270
1370
  legacy_id?: string | null | undefined;
1371
+ legacy_ids?: string[] | undefined;
1271
1372
  lifecycle_status?: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided" | undefined;
1272
1373
  new_name?: string | null | undefined;
1374
+ previous_go_id?: string | null | undefined;
1273
1375
  tts_name?: string | undefined;
1274
1376
  district_id?: string | undefined;
1275
1377
  locality_id?: string | null | undefined;
@@ -6,20 +6,25 @@ import { UnixTimeStampSchema } from '../_common/unix-timestamp.js';
6
6
  import { StopConnectionSchema } from './connections.js';
7
7
  import { StopEquipmentSchema } from './equipment.js';
8
8
  import { StopFacilitySchema } from './facilities.js';
9
+ import { StopFlagSchema } from './flag.js';
9
10
  import { StopJurisdictionSchema } from './jurisdiction.js';
10
11
  import { StopRoadTypeSchema } from './road-type.js';
12
+ import { StopIdSchema } from './stop-id.js';
11
13
  import { z } from 'zod';
12
14
  /* * */
13
15
  export const StopSchema = DocumentSchema.extend({
14
16
  //
15
17
  // General
16
- _id: z.string(),
18
+ _id: StopIdSchema,
19
+ flags: z.array(StopFlagSchema).default([]),
17
20
  is_deleted: z.boolean().default(false),
18
21
  jurisdiction: StopJurisdictionSchema.default('unknown'),
19
22
  legacy_id: z.string().nullable().default(null),
23
+ legacy_ids: z.array(z.string()).default([]),
20
24
  lifecycle_status: LifecycleStatusSchema.default('draft'),
21
25
  name: z.string().min(2).max(100),
22
26
  new_name: z.string().min(5).max(100).nullable().default(null),
27
+ previous_go_id: z.string().nullable().default(null),
23
28
  short_name: z.string().min(2).max(55),
24
29
  tts_name: z.string(),
25
30
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20260411.1248.30",
3
+ "version": "20260418.1237.24",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@tmlmobilidade/tsconfig": "*",
46
46
  "@types/luxon": "3.7.1",
47
- "@types/node": "25.5.2",
47
+ "@types/node": "25.6.0",
48
48
  "resolve-tspaths": "0.8.23",
49
49
  "tsc-watch": "7.2.0",
50
50
  "typescript": "5.9.3"