@agroyaar/sdk 2.0.5-1 → 2.1.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 +31 -31
- package/dist/index.d.ts +3 -5
- package/dist/index.mjs +31 -31
- package/package.json +1 -18
package/dist/index.cjs
CHANGED
|
@@ -110,18 +110,18 @@ var mappers = {
|
|
|
110
110
|
date: response.date
|
|
111
111
|
}),
|
|
112
112
|
getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
|
|
113
|
-
getMechanization: (
|
|
114
|
-
id:
|
|
115
|
-
commonName:
|
|
116
|
-
model:
|
|
117
|
-
avatarURL:
|
|
118
|
-
manufactureYear:
|
|
119
|
-
code:
|
|
120
|
-
kind:
|
|
121
|
-
kindName:
|
|
122
|
-
variety: mappers.getMechanizationVariety(
|
|
113
|
+
getMechanization: (dto) => ({
|
|
114
|
+
id: dto.id,
|
|
115
|
+
commonName: dto.commonName,
|
|
116
|
+
model: dto.model,
|
|
117
|
+
avatarURL: dto.avatarURL,
|
|
118
|
+
manufactureYear: dto.manufactureYear,
|
|
119
|
+
code: dto.code,
|
|
120
|
+
kind: dto.kind,
|
|
121
|
+
kindName: dto.kindName,
|
|
122
|
+
variety: mappers.getMechanizationVariety(dto.variety)
|
|
123
123
|
}),
|
|
124
|
-
|
|
124
|
+
getMechanizationsList: (response) => response.map(mappers.getMechanization),
|
|
125
125
|
getSeasonsProcess: (response) => ({
|
|
126
126
|
id: response.id,
|
|
127
127
|
label: response.label,
|
|
@@ -157,7 +157,10 @@ var mappers = {
|
|
|
157
157
|
placeholder: dto.placeholder,
|
|
158
158
|
isRequired: dto.required,
|
|
159
159
|
type: dto.kindName,
|
|
160
|
-
options: dto.options
|
|
160
|
+
options: dto.options?.map((item) => ({
|
|
161
|
+
label: item.label,
|
|
162
|
+
value: item.id
|
|
163
|
+
})) ?? []
|
|
161
164
|
}),
|
|
162
165
|
getQuestions: (dto) => dto.map(mappers.getQuestion),
|
|
163
166
|
getMechanizationMovementChange: ({
|
|
@@ -217,22 +220,20 @@ var createMechanizationServices = (client) => ({
|
|
|
217
220
|
return wrapError(error);
|
|
218
221
|
}
|
|
219
222
|
},
|
|
220
|
-
getMechanizations: async (
|
|
223
|
+
getMechanizations: async (variables) => {
|
|
221
224
|
try {
|
|
222
225
|
const response = await client.typed(
|
|
223
226
|
"get",
|
|
224
227
|
"/farmers/{farmerId}/mechanizations",
|
|
225
228
|
{
|
|
226
229
|
params: {
|
|
227
|
-
kindName
|
|
228
|
-
},
|
|
229
|
-
pathParams: {
|
|
230
|
-
farmerId
|
|
230
|
+
kindName: variables.kindName
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
);
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
return import_ts_belt2.R.Ok(
|
|
235
|
+
mappers.getMechanizationsList(response.result.data.mechanizations)
|
|
236
|
+
);
|
|
236
237
|
} catch (error) {
|
|
237
238
|
return wrapError(error);
|
|
238
239
|
}
|
|
@@ -252,9 +253,10 @@ var createMechanizationServices = (client) => ({
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
);
|
|
255
|
-
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
256
256
|
return import_ts_belt2.R.Ok(
|
|
257
|
-
mappers.getMotorizedMechanizationSensors(
|
|
257
|
+
mappers.getMotorizedMechanizationSensors(
|
|
258
|
+
response.result.data.motorizedMechanizationSensors
|
|
259
|
+
)
|
|
258
260
|
);
|
|
259
261
|
} catch (error) {
|
|
260
262
|
return wrapError(error);
|
|
@@ -318,15 +320,14 @@ var createMechanizationServices = (client) => ({
|
|
|
318
320
|
}
|
|
319
321
|
}
|
|
320
322
|
);
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
+
const questions = data?.result?.data.mechanizationsQuestions;
|
|
324
|
+
console.log("in SDK - qustions", questions);
|
|
325
|
+
return import_ts_belt2.R.Ok(mappers.getQuestions(questions));
|
|
323
326
|
} catch (error) {
|
|
324
327
|
return wrapError(error);
|
|
325
328
|
}
|
|
326
329
|
},
|
|
327
330
|
getMechanizationMovementChanges: async ({
|
|
328
|
-
farmerId,
|
|
329
|
-
mechanizationId,
|
|
330
331
|
fromDate,
|
|
331
332
|
toDate
|
|
332
333
|
}) => {
|
|
@@ -338,15 +339,14 @@ var createMechanizationServices = (client) => ({
|
|
|
338
339
|
params: {
|
|
339
340
|
fromDate,
|
|
340
341
|
toDate
|
|
341
|
-
},
|
|
342
|
-
pathParams: {
|
|
343
|
-
farmerId,
|
|
344
|
-
mechanizationId
|
|
345
342
|
}
|
|
346
343
|
}
|
|
347
344
|
);
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
return import_ts_belt2.R.Ok(
|
|
346
|
+
mappers.getMechanizationMovementChanges(
|
|
347
|
+
response.result.data.movementChanges
|
|
348
|
+
)
|
|
349
|
+
);
|
|
350
350
|
} catch (error) {
|
|
351
351
|
return wrapError(error);
|
|
352
352
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -141,8 +141,6 @@ type MechanizationMovementChangesModel = {
|
|
|
141
141
|
date: string;
|
|
142
142
|
};
|
|
143
143
|
type MechanizationMovementChangesVariable = {
|
|
144
|
-
farmerId: string;
|
|
145
|
-
mechanizationId: string;
|
|
146
144
|
fromDate?: string | null | undefined;
|
|
147
145
|
toDate?: string | null | undefined;
|
|
148
146
|
};
|
|
@@ -2965,13 +2963,13 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
2965
2963
|
mechanization: {
|
|
2966
2964
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationVarietyModel[]>>;
|
|
2967
2965
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
|
|
2968
|
-
getMechanizations: (
|
|
2966
|
+
getMechanizations: (variables: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
2969
2967
|
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
|
|
2970
2968
|
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2971
2969
|
getSeasonsProcess: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SeasonsProcessModel[]>>;
|
|
2972
2970
|
UpdateTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, verificationToken, }: UpdateTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2973
|
-
getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]
|
|
2974
|
-
getMechanizationMovementChanges: ({
|
|
2971
|
+
getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
|
|
2972
|
+
getMechanizationMovementChanges: ({ fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
|
|
2975
2973
|
DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2976
2974
|
};
|
|
2977
2975
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -74,18 +74,18 @@ var mappers = {
|
|
|
74
74
|
date: response.date
|
|
75
75
|
}),
|
|
76
76
|
getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
|
|
77
|
-
getMechanization: (
|
|
78
|
-
id:
|
|
79
|
-
commonName:
|
|
80
|
-
model:
|
|
81
|
-
avatarURL:
|
|
82
|
-
manufactureYear:
|
|
83
|
-
code:
|
|
84
|
-
kind:
|
|
85
|
-
kindName:
|
|
86
|
-
variety: mappers.getMechanizationVariety(
|
|
77
|
+
getMechanization: (dto) => ({
|
|
78
|
+
id: dto.id,
|
|
79
|
+
commonName: dto.commonName,
|
|
80
|
+
model: dto.model,
|
|
81
|
+
avatarURL: dto.avatarURL,
|
|
82
|
+
manufactureYear: dto.manufactureYear,
|
|
83
|
+
code: dto.code,
|
|
84
|
+
kind: dto.kind,
|
|
85
|
+
kindName: dto.kindName,
|
|
86
|
+
variety: mappers.getMechanizationVariety(dto.variety)
|
|
87
87
|
}),
|
|
88
|
-
|
|
88
|
+
getMechanizationsList: (response) => response.map(mappers.getMechanization),
|
|
89
89
|
getSeasonsProcess: (response) => ({
|
|
90
90
|
id: response.id,
|
|
91
91
|
label: response.label,
|
|
@@ -121,7 +121,10 @@ var mappers = {
|
|
|
121
121
|
placeholder: dto.placeholder,
|
|
122
122
|
isRequired: dto.required,
|
|
123
123
|
type: dto.kindName,
|
|
124
|
-
options: dto.options
|
|
124
|
+
options: dto.options?.map((item) => ({
|
|
125
|
+
label: item.label,
|
|
126
|
+
value: item.id
|
|
127
|
+
})) ?? []
|
|
125
128
|
}),
|
|
126
129
|
getQuestions: (dto) => dto.map(mappers.getQuestion),
|
|
127
130
|
getMechanizationMovementChange: ({
|
|
@@ -181,22 +184,20 @@ var createMechanizationServices = (client) => ({
|
|
|
181
184
|
return wrapError(error);
|
|
182
185
|
}
|
|
183
186
|
},
|
|
184
|
-
getMechanizations: async (
|
|
187
|
+
getMechanizations: async (variables) => {
|
|
185
188
|
try {
|
|
186
189
|
const response = await client.typed(
|
|
187
190
|
"get",
|
|
188
191
|
"/farmers/{farmerId}/mechanizations",
|
|
189
192
|
{
|
|
190
193
|
params: {
|
|
191
|
-
kindName
|
|
192
|
-
},
|
|
193
|
-
pathParams: {
|
|
194
|
-
farmerId
|
|
194
|
+
kindName: variables.kindName
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
return R2.Ok(
|
|
199
|
+
mappers.getMechanizationsList(response.result.data.mechanizations)
|
|
200
|
+
);
|
|
200
201
|
} catch (error) {
|
|
201
202
|
return wrapError(error);
|
|
202
203
|
}
|
|
@@ -216,9 +217,10 @@ var createMechanizationServices = (client) => ({
|
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
);
|
|
219
|
-
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
220
220
|
return R2.Ok(
|
|
221
|
-
mappers.getMotorizedMechanizationSensors(
|
|
221
|
+
mappers.getMotorizedMechanizationSensors(
|
|
222
|
+
response.result.data.motorizedMechanizationSensors
|
|
223
|
+
)
|
|
222
224
|
);
|
|
223
225
|
} catch (error) {
|
|
224
226
|
return wrapError(error);
|
|
@@ -282,15 +284,14 @@ var createMechanizationServices = (client) => ({
|
|
|
282
284
|
}
|
|
283
285
|
}
|
|
284
286
|
);
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
+
const questions = data?.result?.data.mechanizationsQuestions;
|
|
288
|
+
console.log("in SDK - qustions", questions);
|
|
289
|
+
return R2.Ok(mappers.getQuestions(questions));
|
|
287
290
|
} catch (error) {
|
|
288
291
|
return wrapError(error);
|
|
289
292
|
}
|
|
290
293
|
},
|
|
291
294
|
getMechanizationMovementChanges: async ({
|
|
292
|
-
farmerId,
|
|
293
|
-
mechanizationId,
|
|
294
295
|
fromDate,
|
|
295
296
|
toDate
|
|
296
297
|
}) => {
|
|
@@ -302,15 +303,14 @@ var createMechanizationServices = (client) => ({
|
|
|
302
303
|
params: {
|
|
303
304
|
fromDate,
|
|
304
305
|
toDate
|
|
305
|
-
},
|
|
306
|
-
pathParams: {
|
|
307
|
-
farmerId,
|
|
308
|
-
mechanizationId
|
|
309
306
|
}
|
|
310
307
|
}
|
|
311
308
|
);
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
return R2.Ok(
|
|
310
|
+
mappers.getMechanizationMovementChanges(
|
|
311
|
+
response.result.data.movementChanges
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
314
|
} catch (error) {
|
|
315
315
|
return wrapError(error);
|
|
316
316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agroyaar/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,23 +29,6 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"release-it": {
|
|
33
|
-
"git": {
|
|
34
|
-
"requireCleanWorkingDir": false,
|
|
35
|
-
"tagName": "v${version}"
|
|
36
|
-
},
|
|
37
|
-
"npm": {
|
|
38
|
-
"publish": true
|
|
39
|
-
},
|
|
40
|
-
"hooks": {
|
|
41
|
-
"before:init": [
|
|
42
|
-
"pnpm build"
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
"github": {
|
|
46
|
-
"release": false
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
32
|
"keywords": [],
|
|
50
33
|
"author": "",
|
|
51
34
|
"license": "MIT",
|