@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 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
- getMotorizedMechanizationSensors: (response) => ({
103
+ getSeasonsProcess: (response) => ({
103
104
  id: response.id,
104
- speed: response.speed,
105
- heading: response.heading,
106
- latitude: response.latitude,
107
- longitude: response.longitude,
108
- fuelLevel: response.fuelLevel,
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 ({ farmerId, kindName }) => {
132
+ getMechanizations: async ({ kindName }) => {
140
133
  try {
141
134
  const { data } = await client.get(
142
- `/farmers/${farmerId}/mechanizations?kindName=${kindName}`
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
- getMotorizedMechanizationSensors: async ({
154
- farmerId,
155
- mechanizationId
156
- }) => {
146
+ getSeasonsProcess: async () => {
157
147
  try {
158
148
  const { data } = await client.get(
159
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors`
149
+ "/statics/mechanizations-seasons-process-kinds"
160
150
  );
161
- console.log({ data });
162
151
  return import_ts_belt.R.Ok(
163
- mappers.getMotorizedMechanizationSensors(
164
- data.result.data.mechanizations
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("Mechanization API Error:", err);
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, "mechanizationVarietyId-id">;
13
- type MechanizationId = Branded<string, "mechanizationId-id">;
14
- type MotorizedMechanizationSensorsId = Branded<string, "motorized-mechanization-sensorsId-id">;
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 MotorizedMechanizationSensorsModel = {
72
- id: string;
73
- speed: number;
74
- heading: string;
75
- latitude: number;
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: ({ farmerId, kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
101
- getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
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 MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type ServiceType, type Status, type StatusType, type TaskType, type VarietyKind, createSDK };
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
- getMotorizedMechanizationSensors: (response) => ({
67
+ getSeasonsProcess: (response) => ({
67
68
  id: response.id,
68
- speed: response.speed,
69
- heading: response.heading,
70
- latitude: response.latitude,
71
- longitude: response.longitude,
72
- fuelLevel: response.fuelLevel,
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 ({ farmerId, kindName }) => {
96
+ getMechanizations: async ({ kindName }) => {
104
97
  try {
105
98
  const { data } = await client.get(
106
- `/farmers/${farmerId}/mechanizations?kindName=${kindName}`
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
- getMotorizedMechanizationSensors: async ({
118
- farmerId,
119
- mechanizationId
120
- }) => {
110
+ getSeasonsProcess: async () => {
121
111
  try {
122
112
  const { data } = await client.get(
123
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors`
113
+ "/statics/mechanizations-seasons-process-kinds"
124
114
  );
125
- console.log({ data });
126
115
  return R.Ok(
127
- mappers.getMotorizedMechanizationSensors(
128
- data.result.data.mechanizations
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("Mechanization API Error:", err);
122
+ console.error("getSeasonsProcess API Error:", err);
134
123
  return R.Error(err);
135
124
  }
136
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "1.1.6-1",
3
+ "version": "1.4.1-3",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",