@agroyaar/sdk 1.1.3 → 1.1.4-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 +13 -19
- package/dist/index.d.ts +10 -2
- package/dist/index.mjs +13 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -87,18 +87,9 @@ var mappers = {
|
|
87
87
|
machineUsageIds: response.machineUsageIds
|
88
88
|
}),
|
89
89
|
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
model: response.model,
|
94
|
-
avatarURL: response.avatarURL,
|
95
|
-
manufactureYear: response.manufactureYear,
|
96
|
-
code: response.code,
|
97
|
-
kind: response.kind,
|
98
|
-
kindName: response.kindName,
|
99
|
-
variety: mappers.getMechanizationVariety(response.variety)
|
100
|
-
}),
|
101
|
-
getMechanizationsList: (response) => response.map(mappers.getMechanization)
|
90
|
+
SubmitTrackingDeviceData: (response) => ({
|
91
|
+
deviceCode: response.deviceCode
|
92
|
+
})
|
102
93
|
};
|
103
94
|
|
104
95
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -121,17 +112,20 @@ var createMechanizationServices = (client) => ({
|
|
121
112
|
return import_ts_belt.R.Error(err);
|
122
113
|
}
|
123
114
|
},
|
124
|
-
|
115
|
+
SubmitTrackingDeviceResData: async ({
|
116
|
+
farmerId,
|
117
|
+
mechanizationId,
|
118
|
+
deviceCode
|
119
|
+
}) => {
|
125
120
|
try {
|
126
|
-
const { data } = await client.
|
127
|
-
`/farmers/
|
128
|
-
|
129
|
-
return import_ts_belt.R.Ok(
|
130
|
-
mappers.getMechanizationsList(data.result.data.mechanizations)
|
121
|
+
const { data } = await client.post(
|
122
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
123
|
+
{ deviceCode }
|
131
124
|
);
|
125
|
+
return import_ts_belt.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
132
126
|
} catch (error) {
|
133
127
|
const err = error instanceof Error ? error : new Error(String(error));
|
134
|
-
console.error("
|
128
|
+
console.error("SubmitTrackingDevice API Error:", err);
|
135
129
|
return import_ts_belt.R.Error(err);
|
136
130
|
}
|
137
131
|
}
|
package/dist/index.d.ts
CHANGED
@@ -66,6 +66,14 @@ type MechanizationModel = {
|
|
66
66
|
type MechanizationVariables = {
|
67
67
|
kindName: MechanizationType;
|
68
68
|
};
|
69
|
+
type SubmitTrackingDeviceModel = {
|
70
|
+
deviceCode: string;
|
71
|
+
};
|
72
|
+
type SubmitTrackingDeviceVariables = {
|
73
|
+
farmerId: string;
|
74
|
+
mechanizationId: string;
|
75
|
+
deviceCode: string;
|
76
|
+
};
|
69
77
|
|
70
78
|
type ClientConfig = {
|
71
79
|
readonly baseURL: string;
|
@@ -76,9 +84,9 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
76
84
|
dashboardServices: {
|
77
85
|
mechanization: {
|
78
86
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
|
79
|
-
|
87
|
+
SubmitTrackingDeviceResData: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SubmitTrackingDeviceModel>>;
|
80
88
|
};
|
81
89
|
};
|
82
90
|
};
|
83
91
|
|
84
|
-
export { type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type ServiceType, type Status, type StatusType, type TaskType, type VarietyKind, createSDK };
|
92
|
+
export { type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type ServiceType, type Status, type StatusType, type SubmitTrackingDeviceModel, type SubmitTrackingDeviceVariables, type TaskType, type VarietyKind, createSDK };
|
package/dist/index.mjs
CHANGED
@@ -51,18 +51,9 @@ var mappers = {
|
|
51
51
|
machineUsageIds: response.machineUsageIds
|
52
52
|
}),
|
53
53
|
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
model: response.model,
|
58
|
-
avatarURL: response.avatarURL,
|
59
|
-
manufactureYear: response.manufactureYear,
|
60
|
-
code: response.code,
|
61
|
-
kind: response.kind,
|
62
|
-
kindName: response.kindName,
|
63
|
-
variety: mappers.getMechanizationVariety(response.variety)
|
64
|
-
}),
|
65
|
-
getMechanizationsList: (response) => response.map(mappers.getMechanization)
|
54
|
+
SubmitTrackingDeviceData: (response) => ({
|
55
|
+
deviceCode: response.deviceCode
|
56
|
+
})
|
66
57
|
};
|
67
58
|
|
68
59
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -85,17 +76,20 @@ var createMechanizationServices = (client) => ({
|
|
85
76
|
return R.Error(err);
|
86
77
|
}
|
87
78
|
},
|
88
|
-
|
79
|
+
SubmitTrackingDeviceResData: async ({
|
80
|
+
farmerId,
|
81
|
+
mechanizationId,
|
82
|
+
deviceCode
|
83
|
+
}) => {
|
89
84
|
try {
|
90
|
-
const { data } = await client.
|
91
|
-
`/farmers/
|
92
|
-
|
93
|
-
return R.Ok(
|
94
|
-
mappers.getMechanizationsList(data.result.data.mechanizations)
|
85
|
+
const { data } = await client.post(
|
86
|
+
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
87
|
+
{ deviceCode }
|
95
88
|
);
|
89
|
+
return R.Ok(mappers.SubmitTrackingDeviceData(data));
|
96
90
|
} catch (error) {
|
97
91
|
const err = error instanceof Error ? error : new Error(String(error));
|
98
|
-
console.error("
|
92
|
+
console.error("SubmitTrackingDevice API Error:", err);
|
99
93
|
return R.Error(err);
|
100
94
|
}
|
101
95
|
}
|