@agroyaar/sdk 1.5.1 → 1.5.3-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 +24 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.mjs +24 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -132,6 +132,9 @@ var mappers = {
|
|
|
132
132
|
}),
|
|
133
133
|
UpdateTrackingDeviceData: (response) => ({
|
|
134
134
|
deviceCode: response.deviceCode
|
|
135
|
+
}),
|
|
136
|
+
DeleteTrackingDeviceData: (response) => ({
|
|
137
|
+
deviceCode: response.deviceCode
|
|
135
138
|
})
|
|
136
139
|
};
|
|
137
140
|
|
|
@@ -198,7 +201,8 @@ var createMechanizationServices = (client) => ({
|
|
|
198
201
|
);
|
|
199
202
|
} catch (error) {
|
|
200
203
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
201
|
-
console.error("Mechanization API Error:", err);
|
|
204
|
+
console.error("Motorized Mechanization Sensors API Error:", err);
|
|
205
|
+
return import_ts_belt.R.Error(err);
|
|
202
206
|
}
|
|
203
207
|
},
|
|
204
208
|
SubmitTrackingDeviceCode: async ({
|
|
@@ -251,6 +255,25 @@ var createMechanizationServices = (client) => ({
|
|
|
251
255
|
console.error("UpdateTrackingDevice API Error:", err);
|
|
252
256
|
return import_ts_belt.R.Error(err);
|
|
253
257
|
}
|
|
258
|
+
},
|
|
259
|
+
DeleteTrackingDeviceCode: async ({
|
|
260
|
+
farmerId,
|
|
261
|
+
mechanizationId,
|
|
262
|
+
verificationToken
|
|
263
|
+
}) => {
|
|
264
|
+
try {
|
|
265
|
+
const { data } = await client.delete(
|
|
266
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
|
|
267
|
+
{
|
|
268
|
+
data: verificationToken
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
return import_ts_belt.R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
272
|
+
} catch (error) {
|
|
273
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
274
|
+
console.error("UpdateTrackingDevice API Error:", err);
|
|
275
|
+
return import_ts_belt.R.Error(err);
|
|
276
|
+
}
|
|
254
277
|
}
|
|
255
278
|
});
|
|
256
279
|
|
package/dist/index.d.ts
CHANGED
|
@@ -301,6 +301,11 @@ type UpdateTrackingDeviceVariables = {
|
|
|
301
301
|
deviceCode: string;
|
|
302
302
|
verificationToken: string;
|
|
303
303
|
};
|
|
304
|
+
type DeleteTrackingDeviceVariables = {
|
|
305
|
+
farmerId: Identifiers.FarmerId;
|
|
306
|
+
mechanizationId: Identifiers.MechanizationId;
|
|
307
|
+
verificationToken: string;
|
|
308
|
+
};
|
|
304
309
|
|
|
305
310
|
type ClientConfig = {
|
|
306
311
|
readonly baseURL: string;
|
|
@@ -313,12 +318,13 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
313
318
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
|
|
314
319
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Ok<SpeedChangesChartModel[]> | undefined>;
|
|
315
320
|
getMechanizations: ({ kindName, farmerId }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
316
|
-
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.
|
|
321
|
+
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
|
|
317
322
|
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
318
323
|
getSeasonsProcess: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SeasonsProcessModel[]>>;
|
|
319
324
|
UpdateTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, verificationToken, }: UpdateTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
325
|
+
DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
320
326
|
};
|
|
321
327
|
};
|
|
322
328
|
};
|
|
323
329
|
|
|
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 };
|
|
330
|
+
export { type BaseResponse, type DeleteTrackingDeviceVariables, 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
|
@@ -96,6 +96,9 @@ var mappers = {
|
|
|
96
96
|
}),
|
|
97
97
|
UpdateTrackingDeviceData: (response) => ({
|
|
98
98
|
deviceCode: response.deviceCode
|
|
99
|
+
}),
|
|
100
|
+
DeleteTrackingDeviceData: (response) => ({
|
|
101
|
+
deviceCode: response.deviceCode
|
|
99
102
|
})
|
|
100
103
|
};
|
|
101
104
|
|
|
@@ -162,7 +165,8 @@ var createMechanizationServices = (client) => ({
|
|
|
162
165
|
);
|
|
163
166
|
} catch (error) {
|
|
164
167
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
165
|
-
console.error("Mechanization API Error:", err);
|
|
168
|
+
console.error("Motorized Mechanization Sensors API Error:", err);
|
|
169
|
+
return R.Error(err);
|
|
166
170
|
}
|
|
167
171
|
},
|
|
168
172
|
SubmitTrackingDeviceCode: async ({
|
|
@@ -215,6 +219,25 @@ var createMechanizationServices = (client) => ({
|
|
|
215
219
|
console.error("UpdateTrackingDevice API Error:", err);
|
|
216
220
|
return R.Error(err);
|
|
217
221
|
}
|
|
222
|
+
},
|
|
223
|
+
DeleteTrackingDeviceCode: async ({
|
|
224
|
+
farmerId,
|
|
225
|
+
mechanizationId,
|
|
226
|
+
verificationToken
|
|
227
|
+
}) => {
|
|
228
|
+
try {
|
|
229
|
+
const { data } = await client.delete(
|
|
230
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
|
|
231
|
+
{
|
|
232
|
+
data: verificationToken
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
return R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
236
|
+
} catch (error) {
|
|
237
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
238
|
+
console.error("UpdateTrackingDevice API Error:", err);
|
|
239
|
+
return R.Error(err);
|
|
240
|
+
}
|
|
218
241
|
}
|
|
219
242
|
});
|
|
220
243
|
|