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