@agroyaar/sdk 1.4.1 → 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 +46 -1
- package/dist/index.d.ts +22 -6
- package/dist/index.mjs +46 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,8 @@ var mappers = {
|
|
|
84
84
|
iconURL: response.iconURL,
|
|
85
85
|
kind: response.kind,
|
|
86
86
|
seasonProcessIds: response.seasonProcessIds,
|
|
87
|
-
machineUsageIds: response.machineUsageIds
|
|
87
|
+
machineUsageIds: response.machineUsageIds,
|
|
88
|
+
seasonsProcess: response.seasonsProcess
|
|
88
89
|
}),
|
|
89
90
|
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
|
|
90
91
|
getSpeedChangesChart: (response) => ({
|
|
@@ -104,6 +105,13 @@ var mappers = {
|
|
|
104
105
|
variety: mappers.getMechanizationVariety(response.variety)
|
|
105
106
|
}),
|
|
106
107
|
getMechanizationsList: (response) => response.map(mappers.getMechanization),
|
|
108
|
+
getSeasonsProcess: (response) => ({
|
|
109
|
+
id: response.id,
|
|
110
|
+
label: response.label,
|
|
111
|
+
mechanizationVarietyIds: response.mechanizationVarietyIds,
|
|
112
|
+
name: response.name
|
|
113
|
+
}),
|
|
114
|
+
getSeasonsProcessList: (response) => response.map(mappers.getSeasonsProcess),
|
|
107
115
|
getMotorizedMechanizationSensors: (response) => ({
|
|
108
116
|
id: response.id,
|
|
109
117
|
speed: response.speed,
|
|
@@ -121,6 +129,9 @@ var mappers = {
|
|
|
121
129
|
}),
|
|
122
130
|
SubmitTrackingDeviceData: (response) => ({
|
|
123
131
|
deviceCode: response.deviceCode
|
|
132
|
+
}),
|
|
133
|
+
UpdateTrackingDeviceData: (response) => ({
|
|
134
|
+
deviceCode: response.deviceCode
|
|
124
135
|
})
|
|
125
136
|
};
|
|
126
137
|
|
|
@@ -206,6 +217,40 @@ var createMechanizationServices = (client) => ({
|
|
|
206
217
|
console.error("SubmitTrackingDevice API Error:", err);
|
|
207
218
|
return import_ts_belt.R.Error(err);
|
|
208
219
|
}
|
|
220
|
+
},
|
|
221
|
+
getSeasonsProcess: async () => {
|
|
222
|
+
try {
|
|
223
|
+
const { data } = await client.get(
|
|
224
|
+
"/statics/mechanizations-seasons-process-kinds"
|
|
225
|
+
);
|
|
226
|
+
return import_ts_belt.R.Ok(
|
|
227
|
+
mappers.getSeasonsProcessList(
|
|
228
|
+
data.result.data.mechanizationSeasonProcessKinds
|
|
229
|
+
)
|
|
230
|
+
);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
233
|
+
console.error("getSeasonsProcess API Error:", err);
|
|
234
|
+
return import_ts_belt.R.Error(err);
|
|
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
|
+
}
|
|
209
254
|
}
|
|
210
255
|
});
|
|
211
256
|
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ type Brand<B> = {
|
|
|
9
9
|
type Branded<T, B> = Brand<B> & T;
|
|
10
10
|
|
|
11
11
|
declare namespace Identifiers {
|
|
12
|
-
type MechanizationVarietyId = Branded<string, "
|
|
13
|
-
type MechanizationId = Branded<string, "
|
|
12
|
+
type MechanizationVarietyId = Branded<string, "mechanizationVariety-id">;
|
|
13
|
+
type MechanizationId = Branded<string, "mechanization-id">;
|
|
14
|
+
type SeasonsProcessId = Branded<string, " seasonsProcess-id">;
|
|
14
15
|
type MotorizedMechanizationSensorsId = Branded<string, "motorized-mechanization-sensorsId-id">;
|
|
15
16
|
type FarmerId = Branded<string, "farmer-id">;
|
|
16
17
|
}
|
|
@@ -99,7 +100,7 @@ declare namespace ServerResponseTypes {
|
|
|
99
100
|
mechanizationId: string;
|
|
100
101
|
mechanization: MechanizationDTO;
|
|
101
102
|
};
|
|
102
|
-
type
|
|
103
|
+
type TrackingDeviceResultDTO = {
|
|
103
104
|
model: string;
|
|
104
105
|
commonName: string;
|
|
105
106
|
manufactureYear: number;
|
|
@@ -233,6 +234,7 @@ type MechanizationVarietyModel = {
|
|
|
233
234
|
kind: VarietyKind;
|
|
234
235
|
seasonProcessIds: string[];
|
|
235
236
|
machineUsageIds: string[];
|
|
237
|
+
seasonsProcess: MechanizationSeasonProcessKind[];
|
|
236
238
|
};
|
|
237
239
|
type MechanizationVarietyVariables = {
|
|
238
240
|
kindName: MechanizationType;
|
|
@@ -252,6 +254,12 @@ type MechanizationVariables = {
|
|
|
252
254
|
farmerId: string;
|
|
253
255
|
kindName: MechanizationType;
|
|
254
256
|
};
|
|
257
|
+
type SeasonsProcessModel = {
|
|
258
|
+
id: Identifiers.SeasonsProcessId;
|
|
259
|
+
name: string;
|
|
260
|
+
label: string;
|
|
261
|
+
mechanizationVarietyIds: string[];
|
|
262
|
+
};
|
|
255
263
|
type MotorizedMechanizationSensorsModel = {
|
|
256
264
|
id: string;
|
|
257
265
|
speed: number;
|
|
@@ -271,7 +279,7 @@ type MotorizedMechanizationSensorsVariables = {
|
|
|
271
279
|
farmerId: string;
|
|
272
280
|
mechanizationId: string;
|
|
273
281
|
};
|
|
274
|
-
type
|
|
282
|
+
type TrackingDeviceCodeModel = {
|
|
275
283
|
deviceCode: string;
|
|
276
284
|
};
|
|
277
285
|
type SubmitTrackingDeviceVariables = {
|
|
@@ -287,6 +295,12 @@ type SpeedChangesChartVariables = {
|
|
|
287
295
|
farmerId: Identifiers.FarmerId;
|
|
288
296
|
mechanizationId: Identifiers.MechanizationId;
|
|
289
297
|
};
|
|
298
|
+
type UpdateTrackingDeviceVariables = {
|
|
299
|
+
farmerId: Identifiers.FarmerId;
|
|
300
|
+
mechanizationId: Identifiers.MechanizationId;
|
|
301
|
+
deviceCode: string;
|
|
302
|
+
verificationToken: string;
|
|
303
|
+
};
|
|
290
304
|
|
|
291
305
|
type ClientConfig = {
|
|
292
306
|
readonly baseURL: string;
|
|
@@ -300,9 +314,11 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
300
314
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Ok<SpeedChangesChartModel[]> | undefined>;
|
|
301
315
|
getMechanizations: ({ kindName, farmerId }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
302
316
|
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel> | undefined>;
|
|
303
|
-
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>>;
|
|
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>>;
|
|
304
320
|
};
|
|
305
321
|
};
|
|
306
322
|
};
|
|
307
323
|
|
|
308
|
-
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 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
|
@@ -48,7 +48,8 @@ var mappers = {
|
|
|
48
48
|
iconURL: response.iconURL,
|
|
49
49
|
kind: response.kind,
|
|
50
50
|
seasonProcessIds: response.seasonProcessIds,
|
|
51
|
-
machineUsageIds: response.machineUsageIds
|
|
51
|
+
machineUsageIds: response.machineUsageIds,
|
|
52
|
+
seasonsProcess: response.seasonsProcess
|
|
52
53
|
}),
|
|
53
54
|
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
|
|
54
55
|
getSpeedChangesChart: (response) => ({
|
|
@@ -68,6 +69,13 @@ var mappers = {
|
|
|
68
69
|
variety: mappers.getMechanizationVariety(response.variety)
|
|
69
70
|
}),
|
|
70
71
|
getMechanizationsList: (response) => response.map(mappers.getMechanization),
|
|
72
|
+
getSeasonsProcess: (response) => ({
|
|
73
|
+
id: response.id,
|
|
74
|
+
label: response.label,
|
|
75
|
+
mechanizationVarietyIds: response.mechanizationVarietyIds,
|
|
76
|
+
name: response.name
|
|
77
|
+
}),
|
|
78
|
+
getSeasonsProcessList: (response) => response.map(mappers.getSeasonsProcess),
|
|
71
79
|
getMotorizedMechanizationSensors: (response) => ({
|
|
72
80
|
id: response.id,
|
|
73
81
|
speed: response.speed,
|
|
@@ -85,6 +93,9 @@ var mappers = {
|
|
|
85
93
|
}),
|
|
86
94
|
SubmitTrackingDeviceData: (response) => ({
|
|
87
95
|
deviceCode: response.deviceCode
|
|
96
|
+
}),
|
|
97
|
+
UpdateTrackingDeviceData: (response) => ({
|
|
98
|
+
deviceCode: response.deviceCode
|
|
88
99
|
})
|
|
89
100
|
};
|
|
90
101
|
|
|
@@ -170,6 +181,40 @@ var createMechanizationServices = (client) => ({
|
|
|
170
181
|
console.error("SubmitTrackingDevice API Error:", err);
|
|
171
182
|
return R.Error(err);
|
|
172
183
|
}
|
|
184
|
+
},
|
|
185
|
+
getSeasonsProcess: async () => {
|
|
186
|
+
try {
|
|
187
|
+
const { data } = await client.get(
|
|
188
|
+
"/statics/mechanizations-seasons-process-kinds"
|
|
189
|
+
);
|
|
190
|
+
return R.Ok(
|
|
191
|
+
mappers.getSeasonsProcessList(
|
|
192
|
+
data.result.data.mechanizationSeasonProcessKinds
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
197
|
+
console.error("getSeasonsProcess API Error:", err);
|
|
198
|
+
return R.Error(err);
|
|
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
|
+
}
|
|
173
218
|
}
|
|
174
219
|
});
|
|
175
220
|
|