@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,90 @@
1
+ /* * */
2
+ import { StopConnectionSchema } from './connections.js';
3
+ import { StopEquipmentSchema } from './equipment.js';
4
+ import { StopFacilitySchema } from './facilities.js';
5
+ import { StopFlagSchema } from './flag.js';
6
+ import { StopJurisdictionSchema } from './jurisdiction.js';
7
+ import { StopRoadTypeSchema } from './road-type.js';
8
+ import { StopIdSchema } from './stop-id.js';
9
+ import { AvailabilityStatusSchema, CommentSchema, ConditionStatusSchema, BaseDocumentSchema, LifecycleStatusSchema, UnixTimestampSchema } from '@tmlmobilidade/go-types-shared';
10
+ import { z } from 'zod';
11
+ /* * */
12
+ export const StopSchema = BaseDocumentSchema.extend({
13
+ //
14
+ // General
15
+ _id: StopIdSchema,
16
+ flags: z.array(StopFlagSchema).default([]),
17
+ is_deleted: z.boolean().default(false),
18
+ jurisdiction: StopJurisdictionSchema.default('unknown'),
19
+ legacy_id: z.string().nullable().default(null),
20
+ legacy_ids: z.array(z.string()).default([]),
21
+ lifecycle_status: LifecycleStatusSchema.default('draft'),
22
+ name: z.string().min(2).max(100),
23
+ new_name: z.string().min(5).max(100).nullable().default(null),
24
+ previous_go_id: z.string().nullable().default(null),
25
+ short_name: z.string().min(2).max(55),
26
+ tts_hash: z.string().nullable().default(null),
27
+ tts_name: z.string().nullable().default(null),
28
+ //
29
+ // Location
30
+ district_id: z.string(),
31
+ latitude: z.number(),
32
+ locality_id: z.string().nullable().default(null),
33
+ longitude: z.number(),
34
+ municipality_id: z.string(),
35
+ parish_id: z.string().nullable().default(null),
36
+ //
37
+ // Infrastructure
38
+ bench_status: ConditionStatusSchema.default('unknown'),
39
+ electricity_status: AvailabilityStatusSchema.default('unknown'),
40
+ pole_status: ConditionStatusSchema.default('unknown'),
41
+ road_type: StopRoadTypeSchema.default('unknown'),
42
+ //
43
+ // Shelter
44
+ shelter_code: z.string().nullable().default(null),
45
+ shelter_frame_size: z.tuple([z.number(), z.number()]).nullable().default(null),
46
+ shelter_installation_date: UnixTimestampSchema.nullable().default(null),
47
+ shelter_maintainer: z.string().nullable().default(null),
48
+ shelter_make: z.string().nullable().default(null),
49
+ shelter_model: z.string().nullable().default(null),
50
+ shelter_status: ConditionStatusSchema.default('unknown'),
51
+ //
52
+ // Checks
53
+ last_infrastructure_check: UnixTimestampSchema.nullable().default(null),
54
+ last_infrastructure_maintenance: UnixTimestampSchema.nullable().default(null),
55
+ last_schedules_check: UnixTimestampSchema.nullable().default(null),
56
+ last_schedules_maintenance: UnixTimestampSchema.nullable().default(null),
57
+ //
58
+ // Facilities
59
+ connections: z.array(StopConnectionSchema).default([]),
60
+ facilities: z.array(StopFacilitySchema).default([]),
61
+ //
62
+ // Equipments
63
+ equipment: z.array(StopEquipmentSchema).default([]),
64
+ // Has ...
65
+ has_bench: AvailabilityStatusSchema.default('unknown'),
66
+ has_mupi: AvailabilityStatusSchema.default('unknown'),
67
+ has_network_map: AvailabilityStatusSchema.default('unknown'),
68
+ has_schedules: AvailabilityStatusSchema.default('unknown'),
69
+ has_shelter: AvailabilityStatusSchema.default('unknown'),
70
+ has_stop_sign: AvailabilityStatusSchema.default('unknown'),
71
+ //
72
+ // Images & Files
73
+ file_ids: z.array(z.string()).default([]),
74
+ image_ids: z.array(z.string()).default([]),
75
+ //
76
+ // Notes & Comments
77
+ comments: z.array(CommentSchema).default([]),
78
+ observations: z.string().nullable().default(null),
79
+ //
80
+ // This field is not sent by the backend, but is useful to have in the frontend for easier access to the associated patterns of an event
81
+ associated_patterns: z.array(z.object({
82
+ _id: z.string(),
83
+ code: z.string(),
84
+ headsign: z.string(),
85
+ line_id: z.string(),
86
+ route_id: z.string(),
87
+ })).default([]),
88
+ });
89
+ export const CreateStopSchema = StopSchema.omit({ _id: true, associated_patterns: true, created_at: true, updated_at: true });
90
+ export const UpdateStopSchema = CreateStopSchema.omit({ created_by: true }).partial();
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@tmlmobilidade/go-types-infrastructure",
3
+ "version": "20260828.1636.54",
4
+ "author": {
5
+ "email": "iso@tmlmobilidade.pt",
6
+ "name": "TML-ISO"
7
+ },
8
+ "license": "AGPL-3.0-or-later",
9
+ "homepage": "https://go.tmlmobilidade.pt",
10
+ "bugs": {
11
+ "url": "https://github.com/tmlmobilidade/go/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/tmlmobilidade/go.git"
16
+ },
17
+ "keywords": [
18
+ "public transit",
19
+ "tml",
20
+ "transportes metropolitanos de lisboa",
21
+ "go"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "type": "module",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "scripts": {
33
+ "build": "tsc && resolve-tspaths",
34
+ "lint": "eslint ./src/ && tsc --noEmit",
35
+ "lint:fix": "eslint ./src/ --fix",
36
+ "watch": "tsc-watch --onSuccess 'resolve-tspaths'"
37
+ },
38
+ "dependencies": {
39
+ "@tmlmobilidade/go-types-geo": "*",
40
+ "@tmlmobilidade/go-types-shared": "*",
41
+ "zod": "3.25.76"
42
+ },
43
+ "devDependencies": {
44
+ "@tmlmobilidade/go-utils-tsconfig": "*",
45
+ "@types/node": "26.1.2",
46
+ "resolve-tspaths": "0.8.23",
47
+ "tsc-watch": "7.2.1",
48
+ "typescript": "6.0.3"
49
+ }
50
+ }