@agroyaar/sdk 1.5.0 → 1.5.2
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 +23 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.mjs +23 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -129,6 +129,9 @@ var mappers = {
|
|
|
129
129
|
}),
|
|
130
130
|
SubmitTrackingDeviceData: (response) => ({
|
|
131
131
|
deviceCode: response.deviceCode
|
|
132
|
+
}),
|
|
133
|
+
UpdateTrackingDeviceData: (response) => ({
|
|
134
|
+
deviceCode: response.deviceCode
|
|
132
135
|
})
|
|
133
136
|
};
|
|
134
137
|
|
|
@@ -195,7 +198,8 @@ var createMechanizationServices = (client) => ({
|
|
|
195
198
|
);
|
|
196
199
|
} catch (error) {
|
|
197
200
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
198
|
-
console.error("Mechanization API Error:", err);
|
|
201
|
+
console.error("Motorized Mechanization Sensors API Error:", err);
|
|
202
|
+
return import_ts_belt.R.Error(err);
|
|
199
203
|
}
|
|
200
204
|
},
|
|
201
205
|
SubmitTrackingDeviceCode: async ({
|
|
@@ -230,6 +234,24 @@ var createMechanizationServices = (client) => ({
|
|
|
230
234
|
console.error("getSeasonsProcess API Error:", err);
|
|
231
235
|
return import_ts_belt.R.Error(err);
|
|
232
236
|
}
|
|
237
|
+
},
|
|
238
|
+
UpdateTrackingDeviceCode: async ({
|
|
239
|
+
farmerId,
|
|
240
|
+
mechanizationId,
|
|
241
|
+
deviceCode,
|
|
242
|
+
verificationToken
|
|
243
|
+
}) => {
|
|
244
|
+
try {
|
|
245
|
+
const { data } = await client.put(
|
|
246
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
247
|
+
{ deviceCode, verificationToken }
|
|
248
|
+
);
|
|
249
|
+
return import_ts_belt.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
250
|
+
} catch (error) {
|
|
251
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
252
|
+
console.error("UpdateTrackingDevice API Error:", err);
|
|
253
|
+
return import_ts_belt.R.Error(err);
|
|
254
|
+
}
|
|
233
255
|
}
|
|
234
256
|
});
|
|
235
257
|
|
package/dist/index.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ declare namespace ServerResponseTypes {
|
|
|
100
100
|
mechanizationId: string;
|
|
101
101
|
mechanization: MechanizationDTO;
|
|
102
102
|
};
|
|
103
|
-
type
|
|
103
|
+
type TrackingDeviceResultDTO = {
|
|
104
104
|
model: string;
|
|
105
105
|
commonName: string;
|
|
106
106
|
manufactureYear: number;
|
|
@@ -279,7 +279,7 @@ type MotorizedMechanizationSensorsVariables = {
|
|
|
279
279
|
farmerId: string;
|
|
280
280
|
mechanizationId: string;
|
|
281
281
|
};
|
|
282
|
-
type
|
|
282
|
+
type TrackingDeviceCodeModel = {
|
|
283
283
|
deviceCode: string;
|
|
284
284
|
};
|
|
285
285
|
type SubmitTrackingDeviceVariables = {
|
|
@@ -295,6 +295,12 @@ type SpeedChangesChartVariables = {
|
|
|
295
295
|
farmerId: Identifiers.FarmerId;
|
|
296
296
|
mechanizationId: Identifiers.MechanizationId;
|
|
297
297
|
};
|
|
298
|
+
type UpdateTrackingDeviceVariables = {
|
|
299
|
+
farmerId: Identifiers.FarmerId;
|
|
300
|
+
mechanizationId: Identifiers.MechanizationId;
|
|
301
|
+
deviceCode: string;
|
|
302
|
+
verificationToken: string;
|
|
303
|
+
};
|
|
298
304
|
|
|
299
305
|
type ClientConfig = {
|
|
300
306
|
readonly baseURL: string;
|
|
@@ -307,11 +313,12 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
307
313
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
|
|
308
314
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Ok<SpeedChangesChartModel[]> | undefined>;
|
|
309
315
|
getMechanizations: ({ kindName, farmerId }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
310
|
-
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.
|
|
311
|
-
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<
|
|
316
|
+
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
|
|
317
|
+
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
312
318
|
getSeasonsProcess: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SeasonsProcessModel[]>>;
|
|
319
|
+
UpdateTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, verificationToken, }: UpdateTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
313
320
|
};
|
|
314
321
|
};
|
|
315
322
|
};
|
|
316
323
|
|
|
317
|
-
export { type BaseResponse, type MechanizationListData, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MotorizedMechanizationSensorsData, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServerResponse, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type
|
|
324
|
+
export { type BaseResponse, type MechanizationListData, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MotorizedMechanizationSensorsData, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServerResponse, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, createSDK };
|
package/dist/index.mjs
CHANGED
|
@@ -93,6 +93,9 @@ var mappers = {
|
|
|
93
93
|
}),
|
|
94
94
|
SubmitTrackingDeviceData: (response) => ({
|
|
95
95
|
deviceCode: response.deviceCode
|
|
96
|
+
}),
|
|
97
|
+
UpdateTrackingDeviceData: (response) => ({
|
|
98
|
+
deviceCode: response.deviceCode
|
|
96
99
|
})
|
|
97
100
|
};
|
|
98
101
|
|
|
@@ -159,7 +162,8 @@ var createMechanizationServices = (client) => ({
|
|
|
159
162
|
);
|
|
160
163
|
} catch (error) {
|
|
161
164
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
162
|
-
console.error("Mechanization API Error:", err);
|
|
165
|
+
console.error("Motorized Mechanization Sensors API Error:", err);
|
|
166
|
+
return R.Error(err);
|
|
163
167
|
}
|
|
164
168
|
},
|
|
165
169
|
SubmitTrackingDeviceCode: async ({
|
|
@@ -194,6 +198,24 @@ var createMechanizationServices = (client) => ({
|
|
|
194
198
|
console.error("getSeasonsProcess API Error:", err);
|
|
195
199
|
return R.Error(err);
|
|
196
200
|
}
|
|
201
|
+
},
|
|
202
|
+
UpdateTrackingDeviceCode: async ({
|
|
203
|
+
farmerId,
|
|
204
|
+
mechanizationId,
|
|
205
|
+
deviceCode,
|
|
206
|
+
verificationToken
|
|
207
|
+
}) => {
|
|
208
|
+
try {
|
|
209
|
+
const { data } = await client.put(
|
|
210
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
211
|
+
{ deviceCode, verificationToken }
|
|
212
|
+
);
|
|
213
|
+
return R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
214
|
+
} catch (error) {
|
|
215
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
216
|
+
console.error("UpdateTrackingDevice API Error:", err);
|
|
217
|
+
return R.Error(err);
|
|
218
|
+
}
|
|
197
219
|
}
|
|
198
220
|
});
|
|
199
221
|
|