@agroyaar/sdk 2.0.5-0 → 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 mechanizations ? import_ts_belt2.R.Ok(mappers.getMechanizations(mechanizations)) : import_ts_belt2.R.Error("missing questions in response");
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,12 +250,11 @@ var createMechanizationServices = (client) => ({
252
250
  }
253
251
  }
254
252
  );
255
- const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
256
- return motorizedMechanizationSensors ? import_ts_belt2.R.Ok(
253
+ return import_ts_belt2.R.Ok(
257
254
  mappers.getMotorizedMechanizationSensors(
258
- motorizedMechanizationSensors
255
+ response.result.data.motorizedMechanizationSensors
259
256
  )
260
- ) : import_ts_belt2.R.Error("missing questions in response");
257
+ );
261
258
  } catch (error) {
262
259
  return wrapError(error);
263
260
  }
@@ -320,15 +317,14 @@ var createMechanizationServices = (client) => ({
320
317
  }
321
318
  }
322
319
  );
323
- const maybeQuestions = data?.result?.data.mechanizationsQuestions;
324
- 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));
325
323
  } catch (error) {
326
324
  return wrapError(error);
327
325
  }
328
326
  },
329
327
  getMechanizationMovementChanges: async ({
330
- farmerId,
331
- mechanizationId,
332
328
  fromDate,
333
329
  toDate
334
330
  }) => {
@@ -340,15 +336,14 @@ var createMechanizationServices = (client) => ({
340
336
  params: {
341
337
  fromDate,
342
338
  toDate
343
- },
344
- pathParams: {
345
- farmerId,
346
- mechanizationId
347
339
  }
348
340
  }
349
341
  );
350
- const movementChanges = response.result.data.movementChanges;
351
- return movementChanges ? import_ts_belt2.R.Ok(mappers.getMechanizationMovementChanges(movementChanges)) : import_ts_belt2.R.Error("missing questions in response");
342
+ return import_ts_belt2.R.Ok(
343
+ mappers.getMechanizationMovementChanges(
344
+ response.result.data.movementChanges
345
+ )
346
+ );
352
347
  } catch (error) {
353
348
  return wrapError(error);
354
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[]> | _mobily_ts_belt.Error<"missing questions in response">>;
2969
- getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Error<"missing questions in response"> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
2966
+ getMechanizations: (variables: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
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.Error<"missing questions in response"> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
2974
- getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Error<"missing questions in response"> | _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 mechanizations ? R2.Ok(mappers.getMechanizations(mechanizations)) : R2.Error("missing questions in response");
195
+ return R2.Ok(
196
+ mappers.getMechanizationsList(response.result.data.mechanizations)
197
+ );
200
198
  } catch (error) {
201
199
  return wrapError(error);
202
200
  }
@@ -216,12 +214,11 @@ var createMechanizationServices = (client) => ({
216
214
  }
217
215
  }
218
216
  );
219
- const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
220
- return motorizedMechanizationSensors ? R2.Ok(
217
+ return R2.Ok(
221
218
  mappers.getMotorizedMechanizationSensors(
222
- motorizedMechanizationSensors
219
+ response.result.data.motorizedMechanizationSensors
223
220
  )
224
- ) : R2.Error("missing questions in response");
221
+ );
225
222
  } catch (error) {
226
223
  return wrapError(error);
227
224
  }
@@ -284,15 +281,14 @@ var createMechanizationServices = (client) => ({
284
281
  }
285
282
  }
286
283
  );
287
- const maybeQuestions = data?.result?.data.mechanizationsQuestions;
288
- 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));
289
287
  } catch (error) {
290
288
  return wrapError(error);
291
289
  }
292
290
  },
293
291
  getMechanizationMovementChanges: async ({
294
- farmerId,
295
- mechanizationId,
296
292
  fromDate,
297
293
  toDate
298
294
  }) => {
@@ -304,15 +300,14 @@ var createMechanizationServices = (client) => ({
304
300
  params: {
305
301
  fromDate,
306
302
  toDate
307
- },
308
- pathParams: {
309
- farmerId,
310
- mechanizationId
311
303
  }
312
304
  }
313
305
  );
314
- const movementChanges = response.result.data.movementChanges;
315
- return movementChanges ? R2.Ok(mappers.getMechanizationMovementChanges(movementChanges)) : R2.Error("missing questions in response");
306
+ return R2.Ok(
307
+ mappers.getMechanizationMovementChanges(
308
+ response.result.data.movementChanges
309
+ )
310
+ );
316
311
  } catch (error) {
317
312
  return wrapError(error);
318
313
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "2.0.5-0",
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",