@agroyaar/sdk 1.1.6-0 → 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 -24
- package/dist/index.d.ts +11 -25
- package/dist/index.mjs +13 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -99,21 +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
|
-
})
|
104
|
+
label: response.label,
|
105
|
+
mechanizationVarietyIds: response.mechanizationVarietyIds,
|
106
|
+
name: response.name
|
107
|
+
}),
|
108
|
+
getSeasonsProcessList: (response) => response.map(mappers.getSeasonsProcess)
|
117
109
|
};
|
118
110
|
|
119
111
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -136,10 +128,10 @@ var createMechanizationServices = (client) => ({
|
|
136
128
|
return import_ts_belt.R.Error(err);
|
137
129
|
}
|
138
130
|
},
|
139
|
-
getMechanizations: async ({
|
131
|
+
getMechanizations: async ({ kindName }) => {
|
140
132
|
try {
|
141
133
|
const { data } = await client.get(
|
142
|
-
`/farmers
|
134
|
+
`/farmers/681f11f87eeba74f9bb8f422/mechanizations?kindName=${kindName}`
|
143
135
|
);
|
144
136
|
return import_ts_belt.R.Ok(
|
145
137
|
mappers.getMechanizationsList(data.result.data.mechanizations)
|
@@ -150,22 +142,19 @@ var createMechanizationServices = (client) => ({
|
|
150
142
|
return import_ts_belt.R.Error(err);
|
151
143
|
}
|
152
144
|
},
|
153
|
-
|
154
|
-
farmerId,
|
155
|
-
mechanizationId
|
156
|
-
}) => {
|
145
|
+
getSeasonsProcess: async () => {
|
157
146
|
try {
|
158
147
|
const { data } = await client.get(
|
159
|
-
|
148
|
+
"/statics/mechanizations-seasons-process-kinds"
|
160
149
|
);
|
161
150
|
return import_ts_belt.R.Ok(
|
162
|
-
mappers.
|
163
|
-
data.result.data.
|
151
|
+
mappers.getSeasonsProcessList(
|
152
|
+
data.result.data.mechanizationSeasonProcessKinds
|
164
153
|
)
|
165
154
|
);
|
166
155
|
} catch (error) {
|
167
156
|
const err = error instanceof Error ? error : new Error(String(error));
|
168
|
-
console.error("
|
157
|
+
console.error("getSeasonsProcess API Error:", err);
|
169
158
|
return import_ts_belt.R.Error(err);
|
170
159
|
}
|
171
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,27 +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
|
-
};
|
86
|
-
type MotorizedMechanizationSensorsVariables = {
|
87
|
-
farmerId: string;
|
88
|
-
mechanizationId: string;
|
70
|
+
type SeasonsProcessModel = {
|
71
|
+
id: Identifiers.SeasonsProcessId;
|
72
|
+
name: string;
|
73
|
+
label: string;
|
74
|
+
mechanizationVarietyIds: string[];
|
89
75
|
};
|
90
76
|
|
91
77
|
type ClientConfig = {
|
@@ -97,10 +83,10 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
97
83
|
dashboardServices: {
|
98
84
|
mechanization: {
|
99
85
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
|
100
|
-
getMechanizations: ({
|
101
|
-
|
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[]>>;
|
102
88
|
};
|
103
89
|
};
|
104
90
|
};
|
105
91
|
|
106
|
-
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,21 +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
|
-
})
|
68
|
+
label: response.label,
|
69
|
+
mechanizationVarietyIds: response.mechanizationVarietyIds,
|
70
|
+
name: response.name
|
71
|
+
}),
|
72
|
+
getSeasonsProcessList: (response) => response.map(mappers.getSeasonsProcess)
|
81
73
|
};
|
82
74
|
|
83
75
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -100,10 +92,10 @@ var createMechanizationServices = (client) => ({
|
|
100
92
|
return R.Error(err);
|
101
93
|
}
|
102
94
|
},
|
103
|
-
getMechanizations: async ({
|
95
|
+
getMechanizations: async ({ kindName }) => {
|
104
96
|
try {
|
105
97
|
const { data } = await client.get(
|
106
|
-
`/farmers
|
98
|
+
`/farmers/681f11f87eeba74f9bb8f422/mechanizations?kindName=${kindName}`
|
107
99
|
);
|
108
100
|
return R.Ok(
|
109
101
|
mappers.getMechanizationsList(data.result.data.mechanizations)
|
@@ -114,22 +106,19 @@ var createMechanizationServices = (client) => ({
|
|
114
106
|
return R.Error(err);
|
115
107
|
}
|
116
108
|
},
|
117
|
-
|
118
|
-
farmerId,
|
119
|
-
mechanizationId
|
120
|
-
}) => {
|
109
|
+
getSeasonsProcess: async () => {
|
121
110
|
try {
|
122
111
|
const { data } = await client.get(
|
123
|
-
|
112
|
+
"/statics/mechanizations-seasons-process-kinds"
|
124
113
|
);
|
125
114
|
return R.Ok(
|
126
|
-
mappers.
|
127
|
-
data.result.data.
|
115
|
+
mappers.getSeasonsProcessList(
|
116
|
+
data.result.data.mechanizationSeasonProcessKinds
|
128
117
|
)
|
129
118
|
);
|
130
119
|
} catch (error) {
|
131
120
|
const err = error instanceof Error ? error : new Error(String(error));
|
132
|
-
console.error("
|
121
|
+
console.error("getSeasonsProcess API Error:", err);
|
133
122
|
return R.Error(err);
|
134
123
|
}
|
135
124
|
}
|