@agroyaar/sdk 1.5.0 → 1.5.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 +21 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.mjs +21 -0
- 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
|
|
|
@@ -230,6 +233,24 @@ var createMechanizationServices = (client) => ({
|
|
|
230
233
|
console.error("getSeasonsProcess API Error:", err);
|
|
231
234
|
return import_ts_belt.R.Error(err);
|
|
232
235
|
}
|
|
236
|
+
},
|
|
237
|
+
UpdateTrackingDeviceCode: async ({
|
|
238
|
+
farmerId,
|
|
239
|
+
mechanizationId,
|
|
240
|
+
deviceCode,
|
|
241
|
+
verificationToken
|
|
242
|
+
}) => {
|
|
243
|
+
try {
|
|
244
|
+
const { data } = await client.put(
|
|
245
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
246
|
+
{ deviceCode, verificationToken }
|
|
247
|
+
);
|
|
248
|
+
return import_ts_belt.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
249
|
+
} catch (error) {
|
|
250
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
251
|
+
console.error("UpdateTrackingDevice API Error:", err);
|
|
252
|
+
return import_ts_belt.R.Error(err);
|
|
253
|
+
}
|
|
233
254
|
}
|
|
234
255
|
});
|
|
235
256
|
|
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;
|
|
@@ -308,10 +314,11 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
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
316
|
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel> | undefined>;
|
|
311
|
-
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<
|
|
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
|
|
|
@@ -194,6 +197,24 @@ var createMechanizationServices = (client) => ({
|
|
|
194
197
|
console.error("getSeasonsProcess API Error:", err);
|
|
195
198
|
return R.Error(err);
|
|
196
199
|
}
|
|
200
|
+
},
|
|
201
|
+
UpdateTrackingDeviceCode: async ({
|
|
202
|
+
farmerId,
|
|
203
|
+
mechanizationId,
|
|
204
|
+
deviceCode,
|
|
205
|
+
verificationToken
|
|
206
|
+
}) => {
|
|
207
|
+
try {
|
|
208
|
+
const { data } = await client.put(
|
|
209
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
210
|
+
{ deviceCode, verificationToken }
|
|
211
|
+
);
|
|
212
|
+
return R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
213
|
+
} catch (error) {
|
|
214
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
215
|
+
console.error("UpdateTrackingDevice API Error:", err);
|
|
216
|
+
return R.Error(err);
|
|
217
|
+
}
|
|
197
218
|
}
|
|
198
219
|
});
|
|
199
220
|
|