@tmlmobilidade/go-types-infrastructure 20260828.1636.54

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 @@
1
+ export * from './stops/index.js';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './stops/index.js';
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const StopConnectionValues: readonly ["ferry", "light_rail", "subway", "train", "boat", "airport", "bike_sharing", "bike_parking", "car_parking"];
3
+ export declare const StopConnectionSchema: z.ZodEnum<["ferry", "light_rail", "subway", "train", "boat", "airport", "bike_sharing", "bike_parking", "car_parking"]>;
4
+ export type StopConnection = z.infer<typeof StopConnectionSchema>;
@@ -0,0 +1,15 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const StopConnectionValues = [
5
+ 'ferry',
6
+ 'light_rail',
7
+ 'subway',
8
+ 'train',
9
+ 'boat',
10
+ 'airport',
11
+ 'bike_sharing',
12
+ 'bike_parking',
13
+ 'car_parking',
14
+ ];
15
+ export const StopConnectionSchema = z.enum(StopConnectionValues);
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const StopEquipmentValues: readonly ["pip", "mupi", "mini_pip"];
3
+ export declare const StopEquipmentSchema: z.ZodEnum<["pip", "mupi", "mini_pip"]>;
4
+ export type StopEquipment = z.infer<typeof StopEquipmentSchema>;
@@ -0,0 +1,9 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const StopEquipmentValues = [
5
+ 'pip',
6
+ 'mupi',
7
+ 'mini_pip',
8
+ ];
9
+ export const StopEquipmentSchema = z.enum(StopEquipmentValues);
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const StopFacilityValues: readonly ["fire_station", "health_clinic", "historic_building", "hospital", "police_station", "school", "shopping", "transit_office", "university", "beach"];
3
+ export declare const StopFacilitySchema: z.ZodEnum<["fire_station", "health_clinic", "historic_building", "hospital", "police_station", "school", "shopping", "transit_office", "university", "beach"]>;
4
+ export type StopFacility = z.infer<typeof StopFacilitySchema>;
@@ -0,0 +1,16 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const StopFacilityValues = [
5
+ 'fire_station',
6
+ 'health_clinic',
7
+ 'historic_building',
8
+ 'hospital',
9
+ 'police_station',
10
+ 'school',
11
+ 'shopping',
12
+ 'transit_office',
13
+ 'university',
14
+ 'beach',
15
+ ];
16
+ export const StopFacilitySchema = z.enum(StopFacilityValues);
@@ -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
+ agency_ids: string[];
9
+ is_harmonized: boolean;
10
+ short_name: string;
11
+ stop_id: string;
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
+ });
@@ -0,0 +1,11 @@
1
+ export * from './connections.js';
2
+ export * from './equipment.js';
3
+ export * from './facilities.js';
4
+ export * from './flag.js';
5
+ export * from './jurisdiction.js';
6
+ export * from './name-abbreviations.js';
7
+ export * from './parent-station.js';
8
+ export * from './road-type.js';
9
+ export * from './stop-area.js';
10
+ export * from './stop-id.js';
11
+ export * from './stop.js';
@@ -0,0 +1,11 @@
1
+ export * from './connections.js';
2
+ export * from './equipment.js';
3
+ export * from './facilities.js';
4
+ export * from './flag.js';
5
+ export * from './jurisdiction.js';
6
+ export * from './name-abbreviations.js';
7
+ export * from './parent-station.js';
8
+ export * from './road-type.js';
9
+ export * from './stop-area.js';
10
+ export * from './stop-id.js';
11
+ export * from './stop.js';
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const StopJurisdictionValues: readonly ["ip", "municipality", "other", "unknown"];
3
+ export declare const StopJurisdictionSchema: z.ZodEnum<["ip", "municipality", "other", "unknown"]>;
4
+ export type StopJurisdiction = z.infer<typeof StopJurisdictionSchema>;
@@ -0,0 +1,10 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const StopJurisdictionValues = [
5
+ 'ip',
6
+ 'municipality',
7
+ 'other',
8
+ 'unknown',
9
+ ];
10
+ export const StopJurisdictionSchema = z.enum(StopJurisdictionValues);
@@ -0,0 +1,11 @@
1
+ export interface AbbreviationRule {
2
+ enabled: boolean;
3
+ phrase: string;
4
+ replacement: string;
5
+ }
6
+ /**
7
+ * These are the rules for abbreviating stop names.
8
+ * They follow the CTT National Postal Service guidelines,
9
+ * with some additional customizations for TML.
10
+ */
11
+ export declare const StopNameAbbreviationRules: AbbreviationRule[];
@@ -0,0 +1,117 @@
1
+ /* * */
2
+ /**
3
+ * These are the rules for abbreviating stop names.
4
+ * They follow the CTT National Postal Service guidelines,
5
+ * with some additional customizations for TML.
6
+ */
7
+ export const StopNameAbbreviationRules = [
8
+ //
9
+ // TML: Street & Place names
10
+ { enabled: true, phrase: 'Quinta', replacement: 'Qta' },
11
+ { enabled: true, phrase: 'Largo', replacement: 'Lgo' },
12
+ { enabled: true, phrase: 'Estrada Municipal', replacement: 'EM' },
13
+ { enabled: true, phrase: 'Estrada Nacional', replacement: 'EN' },
14
+ //
15
+ // TML: People
16
+ { enabled: true, phrase: 'Santo', replacement: 'Sto' },
17
+ { enabled: true, phrase: 'Santa', replacement: 'Sta' },
18
+ //
19
+ // TML: Facilities
20
+ { enabled: true, phrase: 'Cooperativa', replacement: 'Coop' },
21
+ { enabled: true, phrase: 'Câmara Municipal', replacement: 'CM' },
22
+ { enabled: false, phrase: 'Hospital', replacement: 'Hosp' },
23
+ { enabled: false, phrase: 'Escola', replacement: 'Esc' },
24
+ //
25
+ // CTT: Tipo de artéria
26
+ { enabled: true, phrase: 'Alameda', replacement: 'Al' },
27
+ { enabled: true, phrase: 'Avenida', replacement: 'Av' },
28
+ { enabled: true, phrase: 'Azinhaga', replacement: 'Az' },
29
+ { enabled: true, phrase: 'Bairro', replacement: 'Br' },
30
+ { enabled: true, phrase: 'Beco', replacement: 'Bc' },
31
+ { enabled: true, phrase: 'Calçada', replacement: 'Cc' },
32
+ { enabled: true, phrase: 'Calçadinha', replacement: 'Ccnh' },
33
+ { enabled: true, phrase: 'Caminho', replacement: 'Cam' },
34
+ { enabled: true, phrase: 'Casa', replacement: 'Cs' },
35
+ { enabled: true, phrase: 'Conjunto', replacement: 'Cj' },
36
+ { enabled: true, phrase: 'Escadas', replacement: 'Esc' },
37
+ { enabled: true, phrase: 'Escadinhas', replacement: 'Escnh' },
38
+ { enabled: true, phrase: 'Estrada', replacement: 'Estr' },
39
+ { enabled: true, phrase: 'Jardim', replacement: 'Jd' },
40
+ { enabled: true, phrase: 'Loteamento', replacement: 'Lot' },
41
+ { enabled: true, phrase: 'Parque', replacement: 'Pq' },
42
+ { enabled: true, phrase: 'Pátio', replacement: 'Pat' },
43
+ { enabled: true, phrase: 'Praça', replacement: 'Pc' },
44
+ { enabled: true, phrase: 'Praceta', replacement: 'Pct' },
45
+ { enabled: true, phrase: 'Prolongamento', replacement: 'Prl' },
46
+ { enabled: true, phrase: 'Quadra', replacement: 'Qd' },
47
+ { enabled: true, phrase: 'Rotunda', replacement: 'Rot' },
48
+ { enabled: true, phrase: 'Rua', replacement: 'R' },
49
+ { enabled: true, phrase: 'Transversal', replacement: 'Transv' },
50
+ { enabled: true, phrase: 'Travessa', replacement: 'Tv' },
51
+ { enabled: true, phrase: 'Urbanização', replacement: 'Urb' },
52
+ { enabled: true, phrase: 'Vila', replacement: 'Vl' },
53
+ { enabled: true, phrase: 'Zona', replacement: 'Zn' },
54
+ //
55
+ // CTT: Tipo de alojamento
56
+ { enabled: true, phrase: 'Cave', replacement: 'Cv' },
57
+ { enabled: true, phrase: 'Direito', replacement: 'Dto' },
58
+ { enabled: true, phrase: 'Esquerdo', replacement: 'Esq' },
59
+ { enabled: true, phrase: 'Frente', replacement: 'Ft' },
60
+ { enabled: true, phrase: 'Fundos', replacement: 'Fds' },
61
+ { enabled: true, phrase: 'Habitação', replacement: 'Hab' },
62
+ { enabled: true, phrase: 'Loja', replacement: 'Lj' },
63
+ { enabled: true, phrase: 'Rés-do-chão', replacement: 'R/C' },
64
+ { enabled: true, phrase: 'Sobreloja', replacement: 'Slj' },
65
+ { enabled: true, phrase: 'Subcave', replacement: 'Scv' },
66
+ //
67
+ // CTT: Tipo de porta
68
+ { enabled: true, phrase: 'Apartamento', replacement: 'Apto' },
69
+ { enabled: true, phrase: 'Bloco', replacement: 'Bl' },
70
+ { enabled: true, phrase: 'Edifício', replacement: 'Edf' },
71
+ { enabled: true, phrase: 'Lote', replacement: 'Lt' },
72
+ { enabled: true, phrase: 'Torre', replacement: 'Tr' },
73
+ { enabled: true, phrase: 'Vivenda', replacement: 'Vv' },
74
+ //
75
+ // CTT: Abreviatura de título
76
+ { enabled: true, phrase: 'Alferes', replacement: 'Alf' },
77
+ { enabled: true, phrase: 'Almirante', replacement: 'Alm' },
78
+ { enabled: true, phrase: 'Arquiteto', replacement: 'Arq' },
79
+ { enabled: true, phrase: 'Brigadeiro', replacement: 'Brig' },
80
+ { enabled: true, phrase: 'Capitão', replacement: 'Cap' },
81
+ { enabled: true, phrase: 'Comandante', replacement: 'Cmdt' },
82
+ { enabled: true, phrase: 'Comendador', replacement: 'Comend' },
83
+ { enabled: true, phrase: 'Conselheiro', replacement: 'Cons' },
84
+ { enabled: true, phrase: 'Coronel', replacement: 'Cel' },
85
+ { enabled: true, phrase: 'Dom', replacement: 'D' },
86
+ { enabled: true, phrase: 'Dona', replacement: 'Da' },
87
+ { enabled: true, phrase: 'Doutor', replacement: 'Dr' },
88
+ { enabled: true, phrase: 'Doutora', replacement: 'Dr' },
89
+ { enabled: true, phrase: 'Duque', replacement: 'Dq' },
90
+ { enabled: true, phrase: 'Embaixador', replacement: 'Emb' },
91
+ { enabled: true, phrase: 'Engenheira', replacement: 'Eng' },
92
+ { enabled: true, phrase: 'Engenheiro', replacement: 'Eng' },
93
+ { enabled: true, phrase: 'Frei', replacement: 'Fr' },
94
+ { enabled: true, phrase: 'General', replacement: 'Gen' },
95
+ { enabled: true, phrase: 'Infante', replacement: 'Inf' },
96
+ { enabled: true, phrase: 'Marquês', replacement: 'Mq' },
97
+ { enabled: true, phrase: 'Presidente', replacement: 'Pres' },
98
+ { enabled: true, phrase: 'Professor', replacement: 'Prof' },
99
+ { enabled: true, phrase: 'Professora', replacement: 'Prof' },
100
+ { enabled: true, phrase: 'São', replacement: 'S' },
101
+ { enabled: true, phrase: 'Sargento', replacement: 'Sarg' },
102
+ { enabled: true, phrase: 'Tenente', replacement: 'Ten' },
103
+ { enabled: true, phrase: 'Visconde', replacement: 'Visc' },
104
+ //
105
+ // CTT: Diversos
106
+ { enabled: true, phrase: 'Associação', replacement: 'Ass' },
107
+ { enabled: true, phrase: 'Instituto', replacement: 'Inst' },
108
+ { enabled: true, phrase: 'Lugar', replacement: 'Lug' },
109
+ { enabled: true, phrase: 'Ministério', replacement: 'Min' },
110
+ { enabled: true, phrase: 'Ministério', replacement: 'Min' },
111
+ { enabled: true, phrase: 'Projetada', replacement: 'Proj' },
112
+ { enabled: true, phrase: 'Sala', replacement: 'Sl' },
113
+ { enabled: true, phrase: 'Sem Número', replacement: 'S/N' },
114
+ { enabled: true, phrase: 'Sociedade', replacement: 'Soc' },
115
+ { enabled: false, phrase: 'Universidade', replacement: 'Univ' },
116
+ //
117
+ ];
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ export declare const ParentStationSchema: z.ZodObject<{
3
+ created_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
4
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
5
+ is_locked: z.ZodDefault<z.ZodBoolean>;
6
+ updated_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
7
+ updated_by: z.ZodOptional<z.ZodString>;
8
+ } & {
9
+ _id: z.ZodString;
10
+ stop_ids: z.ZodArray<z.ZodString, "many">;
11
+ title: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ _id: string;
14
+ stop_ids: string[];
15
+ title: string;
16
+ created_at: number & {
17
+ __brand: "UnixTimestamp";
18
+ };
19
+ created_by: string | null;
20
+ is_locked: boolean;
21
+ updated_at: number & {
22
+ __brand: "UnixTimestamp";
23
+ };
24
+ updated_by?: string | undefined;
25
+ }, {
26
+ _id: string;
27
+ stop_ids: string[];
28
+ title: string;
29
+ created_at: string | number;
30
+ updated_at: string | number;
31
+ created_by?: string | null | undefined;
32
+ is_locked?: boolean | undefined;
33
+ updated_by?: string | undefined;
34
+ }>;
35
+ export declare const CreateParentStationSchema: z.ZodObject<Omit<{
36
+ created_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
37
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
38
+ is_locked: z.ZodDefault<z.ZodBoolean>;
39
+ updated_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
40
+ updated_by: z.ZodOptional<z.ZodString>;
41
+ } & {
42
+ _id: z.ZodString;
43
+ stop_ids: z.ZodArray<z.ZodString, "many">;
44
+ title: z.ZodString;
45
+ }, "_id" | "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
46
+ stop_ids: string[];
47
+ title: string;
48
+ created_by: string | null;
49
+ is_locked: boolean;
50
+ updated_by?: string | undefined;
51
+ }, {
52
+ stop_ids: string[];
53
+ title: string;
54
+ created_by?: string | null | undefined;
55
+ is_locked?: boolean | undefined;
56
+ updated_by?: string | undefined;
57
+ }>;
58
+ export declare const UpdateParentStationSchema: z.ZodObject<{
59
+ stop_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
60
+ title: z.ZodOptional<z.ZodString>;
61
+ is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
62
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ stop_ids?: string[] | undefined;
65
+ title?: string | undefined;
66
+ is_locked?: boolean | undefined;
67
+ updated_by?: string | undefined;
68
+ }, {
69
+ stop_ids?: string[] | undefined;
70
+ title?: string | undefined;
71
+ is_locked?: boolean | undefined;
72
+ updated_by?: string | undefined;
73
+ }>;
74
+ export type ParentStation = z.infer<typeof ParentStationSchema>;
75
+ export type CreateParentStationDto = z.infer<typeof CreateParentStationSchema>;
76
+ export type UpdateParentStationDto = z.infer<typeof UpdateParentStationSchema>;
@@ -0,0 +1,11 @@
1
+ /* * */
2
+ import { BaseDocumentSchema } from '@tmlmobilidade/go-types-shared';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const ParentStationSchema = BaseDocumentSchema.extend({
6
+ _id: z.string(),
7
+ stop_ids: z.array(z.string()),
8
+ title: z.string(),
9
+ });
10
+ export const CreateParentStationSchema = ParentStationSchema.omit({ _id: true, created_at: true, updated_at: true });
11
+ export const UpdateParentStationSchema = CreateParentStationSchema.omit({ created_by: true }).partial();
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const StopRoadTypeSchema: z.ZodEnum<["complementary_itinerary", "highway", "main_itinerary", "national_road", "regional_road", "secondary_road", "unknown"]>;
3
+ export type StopRoadType = z.infer<typeof StopRoadTypeSchema>;
@@ -0,0 +1,13 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ const StopRoadTypeValues = [
5
+ 'complementary_itinerary',
6
+ 'highway',
7
+ 'main_itinerary',
8
+ 'national_road',
9
+ 'regional_road',
10
+ 'secondary_road',
11
+ 'unknown',
12
+ ];
13
+ export const StopRoadTypeSchema = z.enum(StopRoadTypeValues);
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ export declare const StopAreaSchema: z.ZodObject<{
3
+ created_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
4
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
5
+ is_locked: z.ZodDefault<z.ZodBoolean>;
6
+ updated_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
7
+ updated_by: z.ZodOptional<z.ZodString>;
8
+ } & {
9
+ _id: z.ZodString;
10
+ parent_station_ids: z.ZodArray<z.ZodString, "many">;
11
+ }, "strip", z.ZodTypeAny, {
12
+ _id: string;
13
+ created_at: number & {
14
+ __brand: "UnixTimestamp";
15
+ };
16
+ created_by: string | null;
17
+ is_locked: boolean;
18
+ updated_at: number & {
19
+ __brand: "UnixTimestamp";
20
+ };
21
+ parent_station_ids: string[];
22
+ updated_by?: string | undefined;
23
+ }, {
24
+ _id: string;
25
+ created_at: string | number;
26
+ updated_at: string | number;
27
+ parent_station_ids: string[];
28
+ created_by?: string | null | undefined;
29
+ is_locked?: boolean | undefined;
30
+ updated_by?: string | undefined;
31
+ }>;
32
+ export declare const CreateStopAreaSchema: z.ZodObject<Omit<{
33
+ created_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
34
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
35
+ is_locked: z.ZodDefault<z.ZodBoolean>;
36
+ updated_at: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, import("@tmlmobilidade/go-types-shared").UnixTimestamp, string | number>;
37
+ updated_by: z.ZodOptional<z.ZodString>;
38
+ } & {
39
+ _id: z.ZodString;
40
+ parent_station_ids: z.ZodArray<z.ZodString, "many">;
41
+ }, "_id" | "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
42
+ created_by: string | null;
43
+ is_locked: boolean;
44
+ parent_station_ids: string[];
45
+ updated_by?: string | undefined;
46
+ }, {
47
+ parent_station_ids: string[];
48
+ created_by?: string | null | undefined;
49
+ is_locked?: boolean | undefined;
50
+ updated_by?: string | undefined;
51
+ }>;
52
+ export declare const UpdateStopAreaSchema: z.ZodObject<{
53
+ is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
54
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
55
+ parent_station_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ is_locked?: boolean | undefined;
58
+ updated_by?: string | undefined;
59
+ parent_station_ids?: string[] | undefined;
60
+ }, {
61
+ is_locked?: boolean | undefined;
62
+ updated_by?: string | undefined;
63
+ parent_station_ids?: string[] | undefined;
64
+ }>;
65
+ export type StopArea = z.infer<typeof StopAreaSchema>;
66
+ export type CreateStopAreaDto = z.infer<typeof CreateStopAreaSchema>;
67
+ export type UpdateStopAreaDto = z.infer<typeof UpdateStopAreaSchema>;
@@ -0,0 +1,10 @@
1
+ /* * */
2
+ import { BaseDocumentSchema } from '@tmlmobilidade/go-types-shared';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const StopAreaSchema = BaseDocumentSchema.extend({
6
+ _id: z.string(),
7
+ parent_station_ids: z.array(z.string()),
8
+ });
9
+ export const CreateStopAreaSchema = StopAreaSchema.omit({ _id: true, created_at: true, updated_at: true });
10
+ export const UpdateStopAreaSchema = CreateStopAreaSchema.omit({ created_by: true }).partial();
@@ -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
+ }