@agroyaar/sdk 2.2.0 → 2.2.1-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 +38 -14
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +38 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -91,7 +91,7 @@ var createClient = (config, middlewares = []) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
94
|
-
var
|
|
94
|
+
var import_ts_belt3 = require("@mobily/ts-belt");
|
|
95
95
|
|
|
96
96
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
97
97
|
var mappers = {
|
|
@@ -177,7 +177,11 @@ var mappers = {
|
|
|
177
177
|
date,
|
|
178
178
|
heading
|
|
179
179
|
}),
|
|
180
|
-
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
180
|
+
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
181
|
+
verifyPhoneNumber: (dto) => ({
|
|
182
|
+
phoneNumber: dto.phoneNumber,
|
|
183
|
+
verificationToken: dto.verificationToken
|
|
184
|
+
})
|
|
181
185
|
};
|
|
182
186
|
|
|
183
187
|
// src/utils/wrapError.ts
|
|
@@ -187,6 +191,25 @@ var wrapError = (error) => {
|
|
|
187
191
|
return import_ts_belt.R.Error(err);
|
|
188
192
|
};
|
|
189
193
|
|
|
194
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/v.service.ts
|
|
195
|
+
var import_ts_belt2 = require("@mobily/ts-belt");
|
|
196
|
+
var vfn = (client) => ({
|
|
197
|
+
verifyPhoneNumber: async ({
|
|
198
|
+
phoneNumber,
|
|
199
|
+
otpCode
|
|
200
|
+
}) => {
|
|
201
|
+
try {
|
|
202
|
+
const { data } = await client.post(`/auth/verify-phone-number`, {
|
|
203
|
+
phoneNumber,
|
|
204
|
+
otpCode
|
|
205
|
+
});
|
|
206
|
+
return import_ts_belt2.R.Ok(mappers.verifyPhoneNumber(data));
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return wrapError(error);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
190
213
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
191
214
|
var createMechanizationServices = (client) => ({
|
|
192
215
|
getMechanizationVarieties: async ({
|
|
@@ -196,7 +219,7 @@ var createMechanizationServices = (client) => ({
|
|
|
196
219
|
const { data } = await client.get(
|
|
197
220
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
198
221
|
);
|
|
199
|
-
return
|
|
222
|
+
return import_ts_belt3.R.Ok(
|
|
200
223
|
mappers.getMechanizationVarietyList(
|
|
201
224
|
data.result.data.mechanizationVarieties
|
|
202
225
|
)
|
|
@@ -213,7 +236,7 @@ var createMechanizationServices = (client) => ({
|
|
|
213
236
|
const { data } = await client.get(
|
|
214
237
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
215
238
|
);
|
|
216
|
-
return
|
|
239
|
+
return import_ts_belt3.R.Ok(
|
|
217
240
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
218
241
|
);
|
|
219
242
|
} catch (error) {
|
|
@@ -233,7 +256,7 @@ var createMechanizationServices = (client) => ({
|
|
|
233
256
|
}
|
|
234
257
|
);
|
|
235
258
|
const mechanization = response.result.data.mechanization;
|
|
236
|
-
return
|
|
259
|
+
return import_ts_belt3.R.Ok(mappers.getMechanization(mechanization));
|
|
237
260
|
} catch (error) {
|
|
238
261
|
return wrapError(error);
|
|
239
262
|
}
|
|
@@ -256,7 +279,7 @@ var createMechanizationServices = (client) => ({
|
|
|
256
279
|
}
|
|
257
280
|
);
|
|
258
281
|
const mechanizations = response.result.data.mechanizations;
|
|
259
|
-
return
|
|
282
|
+
return import_ts_belt3.R.Ok(mappers.getMechanizations(mechanizations));
|
|
260
283
|
} catch (error) {
|
|
261
284
|
return wrapError(error);
|
|
262
285
|
}
|
|
@@ -277,7 +300,7 @@ var createMechanizationServices = (client) => ({
|
|
|
277
300
|
}
|
|
278
301
|
);
|
|
279
302
|
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
280
|
-
return
|
|
303
|
+
return import_ts_belt3.R.Ok(
|
|
281
304
|
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
282
305
|
);
|
|
283
306
|
} catch (error) {
|
|
@@ -294,7 +317,7 @@ var createMechanizationServices = (client) => ({
|
|
|
294
317
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
295
318
|
{ deviceCode }
|
|
296
319
|
);
|
|
297
|
-
return
|
|
320
|
+
return import_ts_belt3.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
298
321
|
} catch (error) {
|
|
299
322
|
return wrapError(error);
|
|
300
323
|
}
|
|
@@ -304,7 +327,7 @@ var createMechanizationServices = (client) => ({
|
|
|
304
327
|
const { data } = await client.get(
|
|
305
328
|
"/statics/mechanizations-seasons-process-kinds"
|
|
306
329
|
);
|
|
307
|
-
return
|
|
330
|
+
return import_ts_belt3.R.Ok(
|
|
308
331
|
mappers.getSeasonsProcessList(
|
|
309
332
|
data.result.data.mechanizationSeasonProcessKinds
|
|
310
333
|
)
|
|
@@ -324,7 +347,7 @@ var createMechanizationServices = (client) => ({
|
|
|
324
347
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
325
348
|
{ deviceCode, verificationToken }
|
|
326
349
|
);
|
|
327
|
-
return
|
|
350
|
+
return import_ts_belt3.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
328
351
|
} catch (error) {
|
|
329
352
|
return wrapError(error);
|
|
330
353
|
}
|
|
@@ -343,7 +366,7 @@ var createMechanizationServices = (client) => ({
|
|
|
343
366
|
}
|
|
344
367
|
);
|
|
345
368
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
346
|
-
return
|
|
369
|
+
return import_ts_belt3.R.Ok(mappers.getQuestions(questions));
|
|
347
370
|
} catch (error) {
|
|
348
371
|
return wrapError(error);
|
|
349
372
|
}
|
|
@@ -370,7 +393,7 @@ var createMechanizationServices = (client) => ({
|
|
|
370
393
|
}
|
|
371
394
|
);
|
|
372
395
|
const movementChanges = response.result.data.movementChanges;
|
|
373
|
-
return
|
|
396
|
+
return import_ts_belt3.R.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
374
397
|
} catch (error) {
|
|
375
398
|
return wrapError(error);
|
|
376
399
|
}
|
|
@@ -387,11 +410,12 @@ var createMechanizationServices = (client) => ({
|
|
|
387
410
|
data: { verificationToken }
|
|
388
411
|
}
|
|
389
412
|
);
|
|
390
|
-
return
|
|
413
|
+
return import_ts_belt3.R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
391
414
|
} catch (error) {
|
|
392
415
|
return wrapError(error);
|
|
393
416
|
}
|
|
394
|
-
}
|
|
417
|
+
},
|
|
418
|
+
...vfn(client)
|
|
395
419
|
});
|
|
396
420
|
|
|
397
421
|
// src/index.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -155,6 +155,14 @@ type MechanizationMovementChangesVariable = {
|
|
|
155
155
|
fromDate?: string | null | undefined;
|
|
156
156
|
toDate?: string | null | undefined;
|
|
157
157
|
};
|
|
158
|
+
type VerifyPhoneNumberModel = {
|
|
159
|
+
phoneNumber: string;
|
|
160
|
+
verificationToken: string;
|
|
161
|
+
};
|
|
162
|
+
type VerifyPhoneNumberVariables = {
|
|
163
|
+
phoneNumber: string;
|
|
164
|
+
otpCode: string;
|
|
165
|
+
};
|
|
158
166
|
|
|
159
167
|
/**
|
|
160
168
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -2967,6 +2975,7 @@ declare const createClient: (config: ClientConfig, middlewares?: ((_config: Inte
|
|
|
2967
2975
|
declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof createClient>[1]) => {
|
|
2968
2976
|
dashboardServices: {
|
|
2969
2977
|
mechanization: {
|
|
2978
|
+
verifyPhoneNumber: ({ phoneNumber, otpCode, }: VerifyPhoneNumberVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<VerifyPhoneNumberModel>>;
|
|
2970
2979
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationVarietyModel[]>>;
|
|
2971
2980
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
|
|
2972
2981
|
getMechanization: ({ farmerId, mechanizationId }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel>>;
|
|
@@ -2982,4 +2991,4 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
2982
2991
|
};
|
|
2983
2992
|
};
|
|
2984
2993
|
|
|
2985
|
-
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MechanizationsVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, createSDK };
|
|
2994
|
+
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MechanizationsVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, type VerifyPhoneNumberModel, type VerifyPhoneNumberVariables, createSDK };
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ var createClient = (config, middlewares = []) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
58
|
-
import { R as
|
|
58
|
+
import { R as R3 } from "@mobily/ts-belt";
|
|
59
59
|
|
|
60
60
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
61
61
|
var mappers = {
|
|
@@ -141,7 +141,11 @@ var mappers = {
|
|
|
141
141
|
date,
|
|
142
142
|
heading
|
|
143
143
|
}),
|
|
144
|
-
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
144
|
+
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
145
|
+
verifyPhoneNumber: (dto) => ({
|
|
146
|
+
phoneNumber: dto.phoneNumber,
|
|
147
|
+
verificationToken: dto.verificationToken
|
|
148
|
+
})
|
|
145
149
|
};
|
|
146
150
|
|
|
147
151
|
// src/utils/wrapError.ts
|
|
@@ -151,6 +155,25 @@ var wrapError = (error) => {
|
|
|
151
155
|
return R.Error(err);
|
|
152
156
|
};
|
|
153
157
|
|
|
158
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/v.service.ts
|
|
159
|
+
import { R as R2 } from "@mobily/ts-belt";
|
|
160
|
+
var vfn = (client) => ({
|
|
161
|
+
verifyPhoneNumber: async ({
|
|
162
|
+
phoneNumber,
|
|
163
|
+
otpCode
|
|
164
|
+
}) => {
|
|
165
|
+
try {
|
|
166
|
+
const { data } = await client.post(`/auth/verify-phone-number`, {
|
|
167
|
+
phoneNumber,
|
|
168
|
+
otpCode
|
|
169
|
+
});
|
|
170
|
+
return R2.Ok(mappers.verifyPhoneNumber(data));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return wrapError(error);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
154
177
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
155
178
|
var createMechanizationServices = (client) => ({
|
|
156
179
|
getMechanizationVarieties: async ({
|
|
@@ -160,7 +183,7 @@ var createMechanizationServices = (client) => ({
|
|
|
160
183
|
const { data } = await client.get(
|
|
161
184
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
162
185
|
);
|
|
163
|
-
return
|
|
186
|
+
return R3.Ok(
|
|
164
187
|
mappers.getMechanizationVarietyList(
|
|
165
188
|
data.result.data.mechanizationVarieties
|
|
166
189
|
)
|
|
@@ -177,7 +200,7 @@ var createMechanizationServices = (client) => ({
|
|
|
177
200
|
const { data } = await client.get(
|
|
178
201
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
179
202
|
);
|
|
180
|
-
return
|
|
203
|
+
return R3.Ok(
|
|
181
204
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
182
205
|
);
|
|
183
206
|
} catch (error) {
|
|
@@ -197,7 +220,7 @@ var createMechanizationServices = (client) => ({
|
|
|
197
220
|
}
|
|
198
221
|
);
|
|
199
222
|
const mechanization = response.result.data.mechanization;
|
|
200
|
-
return
|
|
223
|
+
return R3.Ok(mappers.getMechanization(mechanization));
|
|
201
224
|
} catch (error) {
|
|
202
225
|
return wrapError(error);
|
|
203
226
|
}
|
|
@@ -220,7 +243,7 @@ var createMechanizationServices = (client) => ({
|
|
|
220
243
|
}
|
|
221
244
|
);
|
|
222
245
|
const mechanizations = response.result.data.mechanizations;
|
|
223
|
-
return
|
|
246
|
+
return R3.Ok(mappers.getMechanizations(mechanizations));
|
|
224
247
|
} catch (error) {
|
|
225
248
|
return wrapError(error);
|
|
226
249
|
}
|
|
@@ -241,7 +264,7 @@ var createMechanizationServices = (client) => ({
|
|
|
241
264
|
}
|
|
242
265
|
);
|
|
243
266
|
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
244
|
-
return
|
|
267
|
+
return R3.Ok(
|
|
245
268
|
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
246
269
|
);
|
|
247
270
|
} catch (error) {
|
|
@@ -258,7 +281,7 @@ var createMechanizationServices = (client) => ({
|
|
|
258
281
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
259
282
|
{ deviceCode }
|
|
260
283
|
);
|
|
261
|
-
return
|
|
284
|
+
return R3.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
262
285
|
} catch (error) {
|
|
263
286
|
return wrapError(error);
|
|
264
287
|
}
|
|
@@ -268,7 +291,7 @@ var createMechanizationServices = (client) => ({
|
|
|
268
291
|
const { data } = await client.get(
|
|
269
292
|
"/statics/mechanizations-seasons-process-kinds"
|
|
270
293
|
);
|
|
271
|
-
return
|
|
294
|
+
return R3.Ok(
|
|
272
295
|
mappers.getSeasonsProcessList(
|
|
273
296
|
data.result.data.mechanizationSeasonProcessKinds
|
|
274
297
|
)
|
|
@@ -288,7 +311,7 @@ var createMechanizationServices = (client) => ({
|
|
|
288
311
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
289
312
|
{ deviceCode, verificationToken }
|
|
290
313
|
);
|
|
291
|
-
return
|
|
314
|
+
return R3.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
292
315
|
} catch (error) {
|
|
293
316
|
return wrapError(error);
|
|
294
317
|
}
|
|
@@ -307,7 +330,7 @@ var createMechanizationServices = (client) => ({
|
|
|
307
330
|
}
|
|
308
331
|
);
|
|
309
332
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
310
|
-
return
|
|
333
|
+
return R3.Ok(mappers.getQuestions(questions));
|
|
311
334
|
} catch (error) {
|
|
312
335
|
return wrapError(error);
|
|
313
336
|
}
|
|
@@ -334,7 +357,7 @@ var createMechanizationServices = (client) => ({
|
|
|
334
357
|
}
|
|
335
358
|
);
|
|
336
359
|
const movementChanges = response.result.data.movementChanges;
|
|
337
|
-
return
|
|
360
|
+
return R3.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
338
361
|
} catch (error) {
|
|
339
362
|
return wrapError(error);
|
|
340
363
|
}
|
|
@@ -351,11 +374,12 @@ var createMechanizationServices = (client) => ({
|
|
|
351
374
|
data: { verificationToken }
|
|
352
375
|
}
|
|
353
376
|
);
|
|
354
|
-
return
|
|
377
|
+
return R3.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
355
378
|
} catch (error) {
|
|
356
379
|
return wrapError(error);
|
|
357
380
|
}
|
|
358
|
-
}
|
|
381
|
+
},
|
|
382
|
+
...vfn(client)
|
|
359
383
|
});
|
|
360
384
|
|
|
361
385
|
// src/index.ts
|