@agroyaar/sdk 1.1.5 → 1.4.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 +13 -25
- package/dist/index.d.ts +11 -26
- package/dist/index.mjs +13 -25
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -99,22 +99,13 @@ var mappers = {
|
|
99
99
|
variety: mappers.getMechanizationVariety(response.variety)
|
100
100
|
}),
|
101
101
|
getMechanizationsList: (response) => response.map(mappers.getMechanization),
|
102
|
-
|
102
|
+
getSeasonsProcess: (response) => ({
|
103
103
|
id: response.id,
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
engineRpm: response.engineRpm,
|
110
|
-
deviceCode: response.deviceCode,
|
111
|
-
stateEngine: response.stateEngine,
|
112
|
-
engineOilPressure: response.engineOilPressure,
|
113
|
-
engineWaterTemperature: response.engineWaterTemperature,
|
114
|
-
batteryChargePercentage: response.batteryChargePercentage,
|
115
|
-
mechanizationId: response.mechanizationId,
|
116
|
-
mechanization: mappers.getMechanization(response.mechanization)
|
117
|
-
})
|
104
|
+
label: response.label,
|
105
|
+
mechanizationVarietyIds: response.mechanizationVarietyIds,
|
106
|
+
name: response.name
|
107
|
+
}),
|
108
|
+
getSeasonsProcessList: (response) => response.map(mappers.getSeasonsProcess)
|
118
109
|
};
|
119
110
|
|
120
111
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -137,10 +128,10 @@ var createMechanizationServices = (client) => ({
|
|
137
128
|
return import_ts_belt.R.Error(err);
|
138
129
|
}
|
139
130
|
},
|
140
|
-
getMechanizations: async ({
|
131
|
+
getMechanizations: async ({ kindName }) => {
|
141
132
|
try {
|
142
133
|
const { data } = await client.get(
|
143
|
-
`/farmers
|
134
|
+
`/farmers/681f11f87eeba74f9bb8f422/mechanizations?kindName=${kindName}`
|
144
135
|
);
|
145
136
|
return import_ts_belt.R.Ok(
|
146
137
|
mappers.getMechanizationsList(data.result.data.mechanizations)
|
@@ -151,22 +142,19 @@ var createMechanizationServices = (client) => ({
|
|
151
142
|
return import_ts_belt.R.Error(err);
|
152
143
|
}
|
153
144
|
},
|
154
|
-
|
155
|
-
farmerId,
|
156
|
-
mechanizationId
|
157
|
-
}) => {
|
145
|
+
getSeasonsProcess: async () => {
|
158
146
|
try {
|
159
147
|
const { data } = await client.get(
|
160
|
-
|
148
|
+
"/statics/mechanizations-seasons-process-kinds"
|
161
149
|
);
|
162
150
|
return import_ts_belt.R.Ok(
|
163
|
-
mappers.
|
164
|
-
data.result.data.
|
151
|
+
mappers.getSeasonsProcessList(
|
152
|
+
data.result.data.mechanizationSeasonProcessKinds
|
165
153
|
)
|
166
154
|
);
|
167
155
|
} catch (error) {
|
168
156
|
const err = error instanceof Error ? error : new Error(String(error));
|
169
|
-
console.error("
|
157
|
+
console.error("getSeasonsProcess API Error:", err);
|
170
158
|
return import_ts_belt.R.Error(err);
|
171
159
|
}
|
172
160
|
}
|
package/dist/index.d.ts
CHANGED
@@ -9,9 +9,9 @@ type Brand<B> = {
|
|
9
9
|
type Branded<T, B> = Brand<B> & T;
|
10
10
|
|
11
11
|
declare namespace Identifiers {
|
12
|
-
type MechanizationVarietyId = Branded<string, "
|
13
|
-
type MechanizationId = Branded<string, "
|
14
|
-
type
|
12
|
+
type MechanizationVarietyId = Branded<string, "mechanizationVariety-id">;
|
13
|
+
type MechanizationId = Branded<string, "mechanization-id">;
|
14
|
+
type SeasonsProcessId = Branded<string, " seasonsProcess-id">;
|
15
15
|
}
|
16
16
|
|
17
17
|
type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP";
|
@@ -65,28 +65,13 @@ type MechanizationModel = {
|
|
65
65
|
variety: MechanizationVarietyModel;
|
66
66
|
};
|
67
67
|
type MechanizationVariables = {
|
68
|
-
farmerId: string;
|
69
68
|
kindName: MechanizationType;
|
70
69
|
};
|
71
|
-
type
|
72
|
-
id:
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
longitude: number;
|
77
|
-
fuelLevel: number;
|
78
|
-
engineRpm: number;
|
79
|
-
deviceCode: string;
|
80
|
-
stateEngine: boolean;
|
81
|
-
engineOilPressure: boolean;
|
82
|
-
engineWaterTemperature: string;
|
83
|
-
batteryChargePercentage: string;
|
84
|
-
mechanizationId: string;
|
85
|
-
mechanization: MechanizationModel;
|
86
|
-
};
|
87
|
-
type MotorizedMechanizationSensorsVariables = {
|
88
|
-
farmerId: string;
|
89
|
-
mechanizationId: string;
|
70
|
+
type SeasonsProcessModel = {
|
71
|
+
id: Identifiers.SeasonsProcessId;
|
72
|
+
name: string;
|
73
|
+
label: string;
|
74
|
+
mechanizationVarietyIds: string[];
|
90
75
|
};
|
91
76
|
|
92
77
|
type ClientConfig = {
|
@@ -98,10 +83,10 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
98
83
|
dashboardServices: {
|
99
84
|
mechanization: {
|
100
85
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
|
101
|
-
getMechanizations: ({
|
102
|
-
|
86
|
+
getMechanizations: ({ kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
87
|
+
getSeasonsProcess: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SeasonsProcessModel[]>>;
|
103
88
|
};
|
104
89
|
};
|
105
90
|
};
|
106
91
|
|
107
|
-
export { type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type
|
92
|
+
export { type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type SeasonsProcessModel, type ServiceType, type Status, type StatusType, type TaskType, type VarietyKind, createSDK };
|
package/dist/index.mjs
CHANGED
@@ -63,22 +63,13 @@ var mappers = {
|
|
63
63
|
variety: mappers.getMechanizationVariety(response.variety)
|
64
64
|
}),
|
65
65
|
getMechanizationsList: (response) => response.map(mappers.getMechanization),
|
66
|
-
|
66
|
+
getSeasonsProcess: (response) => ({
|
67
67
|
id: response.id,
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
engineRpm: response.engineRpm,
|
74
|
-
deviceCode: response.deviceCode,
|
75
|
-
stateEngine: response.stateEngine,
|
76
|
-
engineOilPressure: response.engineOilPressure,
|
77
|
-
engineWaterTemperature: response.engineWaterTemperature,
|
78
|
-
batteryChargePercentage: response.batteryChargePercentage,
|
79
|
-
mechanizationId: response.mechanizationId,
|
80
|
-
mechanization: mappers.getMechanization(response.mechanization)
|
81
|
-
})
|
68
|
+
label: response.label,
|
69
|
+
mechanizationVarietyIds: response.mechanizationVarietyIds,
|
70
|
+
name: response.name
|
71
|
+
}),
|
72
|
+
getSeasonsProcessList: (response) => response.map(mappers.getSeasonsProcess)
|
82
73
|
};
|
83
74
|
|
84
75
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -101,10 +92,10 @@ var createMechanizationServices = (client) => ({
|
|
101
92
|
return R.Error(err);
|
102
93
|
}
|
103
94
|
},
|
104
|
-
getMechanizations: async ({
|
95
|
+
getMechanizations: async ({ kindName }) => {
|
105
96
|
try {
|
106
97
|
const { data } = await client.get(
|
107
|
-
`/farmers
|
98
|
+
`/farmers/681f11f87eeba74f9bb8f422/mechanizations?kindName=${kindName}`
|
108
99
|
);
|
109
100
|
return R.Ok(
|
110
101
|
mappers.getMechanizationsList(data.result.data.mechanizations)
|
@@ -115,22 +106,19 @@ var createMechanizationServices = (client) => ({
|
|
115
106
|
return R.Error(err);
|
116
107
|
}
|
117
108
|
},
|
118
|
-
|
119
|
-
farmerId,
|
120
|
-
mechanizationId
|
121
|
-
}) => {
|
109
|
+
getSeasonsProcess: async () => {
|
122
110
|
try {
|
123
111
|
const { data } = await client.get(
|
124
|
-
|
112
|
+
"/statics/mechanizations-seasons-process-kinds"
|
125
113
|
);
|
126
114
|
return R.Ok(
|
127
|
-
mappers.
|
128
|
-
data.result.data.
|
115
|
+
mappers.getSeasonsProcessList(
|
116
|
+
data.result.data.mechanizationSeasonProcessKinds
|
129
117
|
)
|
130
118
|
);
|
131
119
|
} catch (error) {
|
132
120
|
const err = error instanceof Error ? error : new Error(String(error));
|
133
|
-
console.error("
|
121
|
+
console.error("getSeasonsProcess API Error:", err);
|
134
122
|
return R.Error(err);
|
135
123
|
}
|
136
124
|
}
|