@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.
Files changed (150) hide show
  1. package/dist/_common/comment.d.ts +24 -24
  2. package/dist/_common/document.d.ts +3 -3
  3. package/dist/_common/document.js +1 -1
  4. package/dist/_common/status.d.ts +2 -2
  5. package/dist/_common/status.js +1 -1
  6. package/dist/_common/unix-timestamp.js +1 -0
  7. package/dist/agency.d.ts +6 -6
  8. package/dist/alerts/alert.d.ts +262 -0
  9. package/dist/alerts/alert.js +34 -0
  10. package/dist/alerts/cause-effect-map.d.ts +106 -0
  11. package/dist/alerts/cause-effect-map.js +94 -0
  12. package/dist/alerts/cause.d.ts +17 -0
  13. package/dist/alerts/cause.js +45 -0
  14. package/dist/alerts/effect.d.ts +17 -0
  15. package/dist/alerts/effect.js +35 -0
  16. package/dist/alerts/index.d.ts +6 -0
  17. package/dist/alerts/index.js +6 -0
  18. package/dist/alerts/query.d.ts +9 -0
  19. package/dist/alerts/query.js +6 -0
  20. package/dist/alerts/reference-type.d.ts +4 -0
  21. package/dist/alerts/reference-type.js +10 -0
  22. package/dist/apex/simplified-apex-location.d.ts +2 -12
  23. package/dist/apex/simplified-apex-location.js +1 -1
  24. package/dist/apex/simplified-apex-on-board-refund.d.ts +2 -12
  25. package/dist/apex/simplified-apex-on-board-refund.js +1 -1
  26. package/dist/apex/simplified-apex-on-board-sale.d.ts +12 -19
  27. package/dist/apex/simplified-apex-on-board-sale.js +2 -2
  28. package/dist/apex/simplified-apex-validation.d.ts +6 -16
  29. package/dist/apex/simplified-apex-validation.js +1 -1
  30. package/dist/auth/role.d.ts +718 -130
  31. package/dist/auth/session.d.ts +6 -6
  32. package/dist/auth/user.d.ts +1182 -270
  33. package/dist/auth/verification-token.d.ts +4 -4
  34. package/dist/calendar/event.d.ts +43 -0
  35. package/dist/calendar/event.js +16 -0
  36. package/dist/calendar/index.d.ts +1 -0
  37. package/dist/calendar/index.js +2 -0
  38. package/dist/dates/annotation.d.ts +6 -6
  39. package/dist/dates/date.d.ts +32 -0
  40. package/dist/dates/date.js +18 -0
  41. package/dist/dates/index.d.ts +2 -0
  42. package/dist/dates/index.js +2 -0
  43. package/dist/dates/period.d.ts +94 -0
  44. package/dist/dates/period.js +14 -0
  45. package/dist/file-exports/base.d.ts +9 -9
  46. package/dist/file-exports/file-exports.d.ts +7 -7
  47. package/dist/file-exports/ride-export.d.ts +14 -14
  48. package/dist/file-exports/ride-export.js +2 -2
  49. package/dist/gtfs/cause.d.ts +10 -0
  50. package/dist/gtfs/cause.js +18 -0
  51. package/dist/gtfs/effect.d.ts +10 -0
  52. package/dist/gtfs/effect.js +17 -0
  53. package/dist/gtfs/index.d.ts +2 -1
  54. package/dist/gtfs/index.js +2 -1
  55. package/dist/index.d.ts +5 -2
  56. package/dist/index.js +5 -2
  57. package/dist/locations/queries.d.ts +2 -2
  58. package/dist/metrics/demand/demand_by_agency.d.ts +8 -8
  59. package/dist/metrics/demand/demand_by_category.d.ts +12 -12
  60. package/dist/metrics/demand/demand_by_line.d.ts +4 -4
  61. package/dist/metrics/demand/demand_by_pattern.d.ts +8 -8
  62. package/dist/metrics/demand/demand_by_product.d.ts +12 -12
  63. package/dist/metrics/index.d.ts +93 -48
  64. package/dist/metrics/index.js +4 -1
  65. package/dist/metrics/passenger-impact/index.d.ts +1 -0
  66. package/dist/metrics/passenger-impact/index.js +1 -0
  67. package/dist/metrics/passenger-impact/passenger-impact.d.ts +97 -0
  68. package/dist/metrics/passenger-impact/passenger-impact.js +22 -0
  69. package/dist/metrics/supply/supply_by_agency.d.ts +4 -4
  70. package/dist/notification.d.ts +18 -18
  71. package/dist/offer/index.d.ts +5 -0
  72. package/dist/offer/index.js +5 -0
  73. package/dist/offer/line.d.ts +296 -0
  74. package/dist/offer/line.js +60 -0
  75. package/dist/offer/pattern.d.ts +3608 -0
  76. package/dist/offer/pattern.js +75 -0
  77. package/dist/offer/route.d.ts +187 -0
  78. package/dist/offer/route.js +33 -0
  79. package/dist/offer/scheduleRule.d.ts +80 -0
  80. package/dist/offer/scheduleRule.js +50 -0
  81. package/dist/offer/typology.d.ts +124 -0
  82. package/dist/offer/typology.js +30 -0
  83. package/dist/organization.d.ts +20 -20
  84. package/dist/permissions/alerts.d.ts +13 -19
  85. package/dist/permissions/alerts.js +8 -13
  86. package/dist/permissions/annotations.d.ts +25 -0
  87. package/dist/permissions/annotations.js +16 -0
  88. package/dist/permissions/fares.d.ts +25 -0
  89. package/dist/permissions/fares.js +16 -0
  90. package/dist/permissions/index.d.ts +196 -21
  91. package/dist/permissions/index.js +142 -6
  92. package/dist/permissions/lines.d.ts +25 -0
  93. package/dist/permissions/lines.js +16 -0
  94. package/dist/permissions/periods.d.ts +25 -0
  95. package/dist/permissions/periods.js +16 -0
  96. package/dist/permissions/typologies.d.ts +25 -0
  97. package/dist/permissions/typologies.js +16 -0
  98. package/dist/permissions/vehicles.d.ts +25 -0
  99. package/dist/permissions/vehicles.js +16 -0
  100. package/dist/permissions/zones.d.ts +25 -0
  101. package/dist/permissions/zones.js +16 -0
  102. package/dist/plans/gtfs-validation.d.ts +30 -30
  103. package/dist/plans/plan.d.ts +6 -6
  104. package/dist/proposed-change.d.ts +12 -12
  105. package/dist/rides/batch-query.d.ts +52 -0
  106. package/dist/rides/batch-query.js +54 -0
  107. package/dist/rides/index.d.ts +1 -0
  108. package/dist/rides/index.js +1 -0
  109. package/dist/rides/ride-acceptance.d.ts +105 -105
  110. package/dist/rides/ride-acceptance.js +2 -2
  111. package/dist/rides/ride-audit.d.ts +21 -21
  112. package/dist/rides/ride-normalized.d.ts +808 -21
  113. package/dist/rides/ride-normalized.js +31 -1
  114. package/dist/rides/ride.d.ts +6 -6
  115. package/dist/sams/sam.d.ts +0 -15
  116. package/dist/sams/sam.js +2 -2
  117. package/dist/stops/connections.d.ts +1 -0
  118. package/dist/stops/connections.js +1 -1
  119. package/dist/stops/equipment.d.ts +1 -0
  120. package/dist/stops/equipment.js +1 -1
  121. package/dist/stops/parent-station.d.ts +6 -6
  122. package/dist/stops/stop-area.d.ts +6 -6
  123. package/dist/stops/stop.d.ts +69 -69
  124. package/dist/ticketing/fare.d.ts +137 -0
  125. package/dist/ticketing/fare.js +44 -0
  126. package/dist/ticketing/index.d.ts +2 -0
  127. package/dist/ticketing/index.js +2 -0
  128. package/dist/ticketing/zone.d.ts +220 -0
  129. package/dist/ticketing/zone.js +34 -0
  130. package/dist/vehicle/emission.d.ts +3 -0
  131. package/dist/vehicle/emission.js +12 -0
  132. package/dist/vehicle/index.d.ts +4 -0
  133. package/dist/vehicle/index.js +4 -0
  134. package/dist/vehicle/propulsion.d.ts +3 -0
  135. package/dist/vehicle/propulsion.js +14 -0
  136. package/dist/vehicle/vehicle.d.ts +189 -0
  137. package/dist/vehicle/vehicle.js +27 -0
  138. package/dist/vehicle/wheelchair.d.ts +3 -0
  139. package/dist/vehicle/wheelchair.js +10 -0
  140. package/dist/vehicle-events/clickhouse-vehicle-event.d.ts +2 -6
  141. package/dist/vehicle-events/simplified-vehicle-event.d.ts +2 -6
  142. package/dist/vehicle-events/simplified-vehicle-event.js +1 -1
  143. package/dist/zone.d.ts +6 -6
  144. package/package.json +2 -2
  145. package/dist/alert.d.ts +0 -265
  146. package/dist/alert.js +0 -42
  147. package/dist/gtfs/cause-effetcs.d.ts +0 -86
  148. package/dist/gtfs/cause-effetcs.js +0 -31
  149. package/dist/permissions/dates.d.ts +0 -25
  150. package/dist/permissions/dates.js +0 -16
@@ -1,23 +1,27 @@
1
- /* eslint-disable @typescript-eslint/no-extraneous-class */
2
1
  /* * */
3
2
  import { AgenciesPermissionSchema } from './agencies.js';
4
- import { AlertsRealtimePermissionSchema, AlertsScheduledPermissionSchema } from './alerts.js';
3
+ import { AlertsPermissionSchema } from './alerts.js';
4
+ import { AnnotationsPermissionSchema } from './annotations.js';
5
5
  import { RidesPermissionSchema, SamsPermissionSchema } from './controller.js';
6
- import { DatesPermissionSchema } from './dates.js';
6
+ import { FaresPermissionSchema } from './fares.js';
7
7
  import { GtfsValidationsPermissionSchema } from './gtfs-validations.js';
8
8
  import { HomePermissionSchema } from './home.js';
9
+ import { LinesPermissionSchema } from './lines.js';
9
10
  import { OrganizationsPermissionSchema } from './organizations.js';
10
11
  import { PerformancePermissionSchema } from './performance.js';
12
+ import { PeriodsPermissionSchema } from './periods.js';
11
13
  import { PlansPermissionSchema } from './plans.js';
12
14
  import { RolesPermissionSchema } from './roles.js';
13
15
  import { StopsPermissionSchema } from './stops.js';
16
+ import { TypologiesPermissionSchema } from './typologies.js';
14
17
  import { UsersPermissionSchema } from './users.js';
18
+ import { VehiclesPermissionSchema } from './vehicles.js';
19
+ import { ZonesPermissionSchema } from './zones.js';
15
20
  import { z } from 'zod';
16
21
  /* * */
17
22
  export const PermissionSchema = z.discriminatedUnion('scope', [
18
23
  AgenciesPermissionSchema,
19
- AlertsScheduledPermissionSchema,
20
- AlertsRealtimePermissionSchema,
24
+ AlertsPermissionSchema,
21
25
  RidesPermissionSchema,
22
26
  SamsPermissionSchema,
23
27
  GtfsValidationsPermissionSchema,
@@ -28,7 +32,13 @@ export const PermissionSchema = z.discriminatedUnion('scope', [
28
32
  RolesPermissionSchema,
29
33
  StopsPermissionSchema,
30
34
  UsersPermissionSchema,
31
- DatesPermissionSchema,
35
+ VehiclesPermissionSchema,
36
+ FaresPermissionSchema,
37
+ AnnotationsPermissionSchema,
38
+ PeriodsPermissionSchema,
39
+ ZonesPermissionSchema,
40
+ TypologiesPermissionSchema,
41
+ LinesPermissionSchema,
32
42
  ]);
33
43
  /**
34
44
  * PermissionCatalog provides a structured catalog of all available permissions
@@ -70,6 +80,50 @@ export class PermissionCatalog {
70
80
  static get(permissionEntries, scope, action) {
71
81
  return permissionEntries.find((p) => p.scope === scope && p.action === action);
72
82
  }
83
+ /**
84
+ * Get all permissions for a given scope and set of actions in one call.
85
+ * More efficient than calling hasPermission or hasPermissionResource multiple times.
86
+ * @param args Arguments object containing permissions, scope, actions, and optional resource.
87
+ * @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).
88
+ * @returns Object with boolean values for each action in the scope.
89
+ */
90
+ static getScopePermissions({ actions, permissions, resource, scope }) {
91
+ if (!permissions) {
92
+ return Object.keys(actions).reduce((acc, key) => ({ ...acc, [key]: false }), {});
93
+ }
94
+ const result = {};
95
+ for (const [key, action] of Object.entries(actions)) {
96
+ if (!action || typeof action !== 'string') {
97
+ result[key] = false;
98
+ continue;
99
+ }
100
+ if (resource) {
101
+ // Use hasPermissionResourceAll if requireAll is true, otherwise use hasPermissionResource
102
+ if (resource.requireAll) {
103
+ result[key] = this.hasPermissionResourceAll({
104
+ action,
105
+ permissions,
106
+ resource_key: resource.key,
107
+ scope,
108
+ value: resource.value,
109
+ });
110
+ }
111
+ else {
112
+ result[key] = this.hasPermissionResource({
113
+ action,
114
+ permissions,
115
+ resource_key: resource.key,
116
+ scope,
117
+ value: resource.value,
118
+ });
119
+ }
120
+ }
121
+ else {
122
+ result[key] = this.hasPermission(permissions, scope, action);
123
+ }
124
+ }
125
+ return result;
126
+ }
73
127
  /**
74
128
  * Check if a list of permission entries has the requested scope/action pair.
75
129
  * @param permissionEntries The list of permission entries to check against.
@@ -115,6 +169,69 @@ export class PermissionCatalog {
115
169
  // or if it contains the ALLOW_ALL_FLAG.
116
170
  if (Array.isArray(resourceValues) && resourceValues.includes(this.ALLOW_ALL_FLAG))
117
171
  return true;
172
+ //
173
+ // If value is an array, check if there's any overlap between value and resourceValues
174
+ if (Array.isArray(value)) {
175
+ if (Array.isArray(resourceValues)) {
176
+ return value.some(v => resourceValues.includes(v));
177
+ }
178
+ return value.includes(resourceValues);
179
+ }
180
+ //
181
+ // If value is not an array, check if it's in resourceValues
182
+ if (Array.isArray(resourceValues) && resourceValues.includes(value))
183
+ return true;
184
+ //
185
+ // If resourceValues is not an Array, check if it is equal to the requested value
186
+ if (resourceValues === value)
187
+ return true;
188
+ //
189
+ // Otherwise, return false
190
+ return false;
191
+ //
192
+ }
193
+ /**
194
+ * Checks whether the user has permission to perform a specific action
195
+ * within a specific scope for ALL values in an array.
196
+ * This is stricter than `hasPermissionResource` which only requires permission for ANY value.
197
+ * Use this for operations like update/delete where the user must have permission for all agencies involved.
198
+ * @param permissions The list of permissions (from a user or request).
199
+ * @param value The permission value(s) to check against - if array, ALL values must be permitted.
200
+ * @param resource_key The key of the resource.
201
+ * @param scope The scope of the permission.
202
+ * @param action The action of the permission.
203
+ * @returns True if user has permission for ALL values, false otherwise.
204
+ */
205
+ static hasPermissionResourceAll({ action, permissions, resource_key, scope, value }) {
206
+ //
207
+ //
208
+ // Return false if no permissions
209
+ if (!permissions)
210
+ return false;
211
+ //
212
+ // Find the permission with the given action and scope
213
+ const foundPermission = permissions.find(p => p.action === action && p.scope === scope);
214
+ if (!foundPermission)
215
+ return false;
216
+ //
217
+ // Check if value exists in the permission.resources[resource_key]
218
+ const resourceValues = foundPermission['resources']?.[resource_key];
219
+ if (!resourceValues)
220
+ return false;
221
+ //
222
+ // If resourceValues contains the ALLOW_ALL_FLAG, user has permission for everything
223
+ if (Array.isArray(resourceValues) && resourceValues.includes(this.ALLOW_ALL_FLAG))
224
+ return true;
225
+ //
226
+ // If value is an array, check if ALL elements are in resourceValues
227
+ if (Array.isArray(value)) {
228
+ if (Array.isArray(resourceValues)) {
229
+ return value.every(v => resourceValues.includes(v));
230
+ }
231
+ return value.every(v => v === resourceValues);
232
+ }
233
+ //
234
+ // If value is not an array, check if it's in resourceValues
118
235
  if (Array.isArray(resourceValues) && resourceValues.includes(value))
119
236
  return true;
120
237
  //
@@ -148,4 +265,23 @@ export class PermissionCatalog {
148
265
  // Return the cleaned permissions array
149
266
  return Object.values(cleanedPermissions);
150
267
  }
268
+ /**
269
+ * Sanitizes a list of permissions by removing any entries
270
+ * that do not correspond to valid scopes and actions
271
+ * defined in the PermissionCatalog.
272
+ * @param existingEntries Array of Permission objects to sanitize.
273
+ * @return A cleaned array containing only valid permissions.
274
+ */
275
+ static updatePermissionResource(permissionEntries, scope, action, resources) {
276
+ // Create a copy of the existing permissions
277
+ const updatedPermissions = JSON.parse(JSON.stringify(permissionEntries));
278
+ // Find the index of the permission to update
279
+ const permissionIndex = updatedPermissions.findIndex(p => p.scope === scope && p.action === action);
280
+ if (permissionIndex === -1)
281
+ return updatedPermissions;
282
+ // Update the permission at the found index
283
+ updatedPermissions[permissionIndex]['resources'] = { ...updatedPermissions[permissionIndex]['resources'], ...resources };
284
+ // Return the updated permissions array
285
+ return updatedPermissions;
286
+ }
151
287
  }
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export declare const LinesPermissionSchema: 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<"lines">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ scope: "lines";
14
+ action: "create" | "update" | "delete" | "read" | "lock";
15
+ resources: {
16
+ agency_ids: string[];
17
+ };
18
+ }, {
19
+ scope: "lines";
20
+ action: "create" | "update" | "delete" | "read" | "lock";
21
+ resources?: {
22
+ agency_ids?: string[] | undefined;
23
+ } | undefined;
24
+ }>;
25
+ export type LinesPermission = z.infer<typeof LinesPermissionSchema>;
@@ -0,0 +1,16 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const LinesPermissionSchema = 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('lines'),
16
+ });
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export declare const PeriodsPermissionSchema: 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<"periods">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ scope: "periods";
14
+ action: "create" | "update" | "delete" | "read" | "lock";
15
+ resources: {
16
+ agency_ids: string[];
17
+ };
18
+ }, {
19
+ scope: "periods";
20
+ action: "create" | "update" | "delete" | "read" | "lock";
21
+ resources?: {
22
+ agency_ids?: string[] | undefined;
23
+ } | undefined;
24
+ }>;
25
+ export type PeriodsPermission = z.infer<typeof PeriodsPermissionSchema>;
@@ -0,0 +1,16 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const PeriodsPermissionSchema = 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('periods'),
16
+ });
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export declare const TypologiesPermissionSchema: 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<"typologies">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ scope: "typologies";
14
+ action: "create" | "update" | "delete" | "read" | "lock";
15
+ resources: {
16
+ agency_ids: string[];
17
+ };
18
+ }, {
19
+ scope: "typologies";
20
+ action: "create" | "update" | "delete" | "read" | "lock";
21
+ resources?: {
22
+ agency_ids?: string[] | undefined;
23
+ } | undefined;
24
+ }>;
25
+ export type TypologiesPermission = z.infer<typeof TypologiesPermissionSchema>;
@@ -0,0 +1,16 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const TypologiesPermissionSchema = 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('typologies'),
16
+ });
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export declare const VehiclesPermissionSchema: 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<"vehicles">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ scope: "vehicles";
14
+ action: "create" | "update" | "delete" | "read" | "lock";
15
+ resources: {
16
+ agency_ids: string[];
17
+ };
18
+ }, {
19
+ scope: "vehicles";
20
+ action: "create" | "update" | "delete" | "read" | "lock";
21
+ resources?: {
22
+ agency_ids?: string[] | undefined;
23
+ } | undefined;
24
+ }>;
25
+ export type VehiclesPermission = z.infer<typeof VehiclesPermissionSchema>;
@@ -0,0 +1,16 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const VehiclesPermissionSchema = 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('vehicles'),
16
+ });
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ export declare const ZonesPermissionSchema: 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<"zones">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ scope: "zones";
14
+ action: "create" | "update" | "delete" | "read" | "lock";
15
+ resources: {
16
+ agency_ids: string[];
17
+ };
18
+ }, {
19
+ scope: "zones";
20
+ action: "create" | "update" | "delete" | "read" | "lock";
21
+ resources?: {
22
+ agency_ids?: string[] | undefined;
23
+ } | undefined;
24
+ }>;
25
+ export type ZonesPermission = z.infer<typeof ZonesPermissionSchema>;
@@ -0,0 +1,16 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const ZonesPermissionSchema = 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('zones'),
16
+ });