@agroyaar/sdk 1.1.0 → 1.1.3-0
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 +32 -1
- package/dist/index.d.ts +45 -3
- package/dist/index.mjs +32 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -86,7 +86,24 @@ var mappers = {
|
|
86
86
|
seasonProcessIds: response.seasonProcessIds,
|
87
87
|
machineUsageIds: response.machineUsageIds
|
88
88
|
}),
|
89
|
-
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety)
|
89
|
+
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
|
90
|
+
getMechanization: (response) => ({
|
91
|
+
id: response.id,
|
92
|
+
commonName: response.commonName,
|
93
|
+
model: response.model,
|
94
|
+
avatarURL: response.avatarURL,
|
95
|
+
manufactureYear: response.manufactureYear,
|
96
|
+
code: response.code,
|
97
|
+
variety: {
|
98
|
+
id: response.id,
|
99
|
+
name: "response.variety.name",
|
100
|
+
iconURL: "response.variety.iconURL",
|
101
|
+
kind: response.variety.kind,
|
102
|
+
seasonProcessIds: [],
|
103
|
+
machineUsageIds: []
|
104
|
+
}
|
105
|
+
}),
|
106
|
+
getMechanizationsList: (response) => response.map(mappers.getMechanization)
|
90
107
|
};
|
91
108
|
|
92
109
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -108,6 +125,20 @@ var createMechanizationServices = (client) => ({
|
|
108
125
|
console.error("MechanizationVariety API Error:", err);
|
109
126
|
return import_ts_belt.R.Error(err);
|
110
127
|
}
|
128
|
+
},
|
129
|
+
getMechanizations: async ({ kindName }) => {
|
130
|
+
try {
|
131
|
+
const { data } = await client.get(
|
132
|
+
`/farmers/681f11f87eeba74f9bb8f422/mechanizations?kindName=${kindName}`
|
133
|
+
);
|
134
|
+
return import_ts_belt.R.Ok(
|
135
|
+
mappers.getMechanizationsList(data.result.data.mechanizations)
|
136
|
+
);
|
137
|
+
} catch (error) {
|
138
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
139
|
+
console.error("Mechanization API Error:", err);
|
140
|
+
return import_ts_belt.R.Error(err);
|
141
|
+
}
|
111
142
|
}
|
112
143
|
});
|
113
144
|
|
package/dist/index.d.ts
CHANGED
@@ -10,18 +10,59 @@ type Branded<T, B> = Brand<B> & T;
|
|
10
10
|
|
11
11
|
declare namespace Identifiers {
|
12
12
|
type MechanizationVarietyId = Branded<string, "mechanizationVarietyId-id">;
|
13
|
+
type MechanizationId = Branded<string, "mechanizationId-id">;
|
13
14
|
}
|
14
15
|
|
16
|
+
type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP";
|
17
|
+
type StatusType = "ACTIVE" | "ACTIVE_LEADING_EXPERT" | "APPROVED_EXPERIMENT_ANALYSIS_REQUEST" | "APPROVED_MISSION" | "APPROVED_RESIDENT_LEADING_EXPERT" | "ARCHIVED" | "AWAITING_APPROVAL_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_APPROVAL_MISSION" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "AWAITING_COLLEAGUE_APPROVAL_REQUEST" | "AWAITING_MISSION_COMPLETION_REQUEST" | "AWAITING_PAYMENT_REQUEST" | "AWAITING_PURCHASE_REQUEST" | "AWAITING_REVIEW_ACTIVATION" | "AWAITING_REVIEW_DATA_MISSION" | "AWAITING_REVIEW_INQUIRY" | "AWAITING_REVIEW_MISSION_DATA_REQUEST" | "AWAITING_REVIEW_MODIFICATION" | "AWAITING_REVIEW_OFFER" | "AWAITING_REVIEW_REGISTRATION" | "AWAITING_REVIEW_REQUEST" | "AWAITING_SAMPLE_DELIVERY_LABORATORY_MISSION" | "AWAITING_SEND_REQUEST" | "AWAITING_SIGNING_CONTRACT" | "AWAITING_START_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_START_MISSION" | "AWAITING_SUBMIT_ACTIVATION" | "AWAITING_VERIFICATION_CHARGE_WALLET_TRANSACTION" | "CANCELED_EXPERIMENT_ANALYSIS_REQUEST" | "CANCELED_MISSION" | "CANCELED_REQUEST" | "COMPLETED" | "COMPLETED_EXPERIMENT_ANALYSIS_REQUEST" | "COMPLETED_MISSION" | "COMPLETED_REGISTRATION" | "COMPLETED_REQUEST" | "CONFIRMED" | "CONFIRMED_ACTIVATION" | "CONFIRMED_REGISTRATION" | "DONE" | "DRAFT" | "DRAFT_EXPERIMENT_ANALYSIS_REQUEST" | "DRAFT_MISSION" | "FAILED" | "FAILED_CHARGE_WALLET_TRANSACTION" | "INACTIVE" | "INVALID" | "INVALID_DEVICE_PUSH_TOKEN" | "IN_PROGRESS_EXPERIMENT_ANALYSIS_REQUEST" | "IN_PROGRESS_MISSION" | "PAID" | "PASS_PAYMENT" | "PENDING" | "PROCESSING" | "REJECTED" | "REJECTED_ACTIVATION" | "REJECTED_EXPERIMENT_ANALYSIS_REQUEST" | "REJECTED_MISSION" | "REJECTED_MODIFICATION" | "REJECTED_REGISTRATION" | "REJECTED_RESIDENT_LEADING_EXPERT" | "SUBMIT" | "SUCCESS" | "SUCCESS_PAYMENT_WALLET_TRANSACTION" | "VALID" | "VALID_DEVICE_PUSH_TOKEN" | "VERIFIED" | "VERIFIED_CHARGE_WALLET_TRANSACTION" | "WRITING" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "APPROVED_RESIDENT_LEADING_EXPERT" | "REJECTED_RESIDENT_LEADING_EXPERT";
|
18
|
+
type TaskType = "SAMPLING_REQUEST" | "SAMPLING_MISSION" | "ANALYSIS_REQUEST" | "MAP_DRAWING" | "WATER_SAMPLE_CONTROL" | "WATER_ANALYSIS_MEASUREMENT" | "WATER_EXPERIMENT_TECHNICAL_REVIEW" | "PLANT_SAMPLE_CONTROL" | "PLANT_ANALYSIS_MEASUREMENT" | "PLANT_EXPERIMENT_TECHNICAL_REVIEW" | "SOIL_SAMPLE_CONTROL" | "SOIL_ANALYSIS_MEASUREMENT" | "SOIL_EXPERIMENT_TECHNICAL_REVIEW" | "SENDING_REPORTS" | "TECHNICAL_REVIEW" | "EXPERIMENT_ANALYSIS_RESULTS_CONTROL" | "EXPERIMENT_RECOMMENDATION_ANALYSIS_RESULTS" | "SUPPORT_EXPERIMENTS" | "VISIT_REQUEST" | "FOLLOW_UP_VISIT" | "VISIT_MAP_DRAWING" | "VISIT_SENDING_REPORTS" | "SUPPORT_VISITS";
|
19
|
+
type MechanizationType = "MOTORIZED" | "NON_MOTORIZED";
|
20
|
+
type MechanizationSeasonProcessType = "GROWING" | "HARVESTING" | "PLANTING" | "TRANSPORTATION";
|
21
|
+
type MechanizationMachineUsageType = "BALER" | "CRUSHING" | "CRUST_BREAKER" | "FERTILIZER_SPREADER" | "FORAGE_COLLECTOR" | "FURROWER" | "GRASS_CUTTER" | "GRINDING" | "HARVESTING" | "LEVELING" | "LOADER" | "MULTI_PURPOSE" | "SEEDER" | "SPRAYER" | "TILLAGE" | "TRANSPORTATION" | "WEEDER";
|
22
|
+
|
23
|
+
type Status = {
|
24
|
+
id: string;
|
25
|
+
label: string;
|
26
|
+
name: StatusType;
|
27
|
+
};
|
28
|
+
type VarietyKind = {
|
29
|
+
id: string;
|
30
|
+
label: string;
|
31
|
+
name: MechanizationType;
|
32
|
+
};
|
33
|
+
type MechanizationSeasonProcessKind = {
|
34
|
+
id: string;
|
35
|
+
label: string;
|
36
|
+
name: MechanizationSeasonProcessType;
|
37
|
+
};
|
38
|
+
type MechanizationMachineUsageKind = {
|
39
|
+
id: string;
|
40
|
+
label: string;
|
41
|
+
name: MechanizationMachineUsageType;
|
42
|
+
};
|
43
|
+
|
15
44
|
type MechanizationVarietyModel = {
|
16
45
|
id: Identifiers.MechanizationVarietyId;
|
17
46
|
name: string;
|
18
47
|
iconURL: string;
|
19
|
-
kind:
|
48
|
+
kind: VarietyKind;
|
20
49
|
seasonProcessIds: string[];
|
21
50
|
machineUsageIds: string[];
|
22
51
|
};
|
23
52
|
type MechanizationVarietyVariables = {
|
24
|
-
kindName:
|
53
|
+
kindName: MechanizationType;
|
54
|
+
};
|
55
|
+
type MechanizationModel = {
|
56
|
+
id: Identifiers.MechanizationId;
|
57
|
+
model: string;
|
58
|
+
commonName: string;
|
59
|
+
avatarURL: string;
|
60
|
+
manufactureYear: string;
|
61
|
+
code: string;
|
62
|
+
variety: MechanizationVarietyModel;
|
63
|
+
};
|
64
|
+
type MechanizationVariables = {
|
65
|
+
kindName: MechanizationType;
|
25
66
|
};
|
26
67
|
|
27
68
|
type ClientConfig = {
|
@@ -33,8 +74,9 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
33
74
|
dashboardServices: {
|
34
75
|
mechanization: {
|
35
76
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Ok<MechanizationVarietyModel[]> | _mobily_ts_belt.Error<Error>>;
|
77
|
+
getMechanizations: ({ kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
36
78
|
};
|
37
79
|
};
|
38
80
|
};
|
39
81
|
|
40
|
-
export { type MechanizationVarietyModel, type MechanizationVarietyVariables, createSDK };
|
82
|
+
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 };
|
package/dist/index.mjs
CHANGED
@@ -50,7 +50,24 @@ var mappers = {
|
|
50
50
|
seasonProcessIds: response.seasonProcessIds,
|
51
51
|
machineUsageIds: response.machineUsageIds
|
52
52
|
}),
|
53
|
-
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety)
|
53
|
+
getMechanizationVarietyList: (response) => response.map(mappers.getMechanizationVariety),
|
54
|
+
getMechanization: (response) => ({
|
55
|
+
id: response.id,
|
56
|
+
commonName: response.commonName,
|
57
|
+
model: response.model,
|
58
|
+
avatarURL: response.avatarURL,
|
59
|
+
manufactureYear: response.manufactureYear,
|
60
|
+
code: response.code,
|
61
|
+
variety: {
|
62
|
+
id: response.id,
|
63
|
+
name: "response.variety.name",
|
64
|
+
iconURL: "response.variety.iconURL",
|
65
|
+
kind: response.variety.kind,
|
66
|
+
seasonProcessIds: [],
|
67
|
+
machineUsageIds: []
|
68
|
+
}
|
69
|
+
}),
|
70
|
+
getMechanizationsList: (response) => response.map(mappers.getMechanization)
|
54
71
|
};
|
55
72
|
|
56
73
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
@@ -72,6 +89,20 @@ var createMechanizationServices = (client) => ({
|
|
72
89
|
console.error("MechanizationVariety API Error:", err);
|
73
90
|
return R.Error(err);
|
74
91
|
}
|
92
|
+
},
|
93
|
+
getMechanizations: async ({ kindName }) => {
|
94
|
+
try {
|
95
|
+
const { data } = await client.get(
|
96
|
+
`/farmers/681f11f87eeba74f9bb8f422/mechanizations?kindName=${kindName}`
|
97
|
+
);
|
98
|
+
return R.Ok(
|
99
|
+
mappers.getMechanizationsList(data.result.data.mechanizations)
|
100
|
+
);
|
101
|
+
} catch (error) {
|
102
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
103
|
+
console.error("Mechanization API Error:", err);
|
104
|
+
return R.Error(err);
|
105
|
+
}
|
75
106
|
}
|
76
107
|
});
|
77
108
|
|