@tmlmobilidade/types 20260121.2332.6 → 20260128.2248.28
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.
- package/dist/_common/comment.d.ts +24 -24
- package/dist/_common/document.d.ts +3 -3
- package/dist/_common/document.js +1 -1
- package/dist/_common/status.d.ts +2 -2
- package/dist/_common/status.js +1 -1
- package/dist/_common/unix-timestamp.js +1 -0
- package/dist/agency.d.ts +6 -6
- package/dist/alerts/alert.d.ts +262 -0
- package/dist/alerts/alert.js +34 -0
- package/dist/alerts/cause-effect-map.d.ts +106 -0
- package/dist/alerts/cause-effect-map.js +94 -0
- package/dist/alerts/cause.d.ts +17 -0
- package/dist/alerts/cause.js +45 -0
- package/dist/alerts/effect.d.ts +17 -0
- package/dist/alerts/effect.js +35 -0
- package/dist/alerts/index.d.ts +6 -0
- package/dist/alerts/index.js +6 -0
- package/dist/alerts/query.d.ts +9 -0
- package/dist/alerts/query.js +6 -0
- package/dist/alerts/reference-type.d.ts +4 -0
- package/dist/alerts/reference-type.js +10 -0
- package/dist/apex/simplified-apex-location.d.ts +2 -12
- package/dist/apex/simplified-apex-location.js +1 -1
- package/dist/apex/simplified-apex-on-board-refund.d.ts +2 -12
- package/dist/apex/simplified-apex-on-board-refund.js +1 -1
- package/dist/apex/simplified-apex-on-board-sale.d.ts +12 -19
- package/dist/apex/simplified-apex-on-board-sale.js +2 -2
- package/dist/apex/simplified-apex-validation.d.ts +6 -16
- package/dist/apex/simplified-apex-validation.js +1 -1
- package/dist/auth/role.d.ts +718 -130
- package/dist/auth/session.d.ts +6 -6
- package/dist/auth/user.d.ts +1182 -270
- package/dist/auth/verification-token.d.ts +4 -4
- package/dist/calendar/event.d.ts +43 -0
- package/dist/calendar/event.js +16 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +2 -0
- package/dist/dates/annotation.d.ts +6 -6
- package/dist/dates/date.d.ts +32 -0
- package/dist/dates/date.js +18 -0
- package/dist/dates/index.d.ts +2 -0
- package/dist/dates/index.js +2 -0
- package/dist/dates/period.d.ts +94 -0
- package/dist/dates/period.js +14 -0
- package/dist/file-exports/base.d.ts +9 -9
- package/dist/file-exports/file-exports.d.ts +7 -7
- package/dist/file-exports/ride-export.d.ts +14 -14
- package/dist/file-exports/ride-export.js +2 -2
- package/dist/gtfs/cause.d.ts +10 -0
- package/dist/gtfs/cause.js +18 -0
- package/dist/gtfs/effect.d.ts +10 -0
- package/dist/gtfs/effect.js +17 -0
- package/dist/gtfs/index.d.ts +2 -1
- package/dist/gtfs/index.js +2 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/locations/queries.d.ts +2 -2
- package/dist/metrics/demand/demand_by_agency.d.ts +8 -8
- package/dist/metrics/demand/demand_by_category.d.ts +12 -12
- package/dist/metrics/demand/demand_by_line.d.ts +4 -4
- package/dist/metrics/demand/demand_by_pattern.d.ts +8 -8
- package/dist/metrics/demand/demand_by_product.d.ts +12 -12
- package/dist/metrics/index.d.ts +93 -48
- package/dist/metrics/index.js +4 -1
- package/dist/metrics/passenger-impact/index.d.ts +1 -0
- package/dist/metrics/passenger-impact/index.js +1 -0
- package/dist/metrics/passenger-impact/passenger-impact.d.ts +97 -0
- package/dist/metrics/passenger-impact/passenger-impact.js +22 -0
- package/dist/metrics/supply/supply_by_agency.d.ts +4 -4
- package/dist/notification.d.ts +18 -18
- package/dist/offer/index.d.ts +5 -0
- package/dist/offer/index.js +5 -0
- package/dist/offer/line.d.ts +296 -0
- package/dist/offer/line.js +60 -0
- package/dist/offer/pattern.d.ts +3608 -0
- package/dist/offer/pattern.js +75 -0
- package/dist/offer/route.d.ts +187 -0
- package/dist/offer/route.js +33 -0
- package/dist/offer/scheduleRule.d.ts +80 -0
- package/dist/offer/scheduleRule.js +50 -0
- package/dist/offer/typology.d.ts +124 -0
- package/dist/offer/typology.js +30 -0
- package/dist/organization.d.ts +20 -20
- package/dist/permissions/alerts.d.ts +13 -19
- package/dist/permissions/alerts.js +8 -13
- package/dist/permissions/annotations.d.ts +25 -0
- package/dist/permissions/annotations.js +16 -0
- package/dist/permissions/fares.d.ts +25 -0
- package/dist/permissions/fares.js +16 -0
- package/dist/permissions/index.d.ts +196 -21
- package/dist/permissions/index.js +142 -6
- package/dist/permissions/lines.d.ts +25 -0
- package/dist/permissions/lines.js +16 -0
- package/dist/permissions/periods.d.ts +25 -0
- package/dist/permissions/periods.js +16 -0
- package/dist/permissions/typologies.d.ts +25 -0
- package/dist/permissions/typologies.js +16 -0
- package/dist/permissions/vehicles.d.ts +25 -0
- package/dist/permissions/vehicles.js +16 -0
- package/dist/permissions/zones.d.ts +25 -0
- package/dist/permissions/zones.js +16 -0
- package/dist/plans/gtfs-validation.d.ts +30 -30
- package/dist/plans/plan.d.ts +6 -6
- package/dist/proposed-change.d.ts +12 -12
- package/dist/rides/batch-query.d.ts +52 -0
- package/dist/rides/batch-query.js +54 -0
- package/dist/rides/index.d.ts +1 -0
- package/dist/rides/index.js +1 -0
- package/dist/rides/ride-acceptance.d.ts +105 -105
- package/dist/rides/ride-acceptance.js +2 -2
- package/dist/rides/ride-audit.d.ts +21 -21
- package/dist/rides/ride-normalized.d.ts +808 -21
- package/dist/rides/ride-normalized.js +31 -1
- package/dist/rides/ride.d.ts +6 -6
- package/dist/sams/sam.d.ts +0 -15
- package/dist/sams/sam.js +2 -2
- package/dist/stops/connections.d.ts +1 -0
- package/dist/stops/connections.js +1 -1
- package/dist/stops/equipment.d.ts +1 -0
- package/dist/stops/equipment.js +1 -1
- package/dist/stops/parent-station.d.ts +6 -6
- package/dist/stops/stop-area.d.ts +6 -6
- package/dist/stops/stop.d.ts +69 -69
- package/dist/ticketing/fare.d.ts +137 -0
- package/dist/ticketing/fare.js +44 -0
- package/dist/ticketing/index.d.ts +2 -0
- package/dist/ticketing/index.js +2 -0
- package/dist/ticketing/zone.d.ts +220 -0
- package/dist/ticketing/zone.js +34 -0
- package/dist/vehicle/emission.d.ts +3 -0
- package/dist/vehicle/emission.js +12 -0
- package/dist/vehicle/index.d.ts +4 -0
- package/dist/vehicle/index.js +4 -0
- package/dist/vehicle/propulsion.d.ts +3 -0
- package/dist/vehicle/propulsion.js +14 -0
- package/dist/vehicle/vehicle.d.ts +189 -0
- package/dist/vehicle/vehicle.js +27 -0
- package/dist/vehicle/wheelchair.d.ts +3 -0
- package/dist/vehicle/wheelchair.js +10 -0
- package/dist/vehicle-events/clickhouse-vehicle-event.d.ts +2 -6
- package/dist/vehicle-events/simplified-vehicle-event.d.ts +2 -6
- package/dist/vehicle-events/simplified-vehicle-event.js +1 -1
- package/dist/zone.d.ts +6 -6
- package/package.json +2 -2
- package/dist/alert.d.ts +0 -265
- package/dist/alert.js +0 -42
- package/dist/gtfs/cause-effetcs.d.ts +0 -86
- package/dist/gtfs/cause-effetcs.js +0 -31
- package/dist/permissions/dates.d.ts +0 -25
- package/dist/permissions/dates.js +0 -16
package/dist/organization.d.ts
CHANGED
|
@@ -6,20 +6,20 @@ export declare const HomeLinkSchema: z.ZodObject<{
|
|
|
6
6
|
title: z.ZodString;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
title: string;
|
|
9
|
-
href: string;
|
|
10
9
|
icon: string;
|
|
10
|
+
href: string;
|
|
11
11
|
order: number;
|
|
12
12
|
}, {
|
|
13
13
|
title: string;
|
|
14
|
-
href: string;
|
|
15
14
|
icon: string;
|
|
15
|
+
href: string;
|
|
16
16
|
order: number;
|
|
17
17
|
}>;
|
|
18
18
|
export type HomeLink = z.infer<typeof HomeLinkSchema>;
|
|
19
19
|
export declare const OrganizationSchema: z.ZodObject<{
|
|
20
20
|
_id: z.ZodString;
|
|
21
21
|
created_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
|
|
22
|
-
created_by: z.
|
|
22
|
+
created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
23
23
|
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
24
24
|
updated_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
|
|
25
25
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
@@ -31,13 +31,13 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
31
31
|
title: z.ZodString;
|
|
32
32
|
}, "strip", z.ZodTypeAny, {
|
|
33
33
|
title: string;
|
|
34
|
-
href: string;
|
|
35
34
|
icon: string;
|
|
35
|
+
href: string;
|
|
36
36
|
order: number;
|
|
37
37
|
}, {
|
|
38
38
|
title: string;
|
|
39
|
-
href: string;
|
|
40
39
|
icon: string;
|
|
40
|
+
href: string;
|
|
41
41
|
order: number;
|
|
42
42
|
}>, "many">>;
|
|
43
43
|
home_wikis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -51,6 +51,7 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
51
51
|
created_at: number & {
|
|
52
52
|
__brand: "UnixTimestamp";
|
|
53
53
|
};
|
|
54
|
+
created_by: string | null;
|
|
54
55
|
is_locked: boolean;
|
|
55
56
|
updated_at: number & {
|
|
56
57
|
__brand: "UnixTimestamp";
|
|
@@ -58,8 +59,8 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
58
59
|
short_name: string;
|
|
59
60
|
home_links: {
|
|
60
61
|
title: string;
|
|
61
|
-
href: string;
|
|
62
62
|
icon: string;
|
|
63
|
+
href: string;
|
|
63
64
|
order: number;
|
|
64
65
|
}[];
|
|
65
66
|
home_wikis: string[];
|
|
@@ -67,7 +68,6 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
67
68
|
logo_light: string | null;
|
|
68
69
|
long_name: string;
|
|
69
70
|
theme: string | null;
|
|
70
|
-
created_by?: string | undefined;
|
|
71
71
|
updated_by?: string | undefined;
|
|
72
72
|
}, {
|
|
73
73
|
_id: string;
|
|
@@ -75,13 +75,13 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
75
75
|
updated_at: number;
|
|
76
76
|
short_name: string;
|
|
77
77
|
long_name: string;
|
|
78
|
-
created_by?: string | undefined;
|
|
78
|
+
created_by?: string | null | undefined;
|
|
79
79
|
is_locked?: boolean | undefined;
|
|
80
80
|
updated_by?: string | undefined;
|
|
81
81
|
home_links?: {
|
|
82
82
|
title: string;
|
|
83
|
-
href: string;
|
|
84
83
|
icon: string;
|
|
84
|
+
href: string;
|
|
85
85
|
order: number;
|
|
86
86
|
}[] | undefined;
|
|
87
87
|
home_wikis?: string[] | undefined;
|
|
@@ -92,7 +92,7 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
92
92
|
export declare const CreateOrganizationSchema: z.ZodObject<Omit<{
|
|
93
93
|
_id: z.ZodString;
|
|
94
94
|
created_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
|
|
95
|
-
created_by: z.
|
|
95
|
+
created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
96
96
|
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
97
97
|
updated_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
|
|
98
98
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
@@ -104,13 +104,13 @@ export declare const CreateOrganizationSchema: z.ZodObject<Omit<{
|
|
|
104
104
|
title: z.ZodString;
|
|
105
105
|
}, "strip", z.ZodTypeAny, {
|
|
106
106
|
title: string;
|
|
107
|
-
href: string;
|
|
108
107
|
icon: string;
|
|
108
|
+
href: string;
|
|
109
109
|
order: number;
|
|
110
110
|
}, {
|
|
111
111
|
title: string;
|
|
112
|
-
href: string;
|
|
113
112
|
icon: string;
|
|
113
|
+
href: string;
|
|
114
114
|
order: number;
|
|
115
115
|
}>, "many">>;
|
|
116
116
|
home_wikis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -120,12 +120,13 @@ export declare const CreateOrganizationSchema: z.ZodObject<Omit<{
|
|
|
120
120
|
short_name: z.ZodString;
|
|
121
121
|
theme: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
122
122
|
}, "_id" | "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
123
|
+
created_by: string | null;
|
|
123
124
|
is_locked: boolean;
|
|
124
125
|
short_name: string;
|
|
125
126
|
home_links: {
|
|
126
127
|
title: string;
|
|
127
|
-
href: string;
|
|
128
128
|
icon: string;
|
|
129
|
+
href: string;
|
|
129
130
|
order: number;
|
|
130
131
|
}[];
|
|
131
132
|
home_wikis: string[];
|
|
@@ -133,18 +134,17 @@ export declare const CreateOrganizationSchema: z.ZodObject<Omit<{
|
|
|
133
134
|
logo_light: string | null;
|
|
134
135
|
long_name: string;
|
|
135
136
|
theme: string | null;
|
|
136
|
-
created_by?: string | undefined;
|
|
137
137
|
updated_by?: string | undefined;
|
|
138
138
|
}, {
|
|
139
139
|
short_name: string;
|
|
140
140
|
long_name: string;
|
|
141
|
-
created_by?: string | undefined;
|
|
141
|
+
created_by?: string | null | undefined;
|
|
142
142
|
is_locked?: boolean | undefined;
|
|
143
143
|
updated_by?: string | undefined;
|
|
144
144
|
home_links?: {
|
|
145
145
|
title: string;
|
|
146
|
-
href: string;
|
|
147
146
|
icon: string;
|
|
147
|
+
href: string;
|
|
148
148
|
order: number;
|
|
149
149
|
}[] | undefined;
|
|
150
150
|
home_wikis?: string[] | undefined;
|
|
@@ -163,13 +163,13 @@ export declare const UpdateOrganizationSchema: z.ZodObject<{
|
|
|
163
163
|
title: z.ZodString;
|
|
164
164
|
}, "strip", z.ZodTypeAny, {
|
|
165
165
|
title: string;
|
|
166
|
-
href: string;
|
|
167
166
|
icon: string;
|
|
167
|
+
href: string;
|
|
168
168
|
order: number;
|
|
169
169
|
}, {
|
|
170
170
|
title: string;
|
|
171
|
-
href: string;
|
|
172
171
|
icon: string;
|
|
172
|
+
href: string;
|
|
173
173
|
order: number;
|
|
174
174
|
}>, "many">>>;
|
|
175
175
|
home_wikis: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
@@ -183,8 +183,8 @@ export declare const UpdateOrganizationSchema: z.ZodObject<{
|
|
|
183
183
|
short_name?: string | undefined;
|
|
184
184
|
home_links?: {
|
|
185
185
|
title: string;
|
|
186
|
-
href: string;
|
|
187
186
|
icon: string;
|
|
187
|
+
href: string;
|
|
188
188
|
order: number;
|
|
189
189
|
}[] | undefined;
|
|
190
190
|
home_wikis?: string[] | undefined;
|
|
@@ -198,8 +198,8 @@ export declare const UpdateOrganizationSchema: z.ZodObject<{
|
|
|
198
198
|
short_name?: string | undefined;
|
|
199
199
|
home_links?: {
|
|
200
200
|
title: string;
|
|
201
|
-
href: string;
|
|
202
201
|
icon: string;
|
|
202
|
+
href: string;
|
|
203
203
|
order: number;
|
|
204
204
|
}[] | undefined;
|
|
205
205
|
home_wikis?: string[] | undefined;
|
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
3
|
-
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
4
|
-
scope: z.ZodLiteral<"alerts_scheduled">;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
scope: "alerts_scheduled";
|
|
7
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
8
|
-
}, {
|
|
9
|
-
scope: "alerts_scheduled";
|
|
10
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
11
|
-
}>;
|
|
12
|
-
export type AlertsScheduledPermission = z.infer<typeof AlertsScheduledPermissionSchema>;
|
|
13
|
-
export declare const AlertsRealtimePermissionSchema: z.ZodObject<{
|
|
14
|
-
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
2
|
+
export declare const AlertsPermissionSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update", "update_texts", "update_dates", "update_publish_status"]>;
|
|
15
4
|
resources: z.ZodDefault<z.ZodObject<{
|
|
16
5
|
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
reference_types: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
17
7
|
}, "strip", z.ZodTypeAny, {
|
|
18
8
|
agency_ids: string[];
|
|
9
|
+
reference_types: string[];
|
|
19
10
|
}, {
|
|
20
11
|
agency_ids?: string[] | undefined;
|
|
12
|
+
reference_types?: string[] | undefined;
|
|
21
13
|
}>>;
|
|
22
|
-
scope: z.ZodLiteral<"
|
|
14
|
+
scope: z.ZodLiteral<"alerts">;
|
|
23
15
|
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
scope: "
|
|
25
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
16
|
+
scope: "alerts";
|
|
17
|
+
action: "create" | "update" | "delete" | "read" | "lock" | "update_texts" | "update_dates" | "update_publish_status";
|
|
26
18
|
resources: {
|
|
27
19
|
agency_ids: string[];
|
|
20
|
+
reference_types: string[];
|
|
28
21
|
};
|
|
29
22
|
}, {
|
|
30
|
-
scope: "
|
|
31
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
23
|
+
scope: "alerts";
|
|
24
|
+
action: "create" | "update" | "delete" | "read" | "lock" | "update_texts" | "update_dates" | "update_publish_status";
|
|
32
25
|
resources?: {
|
|
33
26
|
agency_ids?: string[] | undefined;
|
|
27
|
+
reference_types?: string[] | undefined;
|
|
34
28
|
} | undefined;
|
|
35
29
|
}>;
|
|
36
|
-
export type
|
|
30
|
+
export type AlertsPermission = z.infer<typeof AlertsPermissionSchema>;
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
/* * */
|
|
4
|
-
export const
|
|
5
|
-
action: z.enum([
|
|
6
|
-
'
|
|
7
|
-
'read',
|
|
8
|
-
'lock',
|
|
9
|
-
'update',
|
|
10
|
-
]),
|
|
11
|
-
scope: z.literal('alerts_scheduled'),
|
|
12
|
-
});
|
|
13
|
-
/* * */
|
|
14
|
-
export const AlertsRealtimePermissionSchema = z.object({
|
|
15
|
-
action: z.enum(['create',
|
|
4
|
+
export const AlertsPermissionSchema = z.object({
|
|
5
|
+
action: z.enum([
|
|
6
|
+
'create',
|
|
16
7
|
'delete',
|
|
17
8
|
'read',
|
|
18
9
|
'lock',
|
|
19
10
|
'update',
|
|
11
|
+
'update_texts',
|
|
12
|
+
'update_dates',
|
|
13
|
+
'update_publish_status',
|
|
20
14
|
]),
|
|
21
15
|
resources: z.object({
|
|
22
16
|
agency_ids: z.array(z.string()).default([]),
|
|
17
|
+
reference_types: z.array(z.string()).default([]),
|
|
23
18
|
}).default({}),
|
|
24
|
-
scope: z.literal('
|
|
19
|
+
scope: z.literal('alerts'),
|
|
25
20
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AnnotationsPermissionSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
4
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
5
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
agency_ids: string[];
|
|
8
|
+
}, {
|
|
9
|
+
agency_ids?: string[] | undefined;
|
|
10
|
+
}>>;
|
|
11
|
+
scope: z.ZodLiteral<"annotations">;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
scope: "annotations";
|
|
14
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
15
|
+
resources: {
|
|
16
|
+
agency_ids: string[];
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
scope: "annotations";
|
|
20
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
21
|
+
resources?: {
|
|
22
|
+
agency_ids?: string[] | undefined;
|
|
23
|
+
} | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export type AnnotationsPermission = z.infer<typeof AnnotationsPermissionSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/* * */
|
|
4
|
+
export const AnnotationsPermissionSchema = z.object({
|
|
5
|
+
action: z.enum([
|
|
6
|
+
'create',
|
|
7
|
+
'delete',
|
|
8
|
+
'read',
|
|
9
|
+
'lock',
|
|
10
|
+
'update',
|
|
11
|
+
]),
|
|
12
|
+
resources: z.object({
|
|
13
|
+
agency_ids: z.array(z.string()).default([]),
|
|
14
|
+
}).default({}),
|
|
15
|
+
scope: z.literal('annotations'),
|
|
16
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FaresPermissionSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
4
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
5
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
agency_ids: string[];
|
|
8
|
+
}, {
|
|
9
|
+
agency_ids?: string[] | undefined;
|
|
10
|
+
}>>;
|
|
11
|
+
scope: z.ZodLiteral<"fares">;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
scope: "fares";
|
|
14
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
15
|
+
resources: {
|
|
16
|
+
agency_ids: string[];
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
scope: "fares";
|
|
20
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
21
|
+
resources?: {
|
|
22
|
+
agency_ids?: string[] | undefined;
|
|
23
|
+
} | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export type FaresPermission = z.infer<typeof FaresPermissionSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/* * */
|
|
4
|
+
export const FaresPermissionSchema = z.object({
|
|
5
|
+
action: z.enum([
|
|
6
|
+
'create',
|
|
7
|
+
'delete',
|
|
8
|
+
'read',
|
|
9
|
+
'lock',
|
|
10
|
+
'update',
|
|
11
|
+
]),
|
|
12
|
+
resources: z.object({
|
|
13
|
+
agency_ids: z.array(z.string()).default([]),
|
|
14
|
+
}).default({}),
|
|
15
|
+
scope: z.literal('fares'),
|
|
16
|
+
});
|
|
@@ -9,35 +9,31 @@ export declare const PermissionSchema: z.ZodDiscriminatedUnion<"scope", [z.ZodOb
|
|
|
9
9
|
scope: "agencies";
|
|
10
10
|
action: "create" | "update" | "delete" | "read" | "lock";
|
|
11
11
|
}>, z.ZodObject<{
|
|
12
|
-
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
13
|
-
scope: z.ZodLiteral<"alerts_scheduled">;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
scope: "alerts_scheduled";
|
|
16
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
17
|
-
}, {
|
|
18
|
-
scope: "alerts_scheduled";
|
|
19
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
20
|
-
}>, z.ZodObject<{
|
|
21
|
-
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
12
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update", "update_texts", "update_dates", "update_publish_status"]>;
|
|
22
13
|
resources: z.ZodDefault<z.ZodObject<{
|
|
23
14
|
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
reference_types: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
24
16
|
}, "strip", z.ZodTypeAny, {
|
|
25
17
|
agency_ids: string[];
|
|
18
|
+
reference_types: string[];
|
|
26
19
|
}, {
|
|
27
20
|
agency_ids?: string[] | undefined;
|
|
21
|
+
reference_types?: string[] | undefined;
|
|
28
22
|
}>>;
|
|
29
|
-
scope: z.ZodLiteral<"
|
|
23
|
+
scope: z.ZodLiteral<"alerts">;
|
|
30
24
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
scope: "
|
|
32
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
25
|
+
scope: "alerts";
|
|
26
|
+
action: "create" | "update" | "delete" | "read" | "lock" | "update_texts" | "update_dates" | "update_publish_status";
|
|
33
27
|
resources: {
|
|
34
28
|
agency_ids: string[];
|
|
29
|
+
reference_types: string[];
|
|
35
30
|
};
|
|
36
31
|
}, {
|
|
37
|
-
scope: "
|
|
38
|
-
action: "create" | "update" | "delete" | "read" | "lock";
|
|
32
|
+
scope: "alerts";
|
|
33
|
+
action: "create" | "update" | "delete" | "read" | "lock" | "update_texts" | "update_dates" | "update_publish_status";
|
|
39
34
|
resources?: {
|
|
40
35
|
agency_ids?: string[] | undefined;
|
|
36
|
+
reference_types?: string[] | undefined;
|
|
41
37
|
} | undefined;
|
|
42
38
|
}>, z.ZodObject<{
|
|
43
39
|
action: z.ZodEnum<["acceptance_change_status", "acceptance_justify", "acceptance_lock", "acceptance_read", "analsys_lock", "analysis_lock", "analysis_read", "analysis_reprocess", "analysis_update", "audit_lock", "audit_read", "audit_update"]>;
|
|
@@ -187,7 +183,29 @@ export declare const PermissionSchema: z.ZodDiscriminatedUnion<"scope", [z.ZodOb
|
|
|
187
183
|
scope: "users";
|
|
188
184
|
action: "create" | "update" | "delete" | "read" | "lock";
|
|
189
185
|
}>, z.ZodObject<{
|
|
190
|
-
action: z.ZodEnum<["
|
|
186
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
187
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
188
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
agency_ids: string[];
|
|
191
|
+
}, {
|
|
192
|
+
agency_ids?: string[] | undefined;
|
|
193
|
+
}>>;
|
|
194
|
+
scope: z.ZodLiteral<"vehicles">;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
scope: "vehicles";
|
|
197
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
198
|
+
resources: {
|
|
199
|
+
agency_ids: string[];
|
|
200
|
+
};
|
|
201
|
+
}, {
|
|
202
|
+
scope: "vehicles";
|
|
203
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
204
|
+
resources?: {
|
|
205
|
+
agency_ids?: string[] | undefined;
|
|
206
|
+
} | undefined;
|
|
207
|
+
}>, z.ZodObject<{
|
|
208
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
191
209
|
resources: z.ZodDefault<z.ZodObject<{
|
|
192
210
|
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
193
211
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -195,16 +213,126 @@ export declare const PermissionSchema: z.ZodDiscriminatedUnion<"scope", [z.ZodOb
|
|
|
195
213
|
}, {
|
|
196
214
|
agency_ids?: string[] | undefined;
|
|
197
215
|
}>>;
|
|
198
|
-
scope: z.ZodLiteral<"
|
|
216
|
+
scope: z.ZodLiteral<"fares">;
|
|
199
217
|
}, "strip", z.ZodTypeAny, {
|
|
200
|
-
scope: "
|
|
201
|
-
action: "
|
|
218
|
+
scope: "fares";
|
|
219
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
202
220
|
resources: {
|
|
203
221
|
agency_ids: string[];
|
|
204
222
|
};
|
|
205
223
|
}, {
|
|
206
|
-
scope: "
|
|
207
|
-
action: "
|
|
224
|
+
scope: "fares";
|
|
225
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
226
|
+
resources?: {
|
|
227
|
+
agency_ids?: string[] | undefined;
|
|
228
|
+
} | undefined;
|
|
229
|
+
}>, z.ZodObject<{
|
|
230
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
231
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
232
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
agency_ids: string[];
|
|
235
|
+
}, {
|
|
236
|
+
agency_ids?: string[] | undefined;
|
|
237
|
+
}>>;
|
|
238
|
+
scope: z.ZodLiteral<"annotations">;
|
|
239
|
+
}, "strip", z.ZodTypeAny, {
|
|
240
|
+
scope: "annotations";
|
|
241
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
242
|
+
resources: {
|
|
243
|
+
agency_ids: string[];
|
|
244
|
+
};
|
|
245
|
+
}, {
|
|
246
|
+
scope: "annotations";
|
|
247
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
248
|
+
resources?: {
|
|
249
|
+
agency_ids?: string[] | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
}>, z.ZodObject<{
|
|
252
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
253
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
254
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
agency_ids: string[];
|
|
257
|
+
}, {
|
|
258
|
+
agency_ids?: string[] | undefined;
|
|
259
|
+
}>>;
|
|
260
|
+
scope: z.ZodLiteral<"periods">;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
scope: "periods";
|
|
263
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
264
|
+
resources: {
|
|
265
|
+
agency_ids: string[];
|
|
266
|
+
};
|
|
267
|
+
}, {
|
|
268
|
+
scope: "periods";
|
|
269
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
270
|
+
resources?: {
|
|
271
|
+
agency_ids?: string[] | undefined;
|
|
272
|
+
} | undefined;
|
|
273
|
+
}>, z.ZodObject<{
|
|
274
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
275
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
276
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
agency_ids: string[];
|
|
279
|
+
}, {
|
|
280
|
+
agency_ids?: string[] | undefined;
|
|
281
|
+
}>>;
|
|
282
|
+
scope: z.ZodLiteral<"zones">;
|
|
283
|
+
}, "strip", z.ZodTypeAny, {
|
|
284
|
+
scope: "zones";
|
|
285
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
286
|
+
resources: {
|
|
287
|
+
agency_ids: string[];
|
|
288
|
+
};
|
|
289
|
+
}, {
|
|
290
|
+
scope: "zones";
|
|
291
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
292
|
+
resources?: {
|
|
293
|
+
agency_ids?: string[] | undefined;
|
|
294
|
+
} | undefined;
|
|
295
|
+
}>, z.ZodObject<{
|
|
296
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
297
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
298
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
299
|
+
}, "strip", z.ZodTypeAny, {
|
|
300
|
+
agency_ids: string[];
|
|
301
|
+
}, {
|
|
302
|
+
agency_ids?: string[] | undefined;
|
|
303
|
+
}>>;
|
|
304
|
+
scope: z.ZodLiteral<"typologies">;
|
|
305
|
+
}, "strip", z.ZodTypeAny, {
|
|
306
|
+
scope: "typologies";
|
|
307
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
308
|
+
resources: {
|
|
309
|
+
agency_ids: string[];
|
|
310
|
+
};
|
|
311
|
+
}, {
|
|
312
|
+
scope: "typologies";
|
|
313
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
314
|
+
resources?: {
|
|
315
|
+
agency_ids?: string[] | undefined;
|
|
316
|
+
} | undefined;
|
|
317
|
+
}>, z.ZodObject<{
|
|
318
|
+
action: z.ZodEnum<["create", "delete", "read", "lock", "update"]>;
|
|
319
|
+
resources: z.ZodDefault<z.ZodObject<{
|
|
320
|
+
agency_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
agency_ids: string[];
|
|
323
|
+
}, {
|
|
324
|
+
agency_ids?: string[] | undefined;
|
|
325
|
+
}>>;
|
|
326
|
+
scope: z.ZodLiteral<"lines">;
|
|
327
|
+
}, "strip", z.ZodTypeAny, {
|
|
328
|
+
scope: "lines";
|
|
329
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
330
|
+
resources: {
|
|
331
|
+
agency_ids: string[];
|
|
332
|
+
};
|
|
333
|
+
}, {
|
|
334
|
+
scope: "lines";
|
|
335
|
+
action: "create" | "update" | "delete" | "read" | "lock";
|
|
208
336
|
resources?: {
|
|
209
337
|
agency_ids?: string[] | undefined;
|
|
210
338
|
} | undefined;
|
|
@@ -232,6 +360,24 @@ export interface HasPermissionResourceArgs {
|
|
|
232
360
|
scope: string;
|
|
233
361
|
value: unknown;
|
|
234
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Arguments for getScopePermissions function.
|
|
365
|
+
*/
|
|
366
|
+
export interface GetScopePermissionsArgs<S extends Permission['scope']> {
|
|
367
|
+
actions: PermissionCatalogType[S]['actions'];
|
|
368
|
+
permissions: Permission[];
|
|
369
|
+
resource?: {
|
|
370
|
+
key: string;
|
|
371
|
+
requireAll?: boolean;
|
|
372
|
+
value: unknown;
|
|
373
|
+
};
|
|
374
|
+
scope: S;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Result object containing permission checks for a scope.
|
|
378
|
+
* Maps each action of the scope to a boolean indicating if the user has that permission.
|
|
379
|
+
*/
|
|
380
|
+
export type ScopePermissions<S extends Permission['scope']> = Record<ActionsOf<S>, boolean>;
|
|
235
381
|
/**
|
|
236
382
|
* PermissionCatalog provides a structured catalog of all available permissions
|
|
237
383
|
* in the system, categorized by scope and their respective actions.
|
|
@@ -256,6 +402,14 @@ export declare class PermissionCatalog {
|
|
|
256
402
|
action: ActionsOf<S>;
|
|
257
403
|
scope: S;
|
|
258
404
|
}> | undefined;
|
|
405
|
+
/**
|
|
406
|
+
* Get all permissions for a given scope and set of actions in one call.
|
|
407
|
+
* More efficient than calling hasPermission or hasPermissionResource multiple times.
|
|
408
|
+
* @param args Arguments object containing permissions, scope, actions, and optional resource.
|
|
409
|
+
* @param args.resource.requireAll If true, uses hasPermissionResourceAll (user must have permission for ALL values in array). If false/undefined, uses hasPermissionResource (user needs permission for ANY value).
|
|
410
|
+
* @returns Object with boolean values for each action in the scope.
|
|
411
|
+
*/
|
|
412
|
+
static getScopePermissions<S extends Permission['scope']>({ actions, permissions, resource, scope }: GetScopePermissionsArgs<S>): ScopePermissions<S>;
|
|
259
413
|
/**
|
|
260
414
|
* Check if a list of permission entries has the requested scope/action pair.
|
|
261
415
|
* @param permissionEntries The list of permission entries to check against.
|
|
@@ -279,6 +433,19 @@ export declare class PermissionCatalog {
|
|
|
279
433
|
* @returns The permission.
|
|
280
434
|
*/
|
|
281
435
|
static hasPermissionResource({ action, permissions, resource_key, scope, value }: HasPermissionResourceArgs): boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Checks whether the user has permission to perform a specific action
|
|
438
|
+
* within a specific scope for ALL values in an array.
|
|
439
|
+
* This is stricter than `hasPermissionResource` which only requires permission for ANY value.
|
|
440
|
+
* Use this for operations like update/delete where the user must have permission for all agencies involved.
|
|
441
|
+
* @param permissions The list of permissions (from a user or request).
|
|
442
|
+
* @param value The permission value(s) to check against - if array, ALL values must be permitted.
|
|
443
|
+
* @param resource_key The key of the resource.
|
|
444
|
+
* @param scope The scope of the permission.
|
|
445
|
+
* @param action The action of the permission.
|
|
446
|
+
* @returns True if user has permission for ALL values, false otherwise.
|
|
447
|
+
*/
|
|
448
|
+
static hasPermissionResourceAll({ action, permissions, resource_key, scope, value }: HasPermissionResourceArgs): boolean;
|
|
282
449
|
/**
|
|
283
450
|
* Sanitizes a list of permissions by removing any entries
|
|
284
451
|
* that do not correspond to valid scopes and actions
|
|
@@ -287,4 +454,12 @@ export declare class PermissionCatalog {
|
|
|
287
454
|
* @return A cleaned array containing only valid permissions.
|
|
288
455
|
*/
|
|
289
456
|
static sanitize(existingEntries: Permission[]): Permission[];
|
|
457
|
+
/**
|
|
458
|
+
* Sanitizes a list of permissions by removing any entries
|
|
459
|
+
* that do not correspond to valid scopes and actions
|
|
460
|
+
* defined in the PermissionCatalog.
|
|
461
|
+
* @param existingEntries Array of Permission objects to sanitize.
|
|
462
|
+
* @return A cleaned array containing only valid permissions.
|
|
463
|
+
*/
|
|
464
|
+
static updatePermissionResource<S extends Permission['scope']>(permissionEntries: Permission[], scope: S, action: ActionsOf<S>, resources: Record<string, unknown>): Permission[];
|
|
290
465
|
}
|