@agroyaar/sdk 1.0.7 → 1.0.9-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 CHANGED
@@ -89,7 +89,12 @@ var mappers = {
89
89
  seasonProcessIds: response.seasonProcessIds,
90
90
  machineUsageIds: response.machineUsageIds
91
91
  }),
92
- getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety)
92
+ getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
93
+ getSpeedChangesChart: (response) => ({
94
+ speed: response.speed,
95
+ date: response.date
96
+ }),
97
+ getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart)
93
98
  };
94
99
 
95
100
  // src/services/dashboard/mechanization/mechanization.service.ts
@@ -111,6 +116,23 @@ var createMechanizationServices = (client) => ({
111
116
  console.error("MechanizationVariety API Error:", err);
112
117
  return import_ts_belt.R.Error(err);
113
118
  }
119
+ },
120
+ getSpeedChangesChartData: async ({
121
+ farmerId,
122
+ mechanizationId
123
+ }) => {
124
+ try {
125
+ const { data } = await client.get(
126
+ `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed/changes`
127
+ );
128
+ return import_ts_belt.R.Ok(
129
+ mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
130
+ );
131
+ } catch (error) {
132
+ const err = error instanceof Error ? error : new Error(String(error));
133
+ console.error("SpeedChangesChartPointsList API Error:", err);
134
+ return import_ts_belt.R.Error(err);
135
+ }
114
136
  }
115
137
  });
116
138
 
package/dist/index.d.ts CHANGED
@@ -21,6 +21,14 @@ type MechanizationVarietyModel = {
21
21
  type MechanizationVarietyVariables = {
22
22
  kindName: "MOTORIZED" | "NON_MOTORIZED";
23
23
  };
24
+ type SpeedChangesChartModel = {
25
+ speed: number;
26
+ date: string;
27
+ };
28
+ type SpeedChangesChartVariables = {
29
+ farmerId: string;
30
+ mechanizationId: string;
31
+ };
24
32
 
25
33
  type ClientConfig = {
26
34
  readonly baseURL: string;
@@ -31,8 +39,9 @@ declare const createSDK: (config: ClientConfig) => {
31
39
  dashboardServices: {
32
40
  mechanization: {
33
41
  getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
42
+ getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
34
43
  };
35
44
  };
36
45
  };
37
46
 
38
- export { type MechanizationVarietyModel, type MechanizationVarietyVariables, createSDK };
47
+ export { type MechanizationVarietyModel, type MechanizationVarietyVariables, type SpeedChangesChartModel, type SpeedChangesChartVariables, createSDK };
package/dist/index.mjs CHANGED
@@ -53,7 +53,12 @@ var mappers = {
53
53
  seasonProcessIds: response.seasonProcessIds,
54
54
  machineUsageIds: response.machineUsageIds
55
55
  }),
56
- getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety)
56
+ getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
57
+ getSpeedChangesChart: (response) => ({
58
+ speed: response.speed,
59
+ date: response.date
60
+ }),
61
+ getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart)
57
62
  };
58
63
 
59
64
  // src/services/dashboard/mechanization/mechanization.service.ts
@@ -75,6 +80,23 @@ var createMechanizationServices = (client) => ({
75
80
  console.error("MechanizationVariety API Error:", err);
76
81
  return R.Error(err);
77
82
  }
83
+ },
84
+ getSpeedChangesChartData: async ({
85
+ farmerId,
86
+ mechanizationId
87
+ }) => {
88
+ try {
89
+ const { data } = await client.get(
90
+ `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed/changes`
91
+ );
92
+ return R.Ok(
93
+ mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
94
+ );
95
+ } catch (error) {
96
+ const err = error instanceof Error ? error : new Error(String(error));
97
+ console.error("SpeedChangesChartPointsList API Error:", err);
98
+ return R.Error(err);
99
+ }
78
100
  }
79
101
  });
80
102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9-0",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",