@agroyaar/sdk 2.2.0 → 2.3.0-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/index.cjs +62 -14
- package/dist/index.d.ts +13 -1
- package/dist/index.mjs +62 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -91,7 +91,7 @@ var createClient = (config, middlewares = []) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
94
|
-
var
|
|
94
|
+
var import_ts_belt3 = require("@mobily/ts-belt");
|
|
95
95
|
|
|
96
96
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
97
97
|
var mappers = {
|
|
@@ -187,6 +187,50 @@ var wrapError = (error) => {
|
|
|
187
187
|
return import_ts_belt.R.Error(err);
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
+
// src/services/dashboard/mechanization/temperature-changes.ts
|
|
191
|
+
var import_ts_belt2 = require("@mobily/ts-belt");
|
|
192
|
+
var mappers2 = {
|
|
193
|
+
getMechanizationTemperatureChange: ({
|
|
194
|
+
engineWaterTemperature,
|
|
195
|
+
date
|
|
196
|
+
}) => ({
|
|
197
|
+
engineWaterTemperature,
|
|
198
|
+
date
|
|
199
|
+
}),
|
|
200
|
+
getMechanizationTemperatureChanges: (response) => response.map(mappers2.getMechanizationTemperatureChange)
|
|
201
|
+
};
|
|
202
|
+
var createMechanizationTemperatureChangesServices = (client) => ({
|
|
203
|
+
getMechanizationTemperatureChanges: async ({
|
|
204
|
+
farmerId,
|
|
205
|
+
mechanizationId,
|
|
206
|
+
fromDate,
|
|
207
|
+
toDate
|
|
208
|
+
}) => {
|
|
209
|
+
try {
|
|
210
|
+
const response = await client.typed(
|
|
211
|
+
"get",
|
|
212
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/temperature-changes",
|
|
213
|
+
{
|
|
214
|
+
params: {
|
|
215
|
+
fromDate,
|
|
216
|
+
toDate
|
|
217
|
+
},
|
|
218
|
+
pathParams: {
|
|
219
|
+
farmerId,
|
|
220
|
+
mechanizationId
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
const temperatureChanges = response.result.data.temperatureChanges;
|
|
225
|
+
return import_ts_belt2.R.Ok(
|
|
226
|
+
mappers2.getMechanizationTemperatureChanges(temperatureChanges)
|
|
227
|
+
);
|
|
228
|
+
} catch (error) {
|
|
229
|
+
return wrapError(error);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
190
234
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
191
235
|
var createMechanizationServices = (client) => ({
|
|
192
236
|
getMechanizationVarieties: async ({
|
|
@@ -196,7 +240,7 @@ var createMechanizationServices = (client) => ({
|
|
|
196
240
|
const { data } = await client.get(
|
|
197
241
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
198
242
|
);
|
|
199
|
-
return
|
|
243
|
+
return import_ts_belt3.R.Ok(
|
|
200
244
|
mappers.getMechanizationVarietyList(
|
|
201
245
|
data.result.data.mechanizationVarieties
|
|
202
246
|
)
|
|
@@ -213,14 +257,17 @@ var createMechanizationServices = (client) => ({
|
|
|
213
257
|
const { data } = await client.get(
|
|
214
258
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
215
259
|
);
|
|
216
|
-
return
|
|
260
|
+
return import_ts_belt3.R.Ok(
|
|
217
261
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
218
262
|
);
|
|
219
263
|
} catch (error) {
|
|
220
264
|
return wrapError(error);
|
|
221
265
|
}
|
|
222
266
|
},
|
|
223
|
-
getMechanization: async ({
|
|
267
|
+
getMechanization: async ({
|
|
268
|
+
farmerId,
|
|
269
|
+
mechanizationId
|
|
270
|
+
}) => {
|
|
224
271
|
try {
|
|
225
272
|
const response = await client.typed(
|
|
226
273
|
"get",
|
|
@@ -233,7 +280,7 @@ var createMechanizationServices = (client) => ({
|
|
|
233
280
|
}
|
|
234
281
|
);
|
|
235
282
|
const mechanization = response.result.data.mechanization;
|
|
236
|
-
return
|
|
283
|
+
return import_ts_belt3.R.Ok(mappers.getMechanization(mechanization));
|
|
237
284
|
} catch (error) {
|
|
238
285
|
return wrapError(error);
|
|
239
286
|
}
|
|
@@ -256,7 +303,7 @@ var createMechanizationServices = (client) => ({
|
|
|
256
303
|
}
|
|
257
304
|
);
|
|
258
305
|
const mechanizations = response.result.data.mechanizations;
|
|
259
|
-
return
|
|
306
|
+
return import_ts_belt3.R.Ok(mappers.getMechanizations(mechanizations));
|
|
260
307
|
} catch (error) {
|
|
261
308
|
return wrapError(error);
|
|
262
309
|
}
|
|
@@ -277,7 +324,7 @@ var createMechanizationServices = (client) => ({
|
|
|
277
324
|
}
|
|
278
325
|
);
|
|
279
326
|
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
280
|
-
return
|
|
327
|
+
return import_ts_belt3.R.Ok(
|
|
281
328
|
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
282
329
|
);
|
|
283
330
|
} catch (error) {
|
|
@@ -294,7 +341,7 @@ var createMechanizationServices = (client) => ({
|
|
|
294
341
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
295
342
|
{ deviceCode }
|
|
296
343
|
);
|
|
297
|
-
return
|
|
344
|
+
return import_ts_belt3.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
298
345
|
} catch (error) {
|
|
299
346
|
return wrapError(error);
|
|
300
347
|
}
|
|
@@ -304,7 +351,7 @@ var createMechanizationServices = (client) => ({
|
|
|
304
351
|
const { data } = await client.get(
|
|
305
352
|
"/statics/mechanizations-seasons-process-kinds"
|
|
306
353
|
);
|
|
307
|
-
return
|
|
354
|
+
return import_ts_belt3.R.Ok(
|
|
308
355
|
mappers.getSeasonsProcessList(
|
|
309
356
|
data.result.data.mechanizationSeasonProcessKinds
|
|
310
357
|
)
|
|
@@ -324,7 +371,7 @@ var createMechanizationServices = (client) => ({
|
|
|
324
371
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
325
372
|
{ deviceCode, verificationToken }
|
|
326
373
|
);
|
|
327
|
-
return
|
|
374
|
+
return import_ts_belt3.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
328
375
|
} catch (error) {
|
|
329
376
|
return wrapError(error);
|
|
330
377
|
}
|
|
@@ -343,7 +390,7 @@ var createMechanizationServices = (client) => ({
|
|
|
343
390
|
}
|
|
344
391
|
);
|
|
345
392
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
346
|
-
return
|
|
393
|
+
return import_ts_belt3.R.Ok(mappers.getQuestions(questions));
|
|
347
394
|
} catch (error) {
|
|
348
395
|
return wrapError(error);
|
|
349
396
|
}
|
|
@@ -370,7 +417,7 @@ var createMechanizationServices = (client) => ({
|
|
|
370
417
|
}
|
|
371
418
|
);
|
|
372
419
|
const movementChanges = response.result.data.movementChanges;
|
|
373
|
-
return
|
|
420
|
+
return import_ts_belt3.R.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
374
421
|
} catch (error) {
|
|
375
422
|
return wrapError(error);
|
|
376
423
|
}
|
|
@@ -387,11 +434,12 @@ var createMechanizationServices = (client) => ({
|
|
|
387
434
|
data: { verificationToken }
|
|
388
435
|
}
|
|
389
436
|
);
|
|
390
|
-
return
|
|
437
|
+
return import_ts_belt3.R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
391
438
|
} catch (error) {
|
|
392
439
|
return wrapError(error);
|
|
393
440
|
}
|
|
394
|
-
}
|
|
441
|
+
},
|
|
442
|
+
...createMechanizationTemperatureChangesServices(client)
|
|
395
443
|
});
|
|
396
444
|
|
|
397
445
|
// src/index.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -2959,6 +2959,17 @@ type ExtendedClient = AxiosInstance & {
|
|
|
2959
2959
|
}) => Promise<ResponseData<Op>>;
|
|
2960
2960
|
};
|
|
2961
2961
|
|
|
2962
|
+
type MechanizationTemperatureChangesModel = {
|
|
2963
|
+
engineWaterTemperature: number;
|
|
2964
|
+
date: string;
|
|
2965
|
+
};
|
|
2966
|
+
type MechanizationTemperatureChangesVariable = {
|
|
2967
|
+
farmerId: string;
|
|
2968
|
+
mechanizationId: string;
|
|
2969
|
+
fromDate?: string | null | undefined;
|
|
2970
|
+
toDate?: string | null | undefined;
|
|
2971
|
+
};
|
|
2972
|
+
|
|
2962
2973
|
type ClientConfig = {
|
|
2963
2974
|
readonly baseURL: string;
|
|
2964
2975
|
};
|
|
@@ -2967,9 +2978,10 @@ declare const createClient: (config: ClientConfig, middlewares?: ((_config: Inte
|
|
|
2967
2978
|
declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof createClient>[1]) => {
|
|
2968
2979
|
dashboardServices: {
|
|
2969
2980
|
mechanization: {
|
|
2981
|
+
getMechanizationTemperatureChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationTemperatureChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationTemperatureChangesModel[]>>;
|
|
2970
2982
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationVarietyModel[]>>;
|
|
2971
2983
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
|
|
2972
|
-
getMechanization: ({ farmerId, mechanizationId }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel>>;
|
|
2984
|
+
getMechanization: ({ farmerId, mechanizationId, }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel>>;
|
|
2973
2985
|
getMechanizations: ({ farmerId, kindName, }: MechanizationsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
2974
2986
|
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
|
|
2975
2987
|
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ var createClient = (config, middlewares = []) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
58
|
-
import { R as
|
|
58
|
+
import { R as R3 } from "@mobily/ts-belt";
|
|
59
59
|
|
|
60
60
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
61
61
|
var mappers = {
|
|
@@ -151,6 +151,50 @@ var wrapError = (error) => {
|
|
|
151
151
|
return R.Error(err);
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
+
// src/services/dashboard/mechanization/temperature-changes.ts
|
|
155
|
+
import { R as R2 } from "@mobily/ts-belt";
|
|
156
|
+
var mappers2 = {
|
|
157
|
+
getMechanizationTemperatureChange: ({
|
|
158
|
+
engineWaterTemperature,
|
|
159
|
+
date
|
|
160
|
+
}) => ({
|
|
161
|
+
engineWaterTemperature,
|
|
162
|
+
date
|
|
163
|
+
}),
|
|
164
|
+
getMechanizationTemperatureChanges: (response) => response.map(mappers2.getMechanizationTemperatureChange)
|
|
165
|
+
};
|
|
166
|
+
var createMechanizationTemperatureChangesServices = (client) => ({
|
|
167
|
+
getMechanizationTemperatureChanges: async ({
|
|
168
|
+
farmerId,
|
|
169
|
+
mechanizationId,
|
|
170
|
+
fromDate,
|
|
171
|
+
toDate
|
|
172
|
+
}) => {
|
|
173
|
+
try {
|
|
174
|
+
const response = await client.typed(
|
|
175
|
+
"get",
|
|
176
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/temperature-changes",
|
|
177
|
+
{
|
|
178
|
+
params: {
|
|
179
|
+
fromDate,
|
|
180
|
+
toDate
|
|
181
|
+
},
|
|
182
|
+
pathParams: {
|
|
183
|
+
farmerId,
|
|
184
|
+
mechanizationId
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
const temperatureChanges = response.result.data.temperatureChanges;
|
|
189
|
+
return R2.Ok(
|
|
190
|
+
mappers2.getMechanizationTemperatureChanges(temperatureChanges)
|
|
191
|
+
);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
return wrapError(error);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
154
198
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
155
199
|
var createMechanizationServices = (client) => ({
|
|
156
200
|
getMechanizationVarieties: async ({
|
|
@@ -160,7 +204,7 @@ var createMechanizationServices = (client) => ({
|
|
|
160
204
|
const { data } = await client.get(
|
|
161
205
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
162
206
|
);
|
|
163
|
-
return
|
|
207
|
+
return R3.Ok(
|
|
164
208
|
mappers.getMechanizationVarietyList(
|
|
165
209
|
data.result.data.mechanizationVarieties
|
|
166
210
|
)
|
|
@@ -177,14 +221,17 @@ var createMechanizationServices = (client) => ({
|
|
|
177
221
|
const { data } = await client.get(
|
|
178
222
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
179
223
|
);
|
|
180
|
-
return
|
|
224
|
+
return R3.Ok(
|
|
181
225
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
182
226
|
);
|
|
183
227
|
} catch (error) {
|
|
184
228
|
return wrapError(error);
|
|
185
229
|
}
|
|
186
230
|
},
|
|
187
|
-
getMechanization: async ({
|
|
231
|
+
getMechanization: async ({
|
|
232
|
+
farmerId,
|
|
233
|
+
mechanizationId
|
|
234
|
+
}) => {
|
|
188
235
|
try {
|
|
189
236
|
const response = await client.typed(
|
|
190
237
|
"get",
|
|
@@ -197,7 +244,7 @@ var createMechanizationServices = (client) => ({
|
|
|
197
244
|
}
|
|
198
245
|
);
|
|
199
246
|
const mechanization = response.result.data.mechanization;
|
|
200
|
-
return
|
|
247
|
+
return R3.Ok(mappers.getMechanization(mechanization));
|
|
201
248
|
} catch (error) {
|
|
202
249
|
return wrapError(error);
|
|
203
250
|
}
|
|
@@ -220,7 +267,7 @@ var createMechanizationServices = (client) => ({
|
|
|
220
267
|
}
|
|
221
268
|
);
|
|
222
269
|
const mechanizations = response.result.data.mechanizations;
|
|
223
|
-
return
|
|
270
|
+
return R3.Ok(mappers.getMechanizations(mechanizations));
|
|
224
271
|
} catch (error) {
|
|
225
272
|
return wrapError(error);
|
|
226
273
|
}
|
|
@@ -241,7 +288,7 @@ var createMechanizationServices = (client) => ({
|
|
|
241
288
|
}
|
|
242
289
|
);
|
|
243
290
|
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
244
|
-
return
|
|
291
|
+
return R3.Ok(
|
|
245
292
|
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
246
293
|
);
|
|
247
294
|
} catch (error) {
|
|
@@ -258,7 +305,7 @@ var createMechanizationServices = (client) => ({
|
|
|
258
305
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
259
306
|
{ deviceCode }
|
|
260
307
|
);
|
|
261
|
-
return
|
|
308
|
+
return R3.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
262
309
|
} catch (error) {
|
|
263
310
|
return wrapError(error);
|
|
264
311
|
}
|
|
@@ -268,7 +315,7 @@ var createMechanizationServices = (client) => ({
|
|
|
268
315
|
const { data } = await client.get(
|
|
269
316
|
"/statics/mechanizations-seasons-process-kinds"
|
|
270
317
|
);
|
|
271
|
-
return
|
|
318
|
+
return R3.Ok(
|
|
272
319
|
mappers.getSeasonsProcessList(
|
|
273
320
|
data.result.data.mechanizationSeasonProcessKinds
|
|
274
321
|
)
|
|
@@ -288,7 +335,7 @@ var createMechanizationServices = (client) => ({
|
|
|
288
335
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
289
336
|
{ deviceCode, verificationToken }
|
|
290
337
|
);
|
|
291
|
-
return
|
|
338
|
+
return R3.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
292
339
|
} catch (error) {
|
|
293
340
|
return wrapError(error);
|
|
294
341
|
}
|
|
@@ -307,7 +354,7 @@ var createMechanizationServices = (client) => ({
|
|
|
307
354
|
}
|
|
308
355
|
);
|
|
309
356
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
310
|
-
return
|
|
357
|
+
return R3.Ok(mappers.getQuestions(questions));
|
|
311
358
|
} catch (error) {
|
|
312
359
|
return wrapError(error);
|
|
313
360
|
}
|
|
@@ -334,7 +381,7 @@ var createMechanizationServices = (client) => ({
|
|
|
334
381
|
}
|
|
335
382
|
);
|
|
336
383
|
const movementChanges = response.result.data.movementChanges;
|
|
337
|
-
return
|
|
384
|
+
return R3.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
338
385
|
} catch (error) {
|
|
339
386
|
return wrapError(error);
|
|
340
387
|
}
|
|
@@ -351,11 +398,12 @@ var createMechanizationServices = (client) => ({
|
|
|
351
398
|
data: { verificationToken }
|
|
352
399
|
}
|
|
353
400
|
);
|
|
354
|
-
return
|
|
401
|
+
return R3.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
355
402
|
} catch (error) {
|
|
356
403
|
return wrapError(error);
|
|
357
404
|
}
|
|
358
|
-
}
|
|
405
|
+
},
|
|
406
|
+
...createMechanizationTemperatureChangesServices(client)
|
|
359
407
|
});
|
|
360
408
|
|
|
361
409
|
// src/index.ts
|