@ute-mueve/types 0.1.0
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/chunk-VPFLLFPQ.js +293 -0
- package/dist/chunk-VPFLLFPQ.js.map +1 -0
- package/dist/generated/index.d.ts +165 -0
- package/dist/generated/index.js +3 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/index-CIG2W8tn.d.ts +1933 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/index.js.map +1 -0
- package/package.json +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a0 as StationsSearchRequest } from './index-CIG2W8tn.js';
|
|
3
|
+
export { ag as schemas } from './index-CIG2W8tn.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A "customer key" accepted by UTE's user-scoped endpoints. Two shapes:
|
|
7
|
+
* 1. A Uruguayan cédula (CI) — 7 to 9 numeric digits.
|
|
8
|
+
* 2. A Firebase Auth UID — 20 to 32 alphanumeric chars.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: The fact that a bare CI works against `/customer/card/{key}`,
|
|
11
|
+
* `/card/{key}`, `/network/{key}` and `/remotecharge/user/{key}` is the
|
|
12
|
+
* IDOR vulnerability documented in SECURITY.md F-05. Documented here so
|
|
13
|
+
* consumers know the surface explicitly.
|
|
14
|
+
*/
|
|
15
|
+
declare const CustomerKeySchema: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
+
type CustomerKey = z.infer<typeof CustomerKeySchema>;
|
|
17
|
+
/**
|
|
18
|
+
* Verifies the check digit on a Uruguayan cédula (CI).
|
|
19
|
+
*
|
|
20
|
+
* Algorithm: pad to 8 digits with leading zeros, multiply digits 1..7 by
|
|
21
|
+
* weights [2,9,8,7,6,3,4], sum, take `(10 - sum % 10) % 10`. That must equal
|
|
22
|
+
* the 8th (check) digit.
|
|
23
|
+
*
|
|
24
|
+
* Accepts input with optional dots and dashes (e.g. `1.234.567-8`); strips
|
|
25
|
+
* non-digit characters before validating.
|
|
26
|
+
*/
|
|
27
|
+
declare function isValidUruguayanCI(input: string): boolean;
|
|
28
|
+
/** Strip dots/dashes from a Uruguayan CI string. */
|
|
29
|
+
declare function normalizeCI(input: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Uruguayan cédula (CI) — 6 to 8 digits (numeric only), validated against the
|
|
32
|
+
* official check-digit algorithm. Rejects values that fail the digit check.
|
|
33
|
+
*/
|
|
34
|
+
declare const UruguayanCISchema: z.ZodEffects<z.ZodString, string, string>;
|
|
35
|
+
type UruguayanCI = z.infer<typeof UruguayanCISchema>;
|
|
36
|
+
/** @deprecated Use `CustomerKeySchema`. Kept as alias for compatibility. */
|
|
37
|
+
declare const UserIdSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
38
|
+
type UserId = CustomerKey;
|
|
39
|
+
declare const IsoDateStringSchema: z.ZodString;
|
|
40
|
+
type IsoDateString = z.infer<typeof IsoDateStringSchema>;
|
|
41
|
+
declare const ConnectorTypeCode: z.ZodEnum<["Tipo 2", "CCS2", "CHAdeMO", "GB/T"]>;
|
|
42
|
+
type ConnectorTypeCode = z.infer<typeof ConnectorTypeCode>;
|
|
43
|
+
declare const ConnectorStatusCode: z.ZodEnum<["Disponible", "Cargando", "Sin Comunicación", "No Disponible"]>;
|
|
44
|
+
type ConnectorStatusCode = z.infer<typeof ConnectorStatusCode>;
|
|
45
|
+
declare const ConnectorPaymentTypeCode: z.ZodEnum<["Tarjeta RFID", "App"]>;
|
|
46
|
+
type ConnectorPaymentTypeCode = z.infer<typeof ConnectorPaymentTypeCode>;
|
|
47
|
+
declare const ConnectorCableCode: z.ZodEnum<["Con cable", "Sin cable"]>;
|
|
48
|
+
type ConnectorCableCode = z.infer<typeof ConnectorCableCode>;
|
|
49
|
+
declare const ConnectorNetworkCode: z.ZodEnum<["PUBLIC", "TAXI", "DMC", "ONE"]>;
|
|
50
|
+
type ConnectorNetworkCode = z.infer<typeof ConnectorNetworkCode>;
|
|
51
|
+
declare const UteFilterOptionSchema: z.ZodObject<{
|
|
52
|
+
id: z.ZodNumber;
|
|
53
|
+
internalCode: z.ZodString;
|
|
54
|
+
text: z.ZodString;
|
|
55
|
+
selected: z.ZodBoolean;
|
|
56
|
+
icon: z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
id: number;
|
|
59
|
+
internalCode: string;
|
|
60
|
+
text: string;
|
|
61
|
+
selected: boolean;
|
|
62
|
+
icon: string;
|
|
63
|
+
}, {
|
|
64
|
+
id: number;
|
|
65
|
+
internalCode: string;
|
|
66
|
+
text: string;
|
|
67
|
+
selected: boolean;
|
|
68
|
+
icon: string;
|
|
69
|
+
}>;
|
|
70
|
+
type UteFilterOption = z.infer<typeof UteFilterOptionSchema>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Expand the ergonomic `StationsSearchRequest` into the verbose UTE filter shape
|
|
74
|
+
* required by `/station/statusFiltered`. Used by both bridge route and SDK.
|
|
75
|
+
*
|
|
76
|
+
* Filter terms (Spanish display + internal codes) match the APK Flutter strings
|
|
77
|
+
* (see `lib/arm64-v8a/libapp.so` extracted via reverse engineering).
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
interface ExpandedFilters {
|
|
81
|
+
connectorTypes: UteFilterOption[];
|
|
82
|
+
connectorStatuses: UteFilterOption[];
|
|
83
|
+
connectorPaymentTypes: UteFilterOption[];
|
|
84
|
+
connectorPowers: UteFilterOption[];
|
|
85
|
+
connectorCables: UteFilterOption[];
|
|
86
|
+
connectorNetworks: UteFilterOption[];
|
|
87
|
+
}
|
|
88
|
+
declare function expandStationsFilters(input?: StationsSearchRequest): ExpandedFilters;
|
|
89
|
+
/** Reverse parse: pluck "selected" values back into ergonomic codes. */
|
|
90
|
+
declare function distance(a: {
|
|
91
|
+
lat: number;
|
|
92
|
+
lng: number;
|
|
93
|
+
}, b: {
|
|
94
|
+
lat: number;
|
|
95
|
+
lng: number;
|
|
96
|
+
}): number;
|
|
97
|
+
|
|
98
|
+
export { ConnectorCableCode, ConnectorNetworkCode, ConnectorPaymentTypeCode, ConnectorStatusCode, ConnectorTypeCode, type CustomerKey, CustomerKeySchema, type ExpandedFilters, type IsoDateString, IsoDateStringSchema, type UruguayanCI, UruguayanCISchema, type UserId, UserIdSchema, type UteFilterOption, UteFilterOptionSchema, distance, expandStationsFilters, isValidUruguayanCI, normalizeCI };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export { ConnectorCableCode, ConnectorNetworkCode, ConnectorPaymentTypeCode, ConnectorStatusCode, ConnectorTypeCode, CustomerKeySchema, IsoDateStringSchema, UruguayanCISchema, UserIdSchema, UteFilterOptionSchema, isValidUruguayanCI, normalizeCI, schemas_exports as schemas } from './chunk-VPFLLFPQ.js';
|
|
2
|
+
|
|
3
|
+
// src/filters.ts
|
|
4
|
+
var TYPE_MAP = {
|
|
5
|
+
"Tipo 2": { id: 1, text: "Tipo 2", icon: "assets/images/Tipo2/desconocido.png" },
|
|
6
|
+
CCS2: { id: 2, text: "CCS2", icon: "assets/images/CCS2/desconocido.png" },
|
|
7
|
+
CHAdeMO: { id: 3, text: "CHAdeMO", icon: "assets/images/Chademo/desconocido.png" },
|
|
8
|
+
"GB/T": { id: 4, text: "GB/T", icon: "assets/images/Gbt/desconocido.png" }
|
|
9
|
+
};
|
|
10
|
+
var STATUS_MAP = {
|
|
11
|
+
available: { id: 1, text: "Disponible" },
|
|
12
|
+
charging: { id: 2, text: "Cargando" },
|
|
13
|
+
"no-comm": { id: 3, text: "Sin Comunicaci\xF3n" },
|
|
14
|
+
unavailable: { id: 4, text: "No Disponible" }
|
|
15
|
+
};
|
|
16
|
+
var PAYMENT_MAP = {
|
|
17
|
+
rfid: { id: 1, text: "Tarjeta RFID" },
|
|
18
|
+
app: { id: 2, text: "App" }
|
|
19
|
+
};
|
|
20
|
+
var CABLE_MAP = {
|
|
21
|
+
with: { id: 1, text: "Con cable" },
|
|
22
|
+
without: { id: 2, text: "Sin cable" }
|
|
23
|
+
};
|
|
24
|
+
var NETWORK_MAP = {
|
|
25
|
+
PUBLIC: { id: 1, internalCode: "PUBLIC", text: "P\xFAblica" },
|
|
26
|
+
TAXI: { id: 2, internalCode: "TAXI", text: "Taxi" },
|
|
27
|
+
DMC: { id: 3, internalCode: "DMC", text: "DMC" },
|
|
28
|
+
ONE: { id: 4, internalCode: "ONE", text: "eOne" }
|
|
29
|
+
};
|
|
30
|
+
function expandStationsFilters(input = {}) {
|
|
31
|
+
const allTypes = Object.entries(TYPE_MAP).map(([key, v]) => ({
|
|
32
|
+
id: v.id,
|
|
33
|
+
internalCode: "",
|
|
34
|
+
text: v.text,
|
|
35
|
+
selected: input.connectorTypes ? input.connectorTypes.includes(key) : true,
|
|
36
|
+
icon: v.icon
|
|
37
|
+
}));
|
|
38
|
+
const allStatuses = Object.entries(STATUS_MAP).map(([key, v]) => ({
|
|
39
|
+
id: v.id,
|
|
40
|
+
internalCode: "",
|
|
41
|
+
text: v.text,
|
|
42
|
+
selected: input.statuses ? input.statuses.includes(key) : key === "available",
|
|
43
|
+
icon: ""
|
|
44
|
+
}));
|
|
45
|
+
const allPayments = Object.entries(PAYMENT_MAP).map(([key, v]) => ({
|
|
46
|
+
id: v.id,
|
|
47
|
+
internalCode: "",
|
|
48
|
+
text: v.text,
|
|
49
|
+
selected: input.paymentTypes ? input.paymentTypes.includes(key) : true,
|
|
50
|
+
icon: ""
|
|
51
|
+
}));
|
|
52
|
+
const allCables = Object.entries(CABLE_MAP).map(([key, v]) => ({
|
|
53
|
+
id: v.id,
|
|
54
|
+
internalCode: "",
|
|
55
|
+
text: v.text,
|
|
56
|
+
selected: input.cables ? input.cables.includes(key) : true,
|
|
57
|
+
icon: ""
|
|
58
|
+
}));
|
|
59
|
+
const allNetworks = Object.entries(NETWORK_MAP).map(([key, v]) => ({
|
|
60
|
+
id: v.id,
|
|
61
|
+
internalCode: v.internalCode,
|
|
62
|
+
text: v.text,
|
|
63
|
+
selected: input.networks ? input.networks.includes(key) : true,
|
|
64
|
+
icon: ""
|
|
65
|
+
}));
|
|
66
|
+
const powers = (input.powers && input.powers.length ? input.powers : [0]).map((p, i) => ({
|
|
67
|
+
id: i + 1,
|
|
68
|
+
internalCode: "",
|
|
69
|
+
text: String(p),
|
|
70
|
+
selected: true,
|
|
71
|
+
icon: ""
|
|
72
|
+
}));
|
|
73
|
+
return {
|
|
74
|
+
connectorTypes: allTypes,
|
|
75
|
+
connectorStatuses: allStatuses,
|
|
76
|
+
connectorPaymentTypes: allPayments,
|
|
77
|
+
connectorPowers: powers,
|
|
78
|
+
connectorCables: allCables,
|
|
79
|
+
connectorNetworks: allNetworks
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function distance(a, b) {
|
|
83
|
+
const R = 6371e3;
|
|
84
|
+
const toRad = (d) => d * Math.PI / 180;
|
|
85
|
+
const dLat = toRad(b.lat - a.lat);
|
|
86
|
+
const dLng = toRad(b.lng - a.lng);
|
|
87
|
+
const lat1 = toRad(a.lat);
|
|
88
|
+
const lat2 = toRad(b.lat);
|
|
89
|
+
const x = Math.sin(dLat / 2) ** 2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLng / 2) ** 2;
|
|
90
|
+
return 2 * R * Math.asin(Math.sqrt(x));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { distance, expandStationsFilters };
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/filters.ts"],"names":[],"mappings":";;;AAUA,IAAM,QAAA,GAAuE;AAAA,EAC3E,UAAU,EAAE,EAAA,EAAI,GAAG,IAAA,EAAM,QAAA,EAAU,MAAM,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AAA,IACvB,eAAA,EAAiB,MAAA;AAAA,IACjB,eAAA,EAAiB,SAAA;AAAA,IACjB,iBAAA,EAAmB;AAAA,GACrB;AACF;AAGO,SAAS,QAAA,CACd,GACA,CAAA,EACQ;AAER,EAAA,MAAM,CAAA,GAAI,MAAA;AACV,EAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAe,CAAA,GAAI,KAAK,EAAA,GAAM,GAAA;AAC7C,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAA,CAAE,GAAA,GAAM,EAAE,GAAG,CAAA;AAChC,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAA,CAAE,GAAA,GAAM,EAAE,GAAG,CAAA;AAChC,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAA,CAAE,GAAG,CAAA;AACxB,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAA,CAAE,GAAG,CAAA;AACxB,EAAA,MAAM,IACJ,IAAA,CAAK,GAAA,CAAI,OAAO,CAAC,CAAA,IAAK,IAAI,IAAA,CAAK,GAAA,CAAI,IAAI,CAAA,GAAI,IAAA,CAAK,IAAI,IAAI,CAAA,GAAI,KAAK,GAAA,CAAI,IAAA,GAAO,CAAC,CAAA,IAAK,CAAA;AACpF,EAAA,OAAO,IAAI,CAAA,GAAI,IAAA,CAAK,KAAK,IAAA,CAAK,IAAA,CAAK,CAAC,CAAC,CAAA;AACvC","file":"index.js","sourcesContent":["/**\n * Expand the ergonomic `StationsSearchRequest` into the verbose UTE filter shape\n * required by `/station/statusFiltered`. Used by both bridge route and SDK.\n *\n * Filter terms (Spanish display + internal codes) match the APK Flutter strings\n * (see `lib/arm64-v8a/libapp.so` extracted via reverse engineering).\n */\nimport type { StationsSearchRequest } from './schemas/stations-search.js';\nimport type { UteFilterOption } from './common.js';\n\nconst TYPE_MAP: Record<string, { id: number; text: string; icon: string }> = {\n 'Tipo 2': { id: 1, text: 'Tipo 2', icon: 'assets/images/Tipo2/desconocido.png' },\n CCS2: { id: 2, text: 'CCS2', icon: 'assets/images/CCS2/desconocido.png' },\n CHAdeMO: { id: 3, text: 'CHAdeMO', icon: 'assets/images/Chademo/desconocido.png' },\n 'GB/T': { id: 4, text: 'GB/T', icon: 'assets/images/Gbt/desconocido.png' },\n};\n\nconst STATUS_MAP: Record<string, { id: number; text: string }> = {\n available: { id: 1, text: 'Disponible' },\n charging: { id: 2, text: 'Cargando' },\n 'no-comm': { id: 3, text: 'Sin Comunicación' },\n unavailable: { id: 4, text: 'No Disponible' },\n};\n\nconst PAYMENT_MAP: Record<string, { id: number; text: string }> = {\n rfid: { id: 1, text: 'Tarjeta RFID' },\n app: { id: 2, text: 'App' },\n};\n\nconst CABLE_MAP: Record<string, { id: number; text: string }> = {\n with: { id: 1, text: 'Con cable' },\n without: { id: 2, text: 'Sin cable' },\n};\n\nconst NETWORK_MAP: Record<string, { id: number; internalCode: string; text: string }> = {\n PUBLIC: { id: 1, internalCode: 'PUBLIC', text: 'Pública' },\n TAXI: { id: 2, internalCode: 'TAXI', text: 'Taxi' },\n DMC: { id: 3, internalCode: 'DMC', text: 'DMC' },\n ONE: { id: 4, internalCode: 'ONE', text: 'eOne' },\n};\n\nexport interface ExpandedFilters {\n connectorTypes: UteFilterOption[];\n connectorStatuses: UteFilterOption[];\n connectorPaymentTypes: UteFilterOption[];\n connectorPowers: UteFilterOption[];\n connectorCables: UteFilterOption[];\n connectorNetworks: UteFilterOption[];\n}\n\nexport function expandStationsFilters(input: StationsSearchRequest = {}): ExpandedFilters {\n const allTypes = Object.entries(TYPE_MAP).map(([key, v]) => ({\n id: v.id,\n internalCode: '',\n text: v.text,\n selected: input.connectorTypes\n ? input.connectorTypes.includes(key as never)\n : true,\n icon: v.icon,\n }));\n const allStatuses = Object.entries(STATUS_MAP).map(([key, v]) => ({\n id: v.id,\n internalCode: '',\n text: v.text,\n selected: input.statuses\n ? input.statuses.includes(key as never)\n : key === 'available',\n icon: '',\n }));\n const allPayments = Object.entries(PAYMENT_MAP).map(([key, v]) => ({\n id: v.id,\n internalCode: '',\n text: v.text,\n selected: input.paymentTypes ? input.paymentTypes.includes(key as never) : true,\n icon: '',\n }));\n const allCables = Object.entries(CABLE_MAP).map(([key, v]) => ({\n id: v.id,\n internalCode: '',\n text: v.text,\n selected: input.cables ? input.cables.includes(key as never) : true,\n icon: '',\n }));\n const allNetworks = Object.entries(NETWORK_MAP).map(([key, v]) => ({\n id: v.id,\n internalCode: v.internalCode,\n text: v.text,\n selected: input.networks ? input.networks.includes(key as never) : true,\n icon: '',\n }));\n const powers = (input.powers && input.powers.length ? input.powers : [0]).map((p, i) => ({\n id: i + 1,\n internalCode: '',\n text: String(p),\n selected: true,\n icon: '',\n }));\n return {\n connectorTypes: allTypes,\n connectorStatuses: allStatuses,\n connectorPaymentTypes: allPayments,\n connectorPowers: powers,\n connectorCables: allCables,\n connectorNetworks: allNetworks,\n };\n}\n\n/** Reverse parse: pluck \"selected\" values back into ergonomic codes. */\nexport function distance(\n a: { lat: number; lng: number },\n b: { lat: number; lng: number },\n): number {\n // Haversine in meters\n const R = 6371000;\n const toRad = (d: number) => (d * Math.PI) / 180;\n const dLat = toRad(b.lat - a.lat);\n const dLng = toRad(b.lng - a.lng);\n const lat1 = toRad(a.lat);\n const lat2 = toRad(b.lat);\n const x =\n Math.sin(dLat / 2) ** 2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLng / 2) ** 2;\n return 2 * R * Math.asin(Math.sqrt(x));\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { A as AccountCardSummary, a as AccountCardSummarySchema, b as AccountEntry, c as AccountEntrySchema, d as AccountsLookupRequest, e as AccountsLookupRequestSchema, f as AccountsLookupResponse, g as AccountsLookupResponseSchema, h as AppVersion, i as AppVersionData, j as AppVersionDataSchema, k as AppVersionResponse, l as AppVersionResponseSchema, m as AppVersionSchema, C as CardDetail, n as CardDetailSchema, o as CardListResponse, p as CardListResponseSchema, q as Connector, r as ConnectorSchema, s as ConnectorStatusRequest, t as ConnectorStatusRequestSchema, u as ConnectorStatusResponse, v as ConnectorStatusResponseSchema, w as CustomerCard, x as CustomerCardList, y as CustomerCardListSchema, z as CustomerCardSchema, N as Network, B as NetworkSchema, D as NotificationRegisterRequest, E as NotificationRegisterRequestSchema, F as NotificationRegisterResponse, G as NotificationRegisterResponseSchema, R as RegisterCardRequest, H as RegisterCardRequestSchema, I as RegisterCardResponse, J as RegisterCardResponseSchema, K as RemoteChargeActionResponse, L as RemoteChargeActionResponseSchema, M as RemoteChargeHistoryResponse, O as RemoteChargeHistoryResponseSchema, P as RemoteChargeSession, Q as RemoteChargeSessionSchema, S as RenewEnergyData, T as RenewEnergyDataSchema, U as RenewEnergyRequest, V as RenewEnergyRequestSchema, W as RenewEnergyResponse, X as RenewEnergyResponseSchema, Y as StartRemoteChargeRequest, Z as StartRemoteChargeRequestSchema, _ as Station, $ as StationSchema, a0 as StationsSearchRequest, a1 as StationsSearchRequestSchema, a2 as StatusFilteredRequest, a3 as StatusFilteredRequestSchema, a4 as StatusFilteredResponse, a5 as StatusFilteredResponseSchema, a6 as StopRemoteChargeRequest, a7 as StopRemoteChargeRequestSchema, a8 as TokenRequest, a9 as TokenRequestSchema, aa as TokenResponse, ab as TokenResponseSchema, ac as UserNetworksResponse, ad as UserNetworksResponseSchema, ae as UteMessage, af as UteMessageSchema, ah as uteEnvelope } from '../index-CIG2W8tn.js';
|
|
2
|
+
import 'zod';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AccountCardSummarySchema, AccountEntrySchema, AccountsLookupRequestSchema, AccountsLookupResponseSchema, AppVersionDataSchema, AppVersionResponseSchema, AppVersionSchema, CardDetailSchema, CardListResponseSchema, ConnectorSchema, ConnectorStatusRequestSchema, ConnectorStatusResponseSchema, CustomerCardListSchema, CustomerCardSchema, NetworkSchema, NotificationRegisterRequestSchema, NotificationRegisterResponseSchema, RegisterCardRequestSchema, RegisterCardResponseSchema, RemoteChargeActionResponseSchema, RemoteChargeHistoryResponseSchema, RemoteChargeSessionSchema, RenewEnergyDataSchema, RenewEnergyRequestSchema, RenewEnergyResponseSchema, StartRemoteChargeRequestSchema, StationSchema, StationsSearchRequestSchema, StatusFilteredRequestSchema, StatusFilteredResponseSchema, StopRemoteChargeRequestSchema, TokenRequestSchema, TokenResponseSchema, UserNetworksResponseSchema, UteMessageSchema, uteEnvelope } from '../chunk-VPFLLFPQ.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ute-mueve/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Zod schemas + quicktype-generated interfaces for the UTE Mueve API (unofficial).",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Eduardo Airaudo <airaudoeduardo@gmail.com>",
|
|
9
|
+
"homepage": "https://ute-mueve.vercel.app",
|
|
10
|
+
"repository": { "type": "git", "url": "https://github.com/airaudoeduardo/ute-mueve.git", "directory": "packages/types" },
|
|
11
|
+
"bugs": { "url": "https://github.com/airaudoeduardo/ute-mueve/issues" },
|
|
12
|
+
"keywords": ["ute", "ute-mueve", "ev", "charging", "uruguay", "zod", "types"],
|
|
13
|
+
"publishConfig": { "access": "public" },
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./schemas": {
|
|
22
|
+
"types": "./dist/schemas/index.d.ts",
|
|
23
|
+
"import": "./dist/schemas/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./generated": {
|
|
26
|
+
"types": "./dist/generated/index.d.ts",
|
|
27
|
+
"import": "./dist/generated/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": ["dist", "README.md"],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"zod": "^3.23.8"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"tsup": "^8.3.0",
|
|
42
|
+
"typescript": "5.6.3",
|
|
43
|
+
"vitest": "^2.1.4"
|
|
44
|
+
}
|
|
45
|
+
}
|