@tmlmobilidade/types 20251103.1255.55 → 20251202.1817.5
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/{src/_common → _common}/index.d.ts +4 -2
- package/dist/{src/_common → _common}/index.js +4 -2
- package/dist/_common/mongo.d.ts +3 -0
- package/dist/_common/status.d.ts +13 -0
- package/dist/_common/status.js +20 -0
- package/dist/_common/utility.js +1 -0
- package/dist/{src/agency.d.ts → agency.d.ts} +4 -15
- package/dist/{src/agency.js → agency.js} +1 -6
- package/dist/{src/alert.d.ts → alert.d.ts} +20 -21
- package/dist/{src/alert.js → alert.js} +8 -14
- package/dist/{src/simplified-apex → apex}/simplified-apex-validation.d.ts +20 -20
- package/dist/{src/auth → auth}/index.d.ts +1 -1
- package/dist/{src/auth → auth}/index.js +1 -1
- package/dist/{src/auth → auth}/password-requirements.js +2 -1
- package/dist/auth/role.d.ts +958 -0
- package/dist/{src/auth → auth}/role.js +2 -2
- package/dist/{src/auth → auth}/session.d.ts +13 -9
- package/dist/{src/auth → auth}/session.js +1 -1
- package/dist/auth/user.d.ts +1281 -0
- package/dist/{src/auth → auth}/user.js +11 -14
- package/dist/{src/file-exports → file-exports}/common.d.ts +9 -8
- package/dist/{src/file-exports → file-exports}/common.js +1 -1
- package/dist/file-exports/index.d.ts +121 -0
- package/dist/file-exports/ride-export.d.ts +410 -0
- package/dist/file-exports/ride-export.js +131 -0
- package/dist/{src/file.d.ts → file.d.ts} +18 -18
- package/dist/gtfs/agency.d.ts +30 -0
- package/dist/gtfs/agency.js +13 -0
- package/dist/gtfs/feed-info.d.ts +33 -0
- package/dist/{src/gtfs.js → gtfs/feed-info.js} +1 -11
- package/dist/{src/gtfs → gtfs}/index.d.ts +3 -0
- package/dist/{src/gtfs → gtfs}/index.js +3 -0
- package/dist/gtfs/service-alert.d.ts +26 -0
- package/dist/index.d.ts +22 -22
- package/dist/index.js +22 -22
- package/dist/locations/census.d.ts +211 -0
- package/dist/locations/census.js +2 -0
- package/dist/locations/district.d.ts +24 -0
- package/dist/locations/district.js +2 -0
- package/dist/locations/index.d.ts +6 -0
- package/dist/locations/index.js +6 -0
- package/dist/locations/locality.d.ts +27 -0
- package/dist/locations/locality.js +2 -0
- package/dist/locations/municipality.d.ts +25 -0
- package/dist/locations/municipality.js +2 -0
- package/dist/locations/parish.d.ts +26 -0
- package/dist/locations/parish.js +2 -0
- package/dist/locations/queries.d.ts +117 -0
- package/dist/{src/locations.js → locations/queries.js} +5 -16
- package/dist/metrics/demand/demand_by_agency.d.ts +210 -0
- package/dist/metrics/demand/demand_by_agency.js +39 -0
- package/dist/metrics/demand/demand_by_category.d.ts +475 -0
- package/dist/metrics/demand/demand_by_category.js +114 -0
- package/dist/metrics/demand/demand_by_line.d.ts +246 -0
- package/dist/metrics/demand/demand_by_line.js +56 -0
- package/dist/metrics/demand/demand_by_pattern.d.ts +332 -0
- package/dist/metrics/demand/demand_by_pattern.js +56 -0
- package/dist/metrics/demand/demand_by_product.d.ts +475 -0
- package/dist/metrics/demand/demand_by_product.js +114 -0
- package/dist/metrics/demand/index.d.ts +6 -0
- package/dist/metrics/demand/index.js +8 -0
- package/dist/metrics/demand/records.d.ts +320 -0
- package/dist/metrics/demand/records.js +53 -0
- package/dist/metrics/index.d.ts +2647 -0
- package/dist/metrics/index.js +48 -0
- package/dist/metrics/realtime.d.ts +667 -0
- package/dist/metrics/realtime.js +41 -0
- package/dist/{src/notification.d.ts → notification.d.ts} +4 -4
- package/dist/{src/organization.d.ts → organization.d.ts} +32 -32
- package/dist/{src/organization.js → organization.js} +7 -7
- package/dist/permissions/agencies.d.ts +12 -0
- package/dist/permissions/agencies.js +13 -0
- package/dist/permissions/alerts.d.ts +36 -0
- package/dist/permissions/alerts.js +25 -0
- package/dist/permissions/controller.d.ts +36 -0
- package/dist/permissions/controller.js +30 -0
- package/dist/permissions/gtfs-validations.d.ts +25 -0
- package/dist/permissions/gtfs-validations.js +14 -0
- package/dist/permissions/home.d.ts +12 -0
- package/dist/permissions/home.js +10 -0
- package/dist/permissions/index.d.ts +268 -0
- package/dist/permissions/index.js +149 -0
- package/dist/permissions/organizations.d.ts +12 -0
- package/dist/permissions/organizations.js +12 -0
- package/dist/permissions/performance.d.ts +12 -0
- package/dist/permissions/performance.js +9 -0
- package/dist/permissions/plans.d.ts +25 -0
- package/dist/permissions/plans.js +22 -0
- package/dist/permissions/roles.d.ts +12 -0
- package/dist/permissions/roles.js +12 -0
- package/dist/permissions/stops.d.ts +30 -0
- package/dist/permissions/stops.js +17 -0
- package/dist/permissions/users.d.ts +12 -0
- package/dist/permissions/users.js +12 -0
- package/dist/{src/plans → plans}/gtfs-validation.d.ts +55 -63
- package/dist/{src/plans → plans}/gtfs-validation.js +3 -6
- package/dist/plans/plan-app-status.d.ts +15 -0
- package/dist/plans/plan-app-status.js +10 -0
- package/dist/{src/plans → plans}/plan.d.ts +240 -104
- package/dist/{src/plans → plans}/plan.js +8 -10
- package/dist/{src/_common/proposed-change.d.ts → proposed-change.d.ts} +21 -22
- package/dist/{src/_common/proposed-change.js → proposed-change.js} +5 -7
- package/dist/{src/rides → rides}/index.d.ts +1 -0
- package/dist/{src/rides → rides}/index.js +1 -0
- package/dist/{src/rides → rides}/ride-acceptance.d.ts +65 -65
- package/dist/{src/rides → rides}/ride-analysis.d.ts +34 -34
- package/dist/{src/rides → rides}/ride-audit.d.ts +10 -10
- package/dist/rides/ride-normalized.d.ts +29 -0
- package/dist/rides/ride-normalized.js +2 -0
- package/dist/{src/rides → rides}/ride.d.ts +523 -567
- package/dist/{src/rides → rides}/ride.js +2 -16
- package/dist/{src/sams → sams}/sam-analysis.d.ts +11 -11
- package/dist/{src/sams → sams}/sam-analysis.js +4 -4
- package/dist/{src/sams → sams}/sam.d.ts +76 -76
- package/dist/{src/sams → sams}/sam.js +1 -1
- package/dist/{src/stop.d.ts → stop.d.ts} +32 -43
- package/dist/{src/stop.js → stop.js} +3 -8
- package/dist/vehicle-events/gtfs-rt-vehicle-event-extended.d.ts +77 -0
- package/dist/vehicle-events/gtfs-rt-vehicle-event-extended.js +21 -0
- package/dist/vehicle-events/index.d.ts +2 -0
- package/dist/vehicle-events/index.js +2 -0
- package/dist/{src/vehicle-event.d.ts → vehicle-events/simplified-vehicle-event.d.ts} +9 -9
- package/dist/{src/vehicle-event.js → vehicle-events/simplified-vehicle-event.js} +3 -3
- package/dist/wiki.js +2 -0
- package/dist/{src/zone.d.ts → zone.d.ts} +2 -16
- package/dist/{src/zone.js → zone.js} +0 -6
- package/package.json +18 -21
- package/README.md +0 -13
- package/dist/src/_common/email.d.ts +0 -4
- package/dist/src/_common/email.js +0 -7
- package/dist/src/auth/permission.d.ts +0 -19
- package/dist/src/auth/permission.js +0 -8
- package/dist/src/auth/role.d.ts +0 -127
- package/dist/src/auth/user.d.ts +0 -311
- package/dist/src/file-exports/index.d.ts +0 -121
- package/dist/src/file-exports/ride-export.d.ts +0 -407
- package/dist/src/file-exports/ride-export.js +0 -120
- package/dist/src/gtfs.d.ts +0 -88
- package/dist/src/locations.d.ts +0 -319
- package/dist/src/metrics/demand.d.ts +0 -803
- package/dist/src/metrics/demand.js +0 -153
- package/dist/src/metrics/index.d.ts +0 -806
- package/dist/src/metrics/index.js +0 -19
- package/dist/src/plans/plan-controller.d.ts +0 -15
- package/dist/src/plans/plan-controller.js +0 -10
- package/dist/src/system/index.d.ts +0 -2
- package/dist/src/system/index.js +0 -2
- package/dist/src/system/processing-status.d.ts +0 -9
- package/dist/src/system/processing-status.js +0 -5
- package/dist/{src/_common → _common}/comment.d.ts +8 -8
- package/dist/{src/_common → _common}/comment.js +0 -0
- package/dist/{src/_common → _common}/document.d.ts +0 -0
- package/dist/{src/_common → _common}/document.js +0 -0
- package/dist/{src/system → _common}/environment.d.ts +0 -0
- package/dist/{src/system → _common}/environment.js +0 -0
- package/dist/{src/_common → _common}/fastify.d.ts +0 -0
- package/dist/{src/_common → _common}/fastify.js +0 -0
- package/dist/{src/_common/utility.js → _common/mongo.js} +0 -0
- package/dist/{src/_common → _common}/operational-date.d.ts +0 -0
- package/dist/{src/_common → _common}/operational-date.js +0 -0
- package/dist/{src/_common → _common}/unix-timestamp.d.ts +0 -0
- package/dist/{src/_common → _common}/unix-timestamp.js +0 -0
- package/dist/{src/_common → _common}/utility.d.ts +0 -0
- package/dist/{src/simplified-apex → apex}/index.d.ts +0 -0
- package/dist/{src/simplified-apex → apex}/index.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-inspection-decision.d.ts +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-inspection-decision.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-inspection.d.ts +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-inspection.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-location.d.ts +16 -16
- package/dist/{src/simplified-apex → apex}/simplified-apex-location.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-on-board-refund.d.ts +20 -20
- package/dist/{src/simplified-apex → apex}/simplified-apex-on-board-refund.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-on-board-sale.d.ts +25 -25
- package/dist/{src/simplified-apex → apex}/simplified-apex-on-board-sale.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-type.d.ts +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-type.js +0 -0
- package/dist/{src/simplified-apex → apex}/simplified-apex-validation.js +0 -0
- package/dist/{src/auth → auth}/login.d.ts +0 -0
- package/dist/{src/auth → auth}/login.js +0 -0
- package/dist/{src/auth → auth}/password-requirements.d.ts +0 -0
- package/dist/{src/auth → auth}/verification-token.d.ts +0 -0
- package/dist/{src/auth → auth}/verification-token.js +0 -0
- package/dist/{src/file-exports → file-exports}/index.js +0 -0
- package/dist/{src/file.js → file.js} +0 -0
- package/dist/{src/gtfs → gtfs}/calendar-dates.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/calendar-dates.js +0 -0
- package/dist/{src/gtfs → gtfs}/calendar.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/calendar.js +0 -0
- package/dist/{src/gtfs → gtfs}/cause-effetcs.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/cause-effetcs.js +0 -0
- package/dist/{src/gtfs → gtfs}/common.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/common.js +0 -0
- package/dist/{src/gtfs → gtfs}/routes.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/routes.js +0 -0
- package/dist/{src/pcgi/pcgi-apex-location.js → gtfs/service-alert.js} +0 -0
- package/dist/{src/gtfs → gtfs}/shapes.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/shapes.js +0 -0
- package/dist/{src/gtfs → gtfs}/stop-times.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/stop-times.js +0 -0
- package/dist/{src/gtfs → gtfs}/stops.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/stops.js +0 -0
- package/dist/{src/gtfs → gtfs}/trips.d.ts +0 -0
- package/dist/{src/gtfs → gtfs}/trips.js +0 -0
- package/dist/{src/metrics → metrics}/common.d.ts +0 -0
- package/dist/{src/metrics → metrics}/common.js +0 -0
- package/dist/{src/notification.js → notification.js} +0 -0
- package/dist/{src/pcgi → pcgi}/index.d.ts +0 -0
- package/dist/{src/pcgi → pcgi}/index.js +0 -0
- package/dist/{src/pcgi → pcgi}/pcgi-apex-location.d.ts +0 -0
- package/dist/{src/pcgi/pcgi-apex-refund.js → pcgi/pcgi-apex-location.js} +0 -0
- package/dist/{src/pcgi → pcgi}/pcgi-apex-refund.d.ts +0 -0
- package/dist/{src/pcgi/pcgi-apex-sale.js → pcgi/pcgi-apex-refund.js} +0 -0
- package/dist/{src/pcgi → pcgi}/pcgi-apex-sale.d.ts +0 -0
- package/dist/{src/pcgi/pcgi-apex-validation.js → pcgi/pcgi-apex-sale.js} +0 -0
- package/dist/{src/pcgi → pcgi}/pcgi-apex-validation.d.ts +0 -0
- package/dist/{src/pcgi/pcgi-transaction-entity.js → pcgi/pcgi-apex-validation.js} +0 -0
- package/dist/{src/pcgi → pcgi}/pcgi-transaction-entity.d.ts +0 -0
- package/dist/{src/rides/hashed-shape.js → pcgi/pcgi-transaction-entity.js} +0 -0
- package/dist/{src/plans → plans}/index.d.ts +0 -0
- package/dist/{src/plans → plans}/index.js +0 -0
- package/dist/{src/plans → plans}/plan-pcgi-legacy.d.ts +0 -0
- package/dist/{src/plans → plans}/plan-pcgi-legacy.js +0 -0
- package/dist/{src/rides → rides}/hashed-shape.d.ts +0 -0
- package/dist/{src/rides/hashed-trip.js → rides/hashed-shape.js} +0 -0
- package/dist/{src/rides → rides}/hashed-trip.d.ts +0 -0
- package/dist/{src/wiki.js → rides/hashed-trip.js} +0 -0
- package/dist/{src/rides → rides}/ride-acceptance.js +1 -1
- /package/dist/{src/rides → rides}/ride-analysis.js +0 -0
- /package/dist/{src/rides → rides}/ride-audit.js +0 -0
- /package/dist/{src/rides → rides}/ride-overrides.d.ts +0 -0
- /package/dist/{src/rides → rides}/ride-overrides.js +0 -0
- /package/dist/{src/sams → sams}/index.d.ts +0 -0
- /package/dist/{src/sams → sams}/index.js +0 -0
- /package/dist/{src/wiki.d.ts → wiki.d.ts} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type Census, type CensusFeature } from './census.js';
|
|
2
|
+
import { type District, type DistrictFeature } from './district.js';
|
|
3
|
+
import { type Locality, type LocalityFeature } from './locality.js';
|
|
4
|
+
import { type Municipality, type MunicipalityFeature } from './municipality.js';
|
|
5
|
+
import { type Parish, type ParishFeature } from './parish.js';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* This type represents the location collections available in the database,
|
|
9
|
+
* with each collection corresponding to a specific geographic entity.
|
|
10
|
+
*/
|
|
11
|
+
export interface AvailableLocations {
|
|
12
|
+
census: CensusFeature;
|
|
13
|
+
districts: DistrictFeature;
|
|
14
|
+
localities: LocalityFeature;
|
|
15
|
+
municipalities: MunicipalityFeature;
|
|
16
|
+
parishes: ParishFeature;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This type represents the aggregated location information,
|
|
20
|
+
* combining various geographic entities into a single structure.
|
|
21
|
+
* Useful for location-based queries (coordinates) and data retrieval.
|
|
22
|
+
*/
|
|
23
|
+
export interface Location {
|
|
24
|
+
census?: Census | null;
|
|
25
|
+
district: District | null;
|
|
26
|
+
latitude: number;
|
|
27
|
+
locality: Locality | null;
|
|
28
|
+
longitude: number;
|
|
29
|
+
municipality: Municipality | null;
|
|
30
|
+
parish: null | Parish;
|
|
31
|
+
}
|
|
32
|
+
export declare const GetAllDistrictsQuerySchema: z.ZodObject<{
|
|
33
|
+
geojson: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
geojson: boolean;
|
|
36
|
+
}, {
|
|
37
|
+
geojson?: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* This type represents the query parameters for fetching all Districts
|
|
41
|
+
* from the database, including an optional flag to include GeoJSON data.
|
|
42
|
+
*/
|
|
43
|
+
export type GetAllDistrictsQuery = z.infer<typeof GetAllDistrictsQuerySchema>;
|
|
44
|
+
export declare const GetAllMunicipalitiesQuerySchema: z.ZodObject<{
|
|
45
|
+
geojson: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
|
|
46
|
+
} & {
|
|
47
|
+
district_ids: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | null | undefined, unknown>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
geojson: boolean;
|
|
50
|
+
district_ids?: string[] | null | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
geojson?: unknown;
|
|
53
|
+
district_ids?: unknown;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* This type represents the query parameters for fetching all Municipalities
|
|
57
|
+
* from the database, including optional filters for District IDs and a flag
|
|
58
|
+
* to include GeoJSON data.
|
|
59
|
+
*/
|
|
60
|
+
export type GetAllMunicipalitiesQuery = z.infer<typeof GetAllMunicipalitiesQuerySchema>;
|
|
61
|
+
export declare const GetAllParishesQuerySchema: z.ZodObject<{
|
|
62
|
+
geojson: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
|
|
63
|
+
} & {
|
|
64
|
+
district_ids: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | null | undefined, unknown>;
|
|
65
|
+
} & {
|
|
66
|
+
municipality_ids: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | null | undefined, unknown>;
|
|
67
|
+
} & {
|
|
68
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
69
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
limit: number;
|
|
72
|
+
page: number;
|
|
73
|
+
geojson: boolean;
|
|
74
|
+
municipality_ids?: string[] | null | undefined;
|
|
75
|
+
district_ids?: string[] | null | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
municipality_ids?: unknown;
|
|
78
|
+
limit?: number | undefined;
|
|
79
|
+
page?: number | undefined;
|
|
80
|
+
geojson?: unknown;
|
|
81
|
+
district_ids?: unknown;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* This type represents the query parameters for fetching all Parishes
|
|
85
|
+
* from the database, including optional filters for Municipality IDs,
|
|
86
|
+
* pagination options, and a flag to include GeoJSON data.
|
|
87
|
+
*/
|
|
88
|
+
export type GetAllParishesQuery = z.infer<typeof GetAllParishesQuerySchema>;
|
|
89
|
+
export declare const GetAllLocalitiesQuerySchema: z.ZodObject<{
|
|
90
|
+
geojson: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
|
|
91
|
+
district_ids: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | null | undefined, unknown>;
|
|
92
|
+
municipality_ids: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | null | undefined, unknown>;
|
|
93
|
+
parish_ids: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | null | undefined, unknown>;
|
|
94
|
+
} & {
|
|
95
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
96
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
limit: number;
|
|
99
|
+
page: number;
|
|
100
|
+
geojson: boolean;
|
|
101
|
+
municipality_ids?: string[] | null | undefined;
|
|
102
|
+
district_ids?: string[] | null | undefined;
|
|
103
|
+
parish_ids?: string[] | null | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
municipality_ids?: unknown;
|
|
106
|
+
limit?: number | undefined;
|
|
107
|
+
page?: number | undefined;
|
|
108
|
+
geojson?: unknown;
|
|
109
|
+
district_ids?: unknown;
|
|
110
|
+
parish_ids?: unknown;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* This type represents the query parameters for fetching all Localities
|
|
114
|
+
* from the database, including optional filters for Parish IDs,
|
|
115
|
+
* pagination options, and a flag to include GeoJSON data.
|
|
116
|
+
*/
|
|
117
|
+
export type GetAllLocalitiesQuery = z.infer<typeof GetAllLocalitiesQuerySchema>;
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This file defines two distinct type categories:
|
|
5
|
-
*
|
|
6
|
-
* 1. DATABASE TYPES: These maintain the complete GeoJSON Feature structure with geometry
|
|
7
|
-
* and properties nested within the Feature object. This structure is optimized for
|
|
8
|
-
* MongoDB's spatial indexing and querying capabilities, allowing for efficient
|
|
9
|
-
* geospatial operations directly on the database.
|
|
10
|
-
*
|
|
11
|
-
* 2. CODEBASE TYPES: These flatten the GeoJSON structure by extracting properties to the
|
|
12
|
-
* top level and moving the complete Feature to a separate 'geojson' field. This makes
|
|
13
|
-
* them much easier to work with in application code since you can directly access
|
|
14
|
-
* properties like location.name instead of location.properties.name.
|
|
15
|
-
*/
|
|
1
|
+
/* * */
|
|
2
|
+
import { PaginationSchema } from '../_common/index.js';
|
|
16
3
|
import { z } from 'zod';
|
|
17
|
-
import { PaginationSchema } from './_common/index.js';
|
|
18
4
|
/* * */
|
|
19
5
|
export const GetAllDistrictsQuerySchema = z.object({
|
|
20
6
|
geojson: z.preprocess((val) => val === 'true' || val === '1', z.boolean()),
|
|
21
7
|
});
|
|
8
|
+
/* * */
|
|
22
9
|
export const GetAllMunicipalitiesQuerySchema = GetAllDistrictsQuerySchema.extend({
|
|
23
10
|
district_ids: z
|
|
24
11
|
.preprocess(val => typeof val === 'string' ? val.split(',').map(s => s.trim()).filter(Boolean) : val, z.array(z.string()).nullish()),
|
|
25
12
|
});
|
|
13
|
+
/* * */
|
|
26
14
|
export const GetAllParishesQuerySchema = GetAllMunicipalitiesQuerySchema.extend({
|
|
27
15
|
municipality_ids: z
|
|
28
16
|
.preprocess(val => typeof val === 'string' ? val.split(',').map(s => s.trim()).filter(Boolean) : val, z.array(z.string()).nullish()),
|
|
29
17
|
}).extend(PaginationSchema.shape);
|
|
18
|
+
/* * */
|
|
30
19
|
export const GetAllLocalitiesQuerySchema = GetAllParishesQuerySchema.extend({ parish_ids: z.preprocess(val => typeof val === 'string' ? val.split(',').map(s => s.trim()).filter(Boolean) : val, z.array(z.string()).nullish()),
|
|
31
20
|
}).extend(PaginationSchema.shape);
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DemandByAgencyByYearSchema: z.ZodObject<{
|
|
3
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4
|
+
generated_at: z.ZodDate;
|
|
5
|
+
data: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
6
|
+
qty: z.ZodNumber;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
qty: number;
|
|
9
|
+
}, {
|
|
10
|
+
qty: number;
|
|
11
|
+
}>>;
|
|
12
|
+
properties: z.ZodObject<{
|
|
13
|
+
agency_id: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
agency_id: string;
|
|
16
|
+
}, {
|
|
17
|
+
agency_id: string;
|
|
18
|
+
}>;
|
|
19
|
+
} & {
|
|
20
|
+
metric: z.ZodLiteral<"demand_by_agency_by_year">;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
properties: {
|
|
23
|
+
agency_id: string;
|
|
24
|
+
};
|
|
25
|
+
generated_at: Date;
|
|
26
|
+
metric: "demand_by_agency_by_year";
|
|
27
|
+
data: Record<string, {
|
|
28
|
+
qty: number;
|
|
29
|
+
}>;
|
|
30
|
+
description?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
properties: {
|
|
33
|
+
agency_id: string;
|
|
34
|
+
};
|
|
35
|
+
generated_at: Date;
|
|
36
|
+
metric: "demand_by_agency_by_year";
|
|
37
|
+
data: Record<string, {
|
|
38
|
+
qty: number;
|
|
39
|
+
}>;
|
|
40
|
+
description?: string | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const DemandByAgencyByMonthSchema: z.ZodObject<{
|
|
43
|
+
description: z.ZodOptional<z.ZodString>;
|
|
44
|
+
generated_at: z.ZodDate;
|
|
45
|
+
data: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
46
|
+
qty: z.ZodNumber;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
qty: number;
|
|
49
|
+
}, {
|
|
50
|
+
qty: number;
|
|
51
|
+
}>>;
|
|
52
|
+
properties: z.ZodObject<{
|
|
53
|
+
agency_id: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
agency_id: string;
|
|
56
|
+
}, {
|
|
57
|
+
agency_id: string;
|
|
58
|
+
}>;
|
|
59
|
+
} & {
|
|
60
|
+
metric: z.ZodLiteral<"demand_by_agency_by_month">;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
properties: {
|
|
63
|
+
agency_id: string;
|
|
64
|
+
};
|
|
65
|
+
generated_at: Date;
|
|
66
|
+
metric: "demand_by_agency_by_month";
|
|
67
|
+
data: Record<string, {
|
|
68
|
+
qty: number;
|
|
69
|
+
}>;
|
|
70
|
+
description?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
properties: {
|
|
73
|
+
agency_id: string;
|
|
74
|
+
};
|
|
75
|
+
generated_at: Date;
|
|
76
|
+
metric: "demand_by_agency_by_month";
|
|
77
|
+
data: Record<string, {
|
|
78
|
+
qty: number;
|
|
79
|
+
}>;
|
|
80
|
+
description?: string | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
export declare const DemandByAgencyByDaySchema: z.ZodObject<{
|
|
83
|
+
description: z.ZodOptional<z.ZodString>;
|
|
84
|
+
generated_at: z.ZodDate;
|
|
85
|
+
properties: z.ZodObject<{
|
|
86
|
+
agency_id: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
agency_id: string;
|
|
89
|
+
}, {
|
|
90
|
+
agency_id: string;
|
|
91
|
+
}>;
|
|
92
|
+
} & {
|
|
93
|
+
data: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
94
|
+
day_type: z.ZodEnum<["1", "2", "3"]>;
|
|
95
|
+
holiday: z.ZodEnum<["0", "1"]>;
|
|
96
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
97
|
+
period: z.ZodEnum<["1", "2", "3"]>;
|
|
98
|
+
qty: z.ZodNumber;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
qty: number;
|
|
101
|
+
day_type: "1" | "2" | "3";
|
|
102
|
+
holiday: "0" | "1";
|
|
103
|
+
notes: string | null;
|
|
104
|
+
period: "1" | "2" | "3";
|
|
105
|
+
}, {
|
|
106
|
+
qty: number;
|
|
107
|
+
day_type: "1" | "2" | "3";
|
|
108
|
+
holiday: "0" | "1";
|
|
109
|
+
notes: string | null;
|
|
110
|
+
period: "1" | "2" | "3";
|
|
111
|
+
}>>;
|
|
112
|
+
metric: z.ZodLiteral<"demand_by_agency_by_day">;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
properties: {
|
|
115
|
+
agency_id: string;
|
|
116
|
+
};
|
|
117
|
+
generated_at: Date;
|
|
118
|
+
metric: "demand_by_agency_by_day";
|
|
119
|
+
data: Record<string, {
|
|
120
|
+
qty: number;
|
|
121
|
+
day_type: "1" | "2" | "3";
|
|
122
|
+
holiday: "0" | "1";
|
|
123
|
+
notes: string | null;
|
|
124
|
+
period: "1" | "2" | "3";
|
|
125
|
+
}>;
|
|
126
|
+
description?: string | undefined;
|
|
127
|
+
}, {
|
|
128
|
+
properties: {
|
|
129
|
+
agency_id: string;
|
|
130
|
+
};
|
|
131
|
+
generated_at: Date;
|
|
132
|
+
metric: "demand_by_agency_by_day";
|
|
133
|
+
data: Record<string, {
|
|
134
|
+
qty: number;
|
|
135
|
+
day_type: "1" | "2" | "3";
|
|
136
|
+
holiday: "0" | "1";
|
|
137
|
+
notes: string | null;
|
|
138
|
+
period: "1" | "2" | "3";
|
|
139
|
+
}>;
|
|
140
|
+
description?: string | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
export declare const DemandByAgencyByDayByProductSchema: z.ZodObject<{
|
|
143
|
+
description: z.ZodOptional<z.ZodString>;
|
|
144
|
+
generated_at: z.ZodDate;
|
|
145
|
+
properties: z.ZodObject<{
|
|
146
|
+
agency_id: z.ZodString;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
agency_id: string;
|
|
149
|
+
}, {
|
|
150
|
+
agency_id: string;
|
|
151
|
+
}>;
|
|
152
|
+
} & {
|
|
153
|
+
data: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
154
|
+
day_type: z.ZodEnum<["1", "2", "3"]>;
|
|
155
|
+
holiday: z.ZodEnum<["0", "1"]>;
|
|
156
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
157
|
+
period: z.ZodEnum<["1", "2", "3"]>;
|
|
158
|
+
products: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
159
|
+
qty: z.ZodNumber;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
qty: number;
|
|
162
|
+
day_type: "1" | "2" | "3";
|
|
163
|
+
holiday: "0" | "1";
|
|
164
|
+
notes: string | null;
|
|
165
|
+
period: "1" | "2" | "3";
|
|
166
|
+
products: Record<string, number>;
|
|
167
|
+
}, {
|
|
168
|
+
qty: number;
|
|
169
|
+
day_type: "1" | "2" | "3";
|
|
170
|
+
holiday: "0" | "1";
|
|
171
|
+
notes: string | null;
|
|
172
|
+
period: "1" | "2" | "3";
|
|
173
|
+
products: Record<string, number>;
|
|
174
|
+
}>>;
|
|
175
|
+
metric: z.ZodLiteral<"demand_by_agency_by_day_by_product">;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
properties: {
|
|
178
|
+
agency_id: string;
|
|
179
|
+
};
|
|
180
|
+
generated_at: Date;
|
|
181
|
+
metric: "demand_by_agency_by_day_by_product";
|
|
182
|
+
data: Record<string, {
|
|
183
|
+
qty: number;
|
|
184
|
+
day_type: "1" | "2" | "3";
|
|
185
|
+
holiday: "0" | "1";
|
|
186
|
+
notes: string | null;
|
|
187
|
+
period: "1" | "2" | "3";
|
|
188
|
+
products: Record<string, number>;
|
|
189
|
+
}>;
|
|
190
|
+
description?: string | undefined;
|
|
191
|
+
}, {
|
|
192
|
+
properties: {
|
|
193
|
+
agency_id: string;
|
|
194
|
+
};
|
|
195
|
+
generated_at: Date;
|
|
196
|
+
metric: "demand_by_agency_by_day_by_product";
|
|
197
|
+
data: Record<string, {
|
|
198
|
+
qty: number;
|
|
199
|
+
day_type: "1" | "2" | "3";
|
|
200
|
+
holiday: "0" | "1";
|
|
201
|
+
notes: string | null;
|
|
202
|
+
period: "1" | "2" | "3";
|
|
203
|
+
products: Record<string, number>;
|
|
204
|
+
}>;
|
|
205
|
+
description?: string | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
export type DemandByAgencyByYear = z.infer<typeof DemandByAgencyByYearSchema>;
|
|
208
|
+
export type DemandByAgencyByMonth = z.infer<typeof DemandByAgencyByMonthSchema>;
|
|
209
|
+
export type DemandByAgencyByDay = z.infer<typeof DemandByAgencyByDaySchema>;
|
|
210
|
+
export type DemandByAgencyByDayByProduct = z.infer<typeof DemandByAgencyByDayByProductSchema>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { MetricBaseSchema } from '../common.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/* DEMAND BY AGENCY */
|
|
5
|
+
const DemandByAgencySchema = MetricBaseSchema.extend({
|
|
6
|
+
data: z.record(z.string(), z.object({
|
|
7
|
+
qty: z.number(),
|
|
8
|
+
})),
|
|
9
|
+
properties: z.object({
|
|
10
|
+
agency_id: z.string(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
export const DemandByAgencyByYearSchema = DemandByAgencySchema.extend({
|
|
14
|
+
metric: z.literal('demand_by_agency_by_year'),
|
|
15
|
+
});
|
|
16
|
+
export const DemandByAgencyByMonthSchema = DemandByAgencySchema.extend({
|
|
17
|
+
metric: z.literal('demand_by_agency_by_month'),
|
|
18
|
+
});
|
|
19
|
+
export const DemandByAgencyByDaySchema = DemandByAgencySchema.extend({
|
|
20
|
+
data: z.record(z.string(), z.object({
|
|
21
|
+
day_type: z.enum(['1', '2', '3']),
|
|
22
|
+
holiday: z.enum(['0', '1']),
|
|
23
|
+
notes: z.string().nullable(),
|
|
24
|
+
period: z.enum(['1', '2', '3']),
|
|
25
|
+
qty: z.number(),
|
|
26
|
+
})),
|
|
27
|
+
metric: z.literal('demand_by_agency_by_day'),
|
|
28
|
+
});
|
|
29
|
+
export const DemandByAgencyByDayByProductSchema = DemandByAgencySchema.extend({
|
|
30
|
+
data: z.record(z.string(), z.object({
|
|
31
|
+
day_type: z.enum(['1', '2', '3']),
|
|
32
|
+
holiday: z.enum(['0', '1']),
|
|
33
|
+
notes: z.string().nullable(),
|
|
34
|
+
period: z.enum(['1', '2', '3']),
|
|
35
|
+
products: z.record(z.string().describe('Product ID'), z.number()),
|
|
36
|
+
qty: z.number(),
|
|
37
|
+
})),
|
|
38
|
+
metric: z.literal('demand_by_agency_by_day_by_product'),
|
|
39
|
+
});
|