@agroyaar/sdk 1.1.4-0 → 1.1.4-1

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
@@ -87,33 +87,8 @@ var mappers = {
87
87
  machineUsageIds: response.machineUsageIds
88
88
  }),
89
89
  getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
90
- getMechanization: (response) => ({
91
- id: response.id,
92
- commonName: response.commonName,
93
- model: response.model,
94
- avatarURL: response.avatarURL,
95
- manufactureYear: response.manufactureYear,
96
- code: response.code,
97
- kind: response.kind,
98
- kindName: response.kindName,
99
- variety: mappers.getMechanizationVariety(response.variety)
100
- }),
101
- getMechanizationsList: (response) => response.map(mappers.getMechanization),
102
- getMotorizedMechanizationSensor: (response) => ({
103
- id: response.id,
104
- speed: response.speed,
105
- heading: response.heading,
106
- latitude: response.latitude,
107
- longitude: response.longitude,
108
- fuelLevel: response.fuelLevel,
109
- engineRpm: response.engineRpm,
110
- deviceCode: response.deviceCode,
111
- stateEngine: response.stateEngine,
112
- engineOilPressure: response.engineOilPressure,
113
- engineWaterTemperature: response.engineWaterTemperature,
114
- batteryChargePercentage: response.batteryChargePercentage,
115
- mechanizationId: response.mechanizationId,
116
- mechanization: mappers.getMechanization(response.mechanization)
90
+ SubmitTrackingDeviceData: (response) => ({
91
+ deviceCode: response.deviceCode
117
92
  })
118
93
  };
119
94
 
@@ -137,34 +112,20 @@ var createMechanizationServices = (client) => ({
137
112
  return import_ts_belt.R.Error(err);
138
113
  }
139
114
  },
140
- getMechanizations: async ({ farmerId, kindName }) => {
141
- try {
142
- const { data } = await client.get(
143
- `/farmers/${farmerId}/mechanizations?kindName=${kindName}`
144
- );
145
- return import_ts_belt.R.Ok(
146
- mappers.getMechanizationsList(data.result.data.mechanizations)
147
- );
148
- } catch (error) {
149
- const err = error instanceof Error ? error : new Error(String(error));
150
- console.error("Mechanization API Error:", err);
151
- return import_ts_belt.R.Error(err);
152
- }
153
- },
154
- getMotorizedMechanizationSensors: async ({
115
+ SubmitTrackingDeviceResData: async ({
155
116
  farmerId,
156
- mechanizationId
117
+ mechanizationId,
118
+ deviceCode
157
119
  }) => {
158
120
  try {
159
- const { data } = await client.get(
160
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors`
161
- );
162
- return import_ts_belt.R.Ok(
163
- mappers.getMechanizationsList(data.result.data.mechanizations)
121
+ const { data } = await client.post(
122
+ `/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
123
+ { deviceCode }
164
124
  );
125
+ return import_ts_belt.R.Ok(mappers.SubmitTrackingDeviceData(data));
165
126
  } catch (error) {
166
127
  const err = error instanceof Error ? error : new Error(String(error));
167
- console.error("Mechanization API Error:", err);
128
+ console.error("SubmitTrackingDevice API Error:", err);
168
129
  return import_ts_belt.R.Error(err);
169
130
  }
170
131
  }
package/dist/index.d.ts CHANGED
@@ -11,7 +11,6 @@ type Branded<T, B> = Brand<B> & T;
11
11
  declare namespace Identifiers {
12
12
  type MechanizationVarietyId = Branded<string, "mechanizationVarietyId-id">;
13
13
  type MechanizationId = Branded<string, "mechanizationId-id">;
14
- type MotorizedMechanizationSensorsId = Branded<string, "motorized-mechanization-sensorsId-id">;
15
14
  }
16
15
 
17
16
  type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP";
@@ -65,28 +64,15 @@ type MechanizationModel = {
65
64
  variety: MechanizationVarietyModel;
66
65
  };
67
66
  type MechanizationVariables = {
68
- farmerId: string;
69
67
  kindName: MechanizationType;
70
68
  };
71
- type MotorizedMechanizationSensorsModel = {
72
- id: string;
73
- speed: number;
74
- heading: string;
75
- latitude: number;
76
- longitude: number;
77
- fuelLevel: number;
78
- engineRpm: number;
69
+ type SubmitTrackingDeviceModel = {
79
70
  deviceCode: string;
80
- stateEngine: boolean;
81
- engineOilPressure: boolean;
82
- engineWaterTemperature: string;
83
- batteryChargePercentage: string;
84
- mechanizationId: string;
85
- mechanization: MechanizationModel;
86
71
  };
87
- type MotorizedMechanizationSensorsVariables = {
72
+ type SubmitTrackingDeviceVariables = {
88
73
  farmerId: string;
89
74
  mechanizationId: string;
75
+ deviceCode: string;
90
76
  };
91
77
 
92
78
  type ClientConfig = {
@@ -98,10 +84,9 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
98
84
  dashboardServices: {
99
85
  mechanization: {
100
86
  getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
101
- getMechanizations: ({ farmerId, kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
102
- getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
87
+ SubmitTrackingDeviceResData: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SubmitTrackingDeviceModel>>;
103
88
  };
104
89
  };
105
90
  };
106
91
 
107
- export { type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type ServiceType, type Status, type StatusType, type TaskType, type VarietyKind, createSDK };
92
+ export { type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type ServiceType, type Status, type StatusType, type SubmitTrackingDeviceModel, type SubmitTrackingDeviceVariables, type TaskType, type VarietyKind, createSDK };
package/dist/index.mjs CHANGED
@@ -51,33 +51,8 @@ var mappers = {
51
51
  machineUsageIds: response.machineUsageIds
52
52
  }),
53
53
  getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
54
- getMechanization: (response) => ({
55
- id: response.id,
56
- commonName: response.commonName,
57
- model: response.model,
58
- avatarURL: response.avatarURL,
59
- manufactureYear: response.manufactureYear,
60
- code: response.code,
61
- kind: response.kind,
62
- kindName: response.kindName,
63
- variety: mappers.getMechanizationVariety(response.variety)
64
- }),
65
- getMechanizationsList: (response) => response.map(mappers.getMechanization),
66
- getMotorizedMechanizationSensor: (response) => ({
67
- id: response.id,
68
- speed: response.speed,
69
- heading: response.heading,
70
- latitude: response.latitude,
71
- longitude: response.longitude,
72
- fuelLevel: response.fuelLevel,
73
- engineRpm: response.engineRpm,
74
- deviceCode: response.deviceCode,
75
- stateEngine: response.stateEngine,
76
- engineOilPressure: response.engineOilPressure,
77
- engineWaterTemperature: response.engineWaterTemperature,
78
- batteryChargePercentage: response.batteryChargePercentage,
79
- mechanizationId: response.mechanizationId,
80
- mechanization: mappers.getMechanization(response.mechanization)
54
+ SubmitTrackingDeviceData: (response) => ({
55
+ deviceCode: response.deviceCode
81
56
  })
82
57
  };
83
58
 
@@ -101,34 +76,20 @@ var createMechanizationServices = (client) => ({
101
76
  return R.Error(err);
102
77
  }
103
78
  },
104
- getMechanizations: async ({ farmerId, kindName }) => {
105
- try {
106
- const { data } = await client.get(
107
- `/farmers/${farmerId}/mechanizations?kindName=${kindName}`
108
- );
109
- return R.Ok(
110
- mappers.getMechanizationsList(data.result.data.mechanizations)
111
- );
112
- } catch (error) {
113
- const err = error instanceof Error ? error : new Error(String(error));
114
- console.error("Mechanization API Error:", err);
115
- return R.Error(err);
116
- }
117
- },
118
- getMotorizedMechanizationSensors: async ({
79
+ SubmitTrackingDeviceResData: async ({
119
80
  farmerId,
120
- mechanizationId
81
+ mechanizationId,
82
+ deviceCode
121
83
  }) => {
122
84
  try {
123
- const { data } = await client.get(
124
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors`
125
- );
126
- return R.Ok(
127
- mappers.getMechanizationsList(data.result.data.mechanizations)
85
+ const { data } = await client.post(
86
+ `/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
87
+ { deviceCode }
128
88
  );
89
+ return R.Ok(mappers.SubmitTrackingDeviceData(data));
129
90
  } catch (error) {
130
91
  const err = error instanceof Error ? error : new Error(String(error));
131
- console.error("Mechanization API Error:", err);
92
+ console.error("SubmitTrackingDevice API Error:", err);
132
93
  return R.Error(err);
133
94
  }
134
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "1.1.4-0",
3
+ "version": "1.1.4-1",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",