@agroyaar/sdk 2.0.5-1 → 2.1.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 CHANGED
@@ -110,18 +110,18 @@ var mappers = {
110
110
  date: response.date
111
111
  }),
112
112
  getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
113
- getMechanization: (res) => ({
114
- id: res.id,
115
- commonName: res.commonName,
116
- model: res.model,
117
- avatarURL: res.avatarURL,
118
- manufactureYear: res.manufactureYear,
119
- code: res.code,
120
- kind: res.kind,
121
- kindName: res.kindName,
122
- variety: mappers.getMechanizationVariety(res.variety)
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
- getMechanizations: (response) => response.map(mappers.getMechanization),
124
+ getMechanizationsList: (response) => response.map(mappers.getMechanization),
125
125
  getSeasonsProcess: (response) => ({
126
126
  id: response.id,
127
127
  label: response.label,
@@ -217,22 +217,20 @@ var createMechanizationServices = (client) => ({
217
217
  return wrapError(error);
218
218
  }
219
219
  },
220
- getMechanizations: async ({ farmerId, kindName }) => {
220
+ getMechanizations: async (variables) => {
221
221
  try {
222
222
  const response = await client.typed(
223
223
  "get",
224
224
  "/farmers/{farmerId}/mechanizations",
225
225
  {
226
226
  params: {
227
- kindName
228
- },
229
- pathParams: {
230
- farmerId
227
+ kindName: variables.kindName
231
228
  }
232
229
  }
233
230
  );
234
- const mechanizations = response.result.data.mechanizations;
235
- return import_ts_belt2.R.Ok(mappers.getMechanizations(mechanizations));
231
+ return import_ts_belt2.R.Ok(
232
+ mappers.getMechanizationsList(response.result.data.mechanizations)
233
+ );
236
234
  } catch (error) {
237
235
  return wrapError(error);
238
236
  }
@@ -252,9 +250,10 @@ var createMechanizationServices = (client) => ({
252
250
  }
253
251
  }
254
252
  );
255
- const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
256
253
  return import_ts_belt2.R.Ok(
257
- mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
254
+ mappers.getMotorizedMechanizationSensors(
255
+ response.result.data.motorizedMechanizationSensors
256
+ )
258
257
  );
259
258
  } catch (error) {
260
259
  return wrapError(error);
@@ -318,15 +317,14 @@ var createMechanizationServices = (client) => ({
318
317
  }
319
318
  }
320
319
  );
321
- const maybeQuestions = data?.result?.data.mechanizationsQuestions;
322
- return maybeQuestions ? import_ts_belt2.R.Ok(mappers.getQuestions(maybeQuestions)) : import_ts_belt2.R.Error("missing questions in response");
320
+ const questions = data?.result?.data.mechanizationsQuestions;
321
+ console.log("in SDK - qustions", questions);
322
+ return import_ts_belt2.R.Ok(mappers.getQuestions(questions));
323
323
  } catch (error) {
324
324
  return wrapError(error);
325
325
  }
326
326
  },
327
327
  getMechanizationMovementChanges: async ({
328
- farmerId,
329
- mechanizationId,
330
328
  fromDate,
331
329
  toDate
332
330
  }) => {
@@ -338,15 +336,14 @@ var createMechanizationServices = (client) => ({
338
336
  params: {
339
337
  fromDate,
340
338
  toDate
341
- },
342
- pathParams: {
343
- farmerId,
344
- mechanizationId
345
339
  }
346
340
  }
347
341
  );
348
- const movementChanges = response.result.data.movementChanges;
349
- return import_ts_belt2.R.Ok(mappers.getMechanizationMovementChanges(movementChanges));
342
+ return import_ts_belt2.R.Ok(
343
+ mappers.getMechanizationMovementChanges(
344
+ response.result.data.movementChanges
345
+ )
346
+ );
350
347
  } catch (error) {
351
348
  return wrapError(error);
352
349
  }
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: ({ farmerId, kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
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[]> | _mobily_ts_belt.Error<"missing questions in response">>;
2974
- getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
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: (res) => ({
78
- id: res.id,
79
- commonName: res.commonName,
80
- model: res.model,
81
- avatarURL: res.avatarURL,
82
- manufactureYear: res.manufactureYear,
83
- code: res.code,
84
- kind: res.kind,
85
- kindName: res.kindName,
86
- variety: mappers.getMechanizationVariety(res.variety)
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
- getMechanizations: (response) => response.map(mappers.getMechanization),
88
+ getMechanizationsList: (response) => response.map(mappers.getMechanization),
89
89
  getSeasonsProcess: (response) => ({
90
90
  id: response.id,
91
91
  label: response.label,
@@ -181,22 +181,20 @@ var createMechanizationServices = (client) => ({
181
181
  return wrapError(error);
182
182
  }
183
183
  },
184
- getMechanizations: async ({ farmerId, kindName }) => {
184
+ getMechanizations: async (variables) => {
185
185
  try {
186
186
  const response = await client.typed(
187
187
  "get",
188
188
  "/farmers/{farmerId}/mechanizations",
189
189
  {
190
190
  params: {
191
- kindName
192
- },
193
- pathParams: {
194
- farmerId
191
+ kindName: variables.kindName
195
192
  }
196
193
  }
197
194
  );
198
- const mechanizations = response.result.data.mechanizations;
199
- return R2.Ok(mappers.getMechanizations(mechanizations));
195
+ return R2.Ok(
196
+ mappers.getMechanizationsList(response.result.data.mechanizations)
197
+ );
200
198
  } catch (error) {
201
199
  return wrapError(error);
202
200
  }
@@ -216,9 +214,10 @@ var createMechanizationServices = (client) => ({
216
214
  }
217
215
  }
218
216
  );
219
- const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
220
217
  return R2.Ok(
221
- mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
218
+ mappers.getMotorizedMechanizationSensors(
219
+ response.result.data.motorizedMechanizationSensors
220
+ )
222
221
  );
223
222
  } catch (error) {
224
223
  return wrapError(error);
@@ -282,15 +281,14 @@ var createMechanizationServices = (client) => ({
282
281
  }
283
282
  }
284
283
  );
285
- const maybeQuestions = data?.result?.data.mechanizationsQuestions;
286
- return maybeQuestions ? R2.Ok(mappers.getQuestions(maybeQuestions)) : R2.Error("missing questions in response");
284
+ const questions = data?.result?.data.mechanizationsQuestions;
285
+ console.log("in SDK - qustions", questions);
286
+ return R2.Ok(mappers.getQuestions(questions));
287
287
  } catch (error) {
288
288
  return wrapError(error);
289
289
  }
290
290
  },
291
291
  getMechanizationMovementChanges: async ({
292
- farmerId,
293
- mechanizationId,
294
292
  fromDate,
295
293
  toDate
296
294
  }) => {
@@ -302,15 +300,14 @@ var createMechanizationServices = (client) => ({
302
300
  params: {
303
301
  fromDate,
304
302
  toDate
305
- },
306
- pathParams: {
307
- farmerId,
308
- mechanizationId
309
303
  }
310
304
  }
311
305
  );
312
- const movementChanges = response.result.data.movementChanges;
313
- return R2.Ok(mappers.getMechanizationMovementChanges(movementChanges));
306
+ return R2.Ok(
307
+ mappers.getMechanizationMovementChanges(
308
+ response.result.data.movementChanges
309
+ )
310
+ );
314
311
  } catch (error) {
315
312
  return wrapError(error);
316
313
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "2.0.5-1",
3
+ "version": "2.1.1",
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",