cardus 0.0.4 → 0.0.6

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/types/index.ts CHANGED
@@ -1,173 +1,199 @@
1
- export type AnyObject = Record<string, any> // Object with whichever properties
1
+ export type AnyObject = Record<string, any>; // Object with whichever properties
2
2
 
3
- export type OriginalOrder = AnyObject
3
+ export type OriginalOrder = AnyObject;
4
4
 
5
5
  export type Shipment = {
6
- id_usuario: number
7
- id_agencia: number
8
- nom_ape_salida: string
9
- direccion_salida: string
10
- cod_pos_salida: string
11
- poblacion_salida: string
12
- provincia_salida: string
13
- id_zona_salida: string
14
- pais_salida: string
15
- tlf_salida: string
16
- observaciones_salida: string
17
- contacto_salida: string
18
- mail_salida: string
19
- pais_llegada: string | null
20
- provincia_llegada: string | null
21
- id_zona_llegada: string | null
22
- nom_ape_llegada: string
23
- contacto_llegada: string
24
- direccion_llegada: string
25
- cod_pos_llegada: string
26
- poblacion_llegada: string
27
- tlf_llegada: string
28
- mail_llegada: string
29
- cantidad_contrareembolso: number | null
30
- fecha_recogida: string
31
- hora_desde: string
32
- hora_hasta: string
33
- num_bultos: number,
34
- tipo_envio: Type,
35
- codigo_envio_externo: string,
36
- id_almacen: number,
37
- }
6
+ id_usuario: number;
7
+ id_agencia: number;
8
+ nom_ape_salida: string;
9
+ direccion_salida: string;
10
+ cod_pos_salida: string;
11
+ poblacion_salida: string;
12
+ provincia_salida: string;
13
+ id_zona_salida: string;
14
+ pais_salida: string;
15
+ tlf_salida: string;
16
+ observaciones_salida: string;
17
+ contacto_salida: string;
18
+ mail_salida: string;
19
+ pais_llegada: string | null;
20
+ provincia_llegada: string | null;
21
+ id_zona_llegada: string | null;
22
+ nom_ape_llegada: string;
23
+ contacto_llegada: string;
24
+ direccion_llegada: string;
25
+ cod_pos_llegada: string;
26
+ poblacion_llegada: string;
27
+ tlf_llegada: string;
28
+ mail_llegada: string;
29
+ cantidad_contrareembolso: number | null;
30
+ fecha_recogida: string;
31
+ hora_desde: string;
32
+ hora_hasta: string;
33
+ num_bultos: number;
34
+ tipo_envio: Type;
35
+ codigo_envio_externo: string;
36
+ id_almacen: number;
37
+ };
38
38
 
39
39
  export type Bulto = {
40
- id_envio: number,
41
- bulto: {
42
- peso: number,
43
- alto: number,
44
- ancho: number,
45
- largo: number,
46
- },
47
- cantidad: number,
48
- }
40
+ id_envio: number;
41
+ bulto: {
42
+ peso: number;
43
+ alto: number;
44
+ ancho: number;
45
+ largo: number;
46
+ };
47
+ cantidad: number;
48
+ };
49
49
 
50
50
  export type ModifiedOrder = {
51
- lineas: Array<AnyObject>,
52
- codigoPaisLLegada: string | undefined
53
- codigoPostalLLegada: string | undefined
54
- primerApellidoLLegada: string | undefined
55
- nombreLLegada: string | undefined
56
- direccionLLegada2: string | undefined
57
- direccionLLegada1: string | undefined
58
- ciudadLLegada: string | undefined
59
- telefonoLLegada: string | undefined
60
- emailLLegada: string | undefined
61
- cantidadContrareembolso: number | null
62
- codigoEnvioExterno: string
63
- idInternoShopify?: string
64
- precio: number | null
65
- }
51
+ lineas: Array<AnyObject>;
52
+ codigoPaisLLegada: string | undefined;
53
+ codigoPostalLLegada: string | undefined;
54
+ primerApellidoLLegada: string | undefined;
55
+ nombreLLegada: string | undefined;
56
+ direccionLLegada2: string | undefined;
57
+ direccionLLegada1: string | undefined;
58
+ ciudadLLegada: string | undefined;
59
+ telefonoLLegada: string | undefined;
60
+ emailLLegada: string | undefined;
61
+ cantidadContrareembolso: number | null;
62
+ codigoEnvioExterno: string;
63
+ idInternoShopify?: string;
64
+ precio: number | null;
65
+ };
66
66
 
67
67
  export interface ModifiedOrderExtended extends ModifiedOrder {
68
- idEnvioTemporal: number
68
+ idEnvioTemporal: number;
69
69
  }
70
70
 
71
- type FetchAllOrders = () => Promise<OriginalOrder[]>
72
- export type CrearBulto = (params: { lineItems: { idEnvioTemporal: number, line: AnyObject }, idUsuario: number }) => Promise<Bulto>
73
- type ModificarOrdenOriginal = (param: { originalOrder: OriginalOrder }) => ModifiedOrder
71
+ type FetchAllOrders = () => Promise<OriginalOrder[]>;
72
+ export type CrearBulto = (params: {
73
+ lineItems: { idEnvioTemporal: number; line: AnyObject };
74
+ idUsuario: number;
75
+ }) => Promise<Bulto>;
76
+ type ModificarOrdenOriginal = (param: {
77
+ originalOrder: OriginalOrder;
78
+ }) => ModifiedOrder;
74
79
 
75
80
  type GroupNotGrouped = {
76
- grouped?: 0 | '0'
77
- }
81
+ grouped?: 0 | '0';
82
+ };
78
83
 
79
84
  type GroupGrouped = {
80
- grouped?: 1 | '1'
81
- weight: number
82
- height: number
83
- width: number
84
- length: number
85
- }
85
+ grouped?: 1 | '1';
86
+ weight: number;
87
+ height: number;
88
+ width: number;
89
+ length: number;
90
+ };
86
91
 
87
- export type Group = GroupNotGrouped | GroupGrouped
92
+ export type Group = GroupNotGrouped | GroupGrouped;
88
93
 
89
94
  export interface InsertParams {
90
- payload: {
91
- idUsuario: number,
92
- agencyId: number,
93
- addressId: number,
94
- warehouseId: number,
95
- group: Group
96
- },
97
- fetchAllOrders: FetchAllOrders,
98
- crearBulto: CrearBulto,
99
- modificarOrdenOriginal: ModificarOrdenOriginal,
95
+ payload: {
96
+ idUsuario: number;
97
+ agencyId: number;
98
+ addressId: number;
99
+ warehouseId: number;
100
+ group: Group;
101
+ };
102
+ fetchAllOrders: FetchAllOrders;
103
+ crearBulto: CrearBulto;
104
+ modificarOrdenOriginal: ModificarOrdenOriginal;
100
105
  }
101
106
 
102
107
  export type IntegrationsService = {
103
- filterExternalDuplicatedOrders: (params: { idUsuario: number, orders: OriginalOrder[], type: Type }) => Promise<OriginalOrder[]>
104
- checkDuplicateTempShipment: (codigoEnvioExterno: string, idUsuario: number) => Promise<boolean>
105
- insertTempShipment: (params: Shipment) => number | false,
106
- insertExternalShipment: (params: {
107
- id_envio_temporal_usuario: number,
108
- codigo_envio_externo: string,
109
- id_usuario: number,
110
- fecha_hora_creacion: string,
111
- servicio: Type,
112
- id_interno_shopify?: string,
113
- }) => number | false
114
- insertTempShipmentLines: (params: { id_envio: number, bulto: Bulto['bulto'] }) => Promise<undefined>
115
- insertTempDetailsShipment: (params: { id_envio: number, bulto: Bulto['bulto'] }) => Promise<undefined>
116
- }
108
+ filterExternalDuplicatedOrders: (params: {
109
+ idUsuario: number;
110
+ orders: OriginalOrder[];
111
+ type: Type;
112
+ }) => Promise<OriginalOrder[]>;
113
+ checkDuplicateTempShipment: (
114
+ codigoEnvioExterno: string,
115
+ idUsuario: number
116
+ ) => Promise<boolean>;
117
+ insertTempShipment: (params: Shipment) => number | false;
118
+ insertExternalShipment: (params: {
119
+ id_envio_temporal_usuario: number;
120
+ codigo_envio_externo: string;
121
+ id_usuario: number;
122
+ fecha_hora_creacion: string;
123
+ servicio: Type;
124
+ id_interno_shopify?: string;
125
+ }) => number | false;
126
+ insertTempShipmentLines: (params: {
127
+ id_envio: number;
128
+ bulto: Bulto['bulto'];
129
+ }) => Promise<undefined>;
130
+ insertTempDetailsShipment: (params: {
131
+ id_envio: number;
132
+ bulto: Bulto['bulto'];
133
+ }) => Promise<undefined>;
134
+ };
117
135
 
118
136
  export type SellerAddress = {
119
- id_pais: number,
120
- codigo_postal: string,
121
- nombre: string,
122
- direccion: string,
123
- poblacion: string,
124
- provincia: string,
125
- id_zona: number,
126
- nombre_pais: string,
127
- telefono: string,
128
- observaciones: string,
129
- mail: string,
130
- country_code_unico: string
131
- }
137
+ id_pais: number;
138
+ codigo_postal: string;
139
+ nombre: string;
140
+ direccion: string;
141
+ poblacion: string;
142
+ provincia: string;
143
+ id_zona: number;
144
+ nombre_pais: string;
145
+ telefono: string;
146
+ observaciones: string;
147
+ mail: string;
148
+ country_code_unico: string;
149
+ };
132
150
 
133
151
  export type AddressesService = {
134
- getWarehouseAddress: (idUsuario: number) => Promise<SellerAddress>
135
- getAddress: (addressId: number, idUsuario: number) => Promise<SellerAddress>
136
- }
152
+ getWarehouseAddress: (idUsuario: number) => Promise<SellerAddress>;
153
+ getAddress: (addressId: number, idUsuario: number) => Promise<SellerAddress>;
154
+ };
137
155
 
138
- type Country = { nombre_pais: string, id_pais?: number }
139
- type Provincia = { nombre_provincia?: string }
140
- type Zone = string
156
+ type Country = { nombre_pais: string; id_pais?: number };
157
+ type Provincia = { nombre_provincia?: string };
158
+ type Zone = string;
141
159
 
142
160
  export type CountriesService = {
143
- getCountryFromCountryCode: (countryCode: string) => Promise<{ nombre_pais: string, id_pais?: number }>
144
- getProvinceByCountryIdAndPostalCode: (id_pais: Country["id_pais"], zipCode: string) => Promise<Provincia>
145
- getZoneIdByCountryIdAndPostalCode: (id_pais: Country["id_pais"], zipCode: string) => Promise<Zone>
146
- }
161
+ getCountryFromCountryCode: (
162
+ countryCode: string
163
+ ) => Promise<{ nombre_pais: string; id_pais?: number }>;
164
+ getProvinceByCountryIdAndPostalCode: (
165
+ id_pais: Country['id_pais'],
166
+ zipCode: string
167
+ ) => Promise<Provincia>;
168
+ getZoneIdByCountryIdAndPostalCode: (
169
+ id_pais: Country['id_pais'],
170
+ zipCode: string
171
+ ) => Promise<Zone>;
172
+ };
147
173
 
148
174
  export type FindNextPickupDate = (params: {
149
- fecha?: string,
150
- cp_salida: string,
151
- id_pais_origen?: number,
152
- id_pais_destino?: number,
153
- idAgencia?: number | null,
154
- }) => { fecha_recogida_horas: `${string},${string},${string}` }
175
+ fecha?: string;
176
+ cp_salida: string;
177
+ id_pais_origen?: number;
178
+ id_pais_destino?: number;
179
+ idAgencia?: number | null;
180
+ }) => { fecha_recogida_horas: `${string},${string},${string}` };
155
181
 
156
- export type Type = 'shopify' | 'amazon' | 'odoo'
182
+ export type Type = 'shopify' | 'amazon' | 'odoo';
157
183
 
158
184
  type ExecutionManagerConstructorParams = {
159
- arrayParams: Array<any>
160
- executable: (params?: any) => any
161
- regularExecutionTime: number,
162
- initialBatchQuantity: number
163
- }
185
+ arrayParams: Array<any>;
186
+ executable: (params?: any) => any;
187
+ regularExecutionTime: number;
188
+ initialBatchQuantity: number;
189
+ };
164
190
 
165
191
  type ExecutionManagerUploadReturn = {
166
- status: "fulfilled" | "rejected"
167
- value: any
168
- }
192
+ status: 'fulfilled' | 'rejected';
193
+ value: any;
194
+ };
169
195
 
170
196
  export type ExecutionManager = {
171
- upload(): ExecutionManagerUploadReturn[]
172
- new(params: ExecutionManagerConstructorParams): ExecutionManager
173
- }
197
+ upload(): ExecutionManagerUploadReturn[];
198
+ new (params: ExecutionManagerConstructorParams): ExecutionManager;
199
+ };