@tmlmobilidade/types 20260528.1805.36 → 20260531.1600.32

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.
@@ -5,6 +5,7 @@ import { UnixTimestampSchema } from '../_common/unix-timestamp.js';
5
5
  import { AlertCauseSchema } from './cause.js';
6
6
  import { AlertEffectSchema } from './effect.js';
7
7
  import { AlertReferenceTypeSchema } from './reference-type.js';
8
+ import { AlertReferenceSchema } from './reference.js';
8
9
  import { z } from 'zod';
9
10
  /* * */
10
11
  export const AlertSchema = DocumentSchema.extend({
@@ -24,10 +25,7 @@ export const AlertSchema = DocumentSchema.extend({
24
25
  publish_start_date: UnixTimestampSchema.nullable().default(null),
25
26
  publish_status: PublishStatusSchema.default('draft'),
26
27
  reference_type: AlertReferenceTypeSchema,
27
- references: z.array(z.object({
28
- child_ids: z.array(z.string()),
29
- parent_id: z.string(),
30
- })).default([]),
28
+ references: z.array(AlertReferenceSchema).default([]),
31
29
  title: z.string(),
32
30
  user_instructions: z.string().default(''),
33
31
  });
@@ -3,4 +3,4 @@ export * from './cause.js';
3
3
  export * from './effect.js';
4
4
  export * from './query.js';
5
5
  export * from './reference-type.js';
6
- export * from './references.js';
6
+ export * from './reference.js';
@@ -3,4 +3,4 @@ export * from './cause.js';
3
3
  export * from './effect.js';
4
4
  export * from './query.js';
5
5
  export * from './reference-type.js';
6
- export * from './references.js';
6
+ export * from './reference.js';
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const AlertReferencesSchema: z.ZodDefault<z.ZodArray<z.ZodObject<{
2
+ export declare const AlertReferenceSchema: z.ZodObject<{
3
3
  child_ids: z.ZodArray<z.ZodString, "many">;
4
4
  parent_id: z.ZodString;
5
5
  }, "strip", z.ZodTypeAny, {
@@ -8,5 +8,5 @@ export declare const AlertReferencesSchema: z.ZodDefault<z.ZodArray<z.ZodObject<
8
8
  }, {
9
9
  child_ids: string[];
10
10
  parent_id: string;
11
- }>, "many">>;
12
- export type AlertReferences = z.infer<typeof AlertReferencesSchema>;
11
+ }>;
12
+ export type AlertReference = z.infer<typeof AlertReferenceSchema>;
@@ -1,7 +1,7 @@
1
1
  /* * */
2
2
  import { z } from 'zod';
3
3
  /* * */
4
- export const AlertReferencesSchema = z.array(z.object({
4
+ export const AlertReferenceSchema = z.object({
5
5
  child_ids: z.array(z.string()),
6
6
  parent_id: z.string(),
7
- })).default([]);
7
+ });
@@ -0,0 +1,82 @@
1
+ import { z } from 'zod';
2
+ export declare const HubAlertSchema: z.ZodObject<Omit<{
3
+ _id: z.ZodString;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
5
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
6
+ is_locked: z.ZodDefault<z.ZodBoolean>;
7
+ updated_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
8
+ updated_by: z.ZodOptional<z.ZodString>;
9
+ } & {
10
+ active_period_end_date: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>>>;
11
+ active_period_start_date: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
12
+ agency_id: z.ZodString;
13
+ auto_texts: z.ZodDefault<z.ZodBoolean>;
14
+ cause: z.ZodEnum<["ACCIDENT", "CONSTRUCTION", "DEMONSTRATION", "MEDICAL_EMERGENCY", "POLICE_ACTIVITY", "STRIKE", "TECHNICAL_ISSUE", "WEATHER", "ABUSIVE_PARKING", "DRIVER_ABSENCE", "DRIVER_ISSUE", "HIGH_PASSENGER_LOAD", "NETWORK_UPDATE", "ROAD_ISSUE", "TRAFFIC_JAM", "PUBLIC_DISORDER", "VEHICLE_ISSUE"]>;
15
+ coordinates: z.ZodDefault<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
16
+ description: z.ZodString;
17
+ effect: z.ZodEnum<["ACCESSIBILITY_ISSUE", "ADDITIONAL_SERVICE", "DETOUR", "MODIFIED_SERVICE", "NO_SERVICE", "REDUCED_SERVICE", "SIGNIFICANT_DELAYS", "STOP_MOVED", "REALTIME_INFO_ISSUE", "ON_BOARD_SALE_ISSUE"]>;
18
+ external_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
19
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
20
+ info_url: z.ZodDefault<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>>;
21
+ municipality_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
22
+ publish_end_date: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>>>;
23
+ publish_start_date: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>>>;
24
+ publish_status: z.ZodDefault<z.ZodEnum<["published", "archived", "draft"]>>;
25
+ reference_type: z.ZodEnum<["agency", "lines", "stops", "rides"]>;
26
+ references: z.ZodDefault<z.ZodArray<z.ZodObject<{
27
+ child_ids: z.ZodArray<z.ZodString, "many">;
28
+ parent_id: z.ZodString;
29
+ }, "strip", z.ZodTypeAny, {
30
+ child_ids: string[];
31
+ parent_id: string;
32
+ }, {
33
+ child_ids: string[];
34
+ parent_id: string;
35
+ }>, "many">>;
36
+ title: z.ZodString;
37
+ user_instructions: z.ZodDefault<z.ZodString>;
38
+ }, "created_at" | "created_by" | "is_locked" | "updated_at" | "updated_by" | "auto_texts" | "external_id" | "file_id" | "publish_end_date" | "publish_start_date" | "publish_status" | "user_instructions"> & {
39
+ image_url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ _id: string;
42
+ description: string;
43
+ active_period_end_date: import("../index.js").UnixTimestamp | null;
44
+ active_period_start_date: number & {
45
+ __brand: "UnixTimestamp";
46
+ };
47
+ agency_id: string;
48
+ cause: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "POLICE_ACTIVITY" | "STRIKE" | "TECHNICAL_ISSUE" | "WEATHER" | "ABUSIVE_PARKING" | "DRIVER_ABSENCE" | "DRIVER_ISSUE" | "HIGH_PASSENGER_LOAD" | "NETWORK_UPDATE" | "ROAD_ISSUE" | "TRAFFIC_JAM" | "PUBLIC_DISORDER" | "VEHICLE_ISSUE";
49
+ coordinates: [number, number] | null;
50
+ effect: "ACCESSIBILITY_ISSUE" | "ADDITIONAL_SERVICE" | "DETOUR" | "MODIFIED_SERVICE" | "NO_SERVICE" | "REDUCED_SERVICE" | "SIGNIFICANT_DELAYS" | "STOP_MOVED" | "REALTIME_INFO_ISSUE" | "ON_BOARD_SALE_ISSUE";
51
+ info_url: string | null;
52
+ municipality_ids: string[];
53
+ reference_type: "agency" | "lines" | "stops" | "rides";
54
+ references: {
55
+ child_ids: string[];
56
+ parent_id: string;
57
+ }[];
58
+ title: string;
59
+ image_url: string | null;
60
+ }, {
61
+ _id: string;
62
+ description: string;
63
+ active_period_start_date: number;
64
+ agency_id: string;
65
+ cause: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "POLICE_ACTIVITY" | "STRIKE" | "TECHNICAL_ISSUE" | "WEATHER" | "ABUSIVE_PARKING" | "DRIVER_ABSENCE" | "DRIVER_ISSUE" | "HIGH_PASSENGER_LOAD" | "NETWORK_UPDATE" | "ROAD_ISSUE" | "TRAFFIC_JAM" | "PUBLIC_DISORDER" | "VEHICLE_ISSUE";
66
+ effect: "ACCESSIBILITY_ISSUE" | "ADDITIONAL_SERVICE" | "DETOUR" | "MODIFIED_SERVICE" | "NO_SERVICE" | "REDUCED_SERVICE" | "SIGNIFICANT_DELAYS" | "STOP_MOVED" | "REALTIME_INFO_ISSUE" | "ON_BOARD_SALE_ISSUE";
67
+ reference_type: "agency" | "lines" | "stops" | "rides";
68
+ title: string;
69
+ active_period_end_date?: number | null | undefined;
70
+ coordinates?: [number, number] | null | undefined;
71
+ info_url?: string | null | undefined;
72
+ municipality_ids?: string[] | undefined;
73
+ references?: {
74
+ child_ids: string[];
75
+ parent_id: string;
76
+ }[] | undefined;
77
+ image_url?: string | null | undefined;
78
+ }>;
79
+ /**
80
+ * Publishable alert data for the Hub Alerts API.
81
+ */
82
+ export type HubAlert = z.infer<typeof HubAlertSchema>;
@@ -0,0 +1,20 @@
1
+ /* * */
2
+ import { AlertSchema } from '../alerts/alert.js';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const HubAlertSchema = AlertSchema.omit({
6
+ auto_texts: true,
7
+ created_at: true,
8
+ created_by: true,
9
+ external_id: true,
10
+ file_id: true,
11
+ is_locked: true,
12
+ publish_end_date: true,
13
+ publish_start_date: true,
14
+ publish_status: true,
15
+ updated_at: true,
16
+ updated_by: true,
17
+ user_instructions: true,
18
+ }).extend({
19
+ image_url: z.string().nullable().default(null),
20
+ });
@@ -1 +1,2 @@
1
+ export * from './alerts.js';
1
2
  export * from './lines.js';
package/dist/hub/index.js CHANGED
@@ -1 +1,2 @@
1
+ export * from './alerts.js';
1
2
  export * from './lines.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20260528.1805.36",
3
+ "version": "20260531.1600.32",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"