@agroyaar/sdk 3.4.1 → 3.4.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 +106 -3
- package/dist/index.d.ts +65 -19
- package/dist/index.mjs +106 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -110,7 +110,9 @@ var croppingPatternMapper = {
|
|
|
110
110
|
dailyMinimumTemperatureChange: dto.dailyMinimumTemperatureChange,
|
|
111
111
|
selectedCrops: dto.selectedCrops,
|
|
112
112
|
status: dto.status
|
|
113
|
-
})
|
|
113
|
+
}),
|
|
114
|
+
getAll: (dto) => dto.map(croppingPatternMapper.getOne),
|
|
115
|
+
create: (_dto) => ({})
|
|
114
116
|
};
|
|
115
117
|
|
|
116
118
|
// src/services/dashboard/cropping-pattern/croppingPattern.service.ts
|
|
@@ -141,6 +143,44 @@ var createCroppingPatternServices = (client) => ({
|
|
|
141
143
|
} catch (error) {
|
|
142
144
|
return wrapError(error);
|
|
143
145
|
}
|
|
146
|
+
},
|
|
147
|
+
getAll: async ({
|
|
148
|
+
pathParams
|
|
149
|
+
}) => {
|
|
150
|
+
try {
|
|
151
|
+
const response = await client.typed(
|
|
152
|
+
"get",
|
|
153
|
+
"/farmers/{farmerId}/cropping-patterns",
|
|
154
|
+
{
|
|
155
|
+
pathParams
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
return import_ts_belt2.R.Ok(
|
|
159
|
+
croppingPatternMapper.getAll(response.result.data.croppingPatterns)
|
|
160
|
+
);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
return wrapError(error);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
create: async ({
|
|
166
|
+
body,
|
|
167
|
+
pathParams
|
|
168
|
+
}) => {
|
|
169
|
+
try {
|
|
170
|
+
const response = await client.typed(
|
|
171
|
+
"post",
|
|
172
|
+
"/farmers/{farmerId}/cropping-patterns",
|
|
173
|
+
{
|
|
174
|
+
pathParams,
|
|
175
|
+
body
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
return import_ts_belt2.R.Ok(
|
|
179
|
+
croppingPatternMapper.create(response.result.data.croppingPattern)
|
|
180
|
+
);
|
|
181
|
+
} catch (error) {
|
|
182
|
+
return wrapError(error);
|
|
183
|
+
}
|
|
144
184
|
}
|
|
145
185
|
});
|
|
146
186
|
|
|
@@ -526,7 +566,7 @@ var mechanizationMapper = {
|
|
|
526
566
|
variety: varietiesMapper.getOne(dto.variety)
|
|
527
567
|
}),
|
|
528
568
|
getAll: (dto) => dto.map(mechanizationMapper.getOne),
|
|
529
|
-
create: (
|
|
569
|
+
create: (_dto) => ({})
|
|
530
570
|
};
|
|
531
571
|
|
|
532
572
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
@@ -639,6 +679,67 @@ var createExperimentServices = (client) => ({
|
|
|
639
679
|
}
|
|
640
680
|
});
|
|
641
681
|
|
|
682
|
+
// src/services/dashboard/statics/statics.mapper.ts
|
|
683
|
+
var staticsMappers = {
|
|
684
|
+
getPlantType: (dto) => ({
|
|
685
|
+
id: dto.id,
|
|
686
|
+
label: dto.label,
|
|
687
|
+
name: dto.name
|
|
688
|
+
}),
|
|
689
|
+
getPlantTypes: (dto) => dto.map(staticsMappers.getPlantType)
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
// src/services/dashboard/statics/statics.service.ts
|
|
693
|
+
var import_ts_belt11 = require("@mobily/ts-belt");
|
|
694
|
+
var createStaticsServices = (client) => ({
|
|
695
|
+
getPlantType: async () => {
|
|
696
|
+
try {
|
|
697
|
+
const response = await client.typed("get", "/statics/product-kinds");
|
|
698
|
+
return import_ts_belt11.R.Ok(
|
|
699
|
+
staticsMappers.getPlantTypes(response.result.data.productKinds)
|
|
700
|
+
);
|
|
701
|
+
} catch (error) {
|
|
702
|
+
return wrapError(error);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
// src/services/dashboard/products/products.service.ts
|
|
708
|
+
var import_ts_belt12 = require("@mobily/ts-belt");
|
|
709
|
+
|
|
710
|
+
// src/services/dashboard/products/products.mapper.ts
|
|
711
|
+
var productsMappers = {
|
|
712
|
+
getProduct: (dto) => ({
|
|
713
|
+
id: dto.id,
|
|
714
|
+
name: dto.name,
|
|
715
|
+
persianName: dto.persianName,
|
|
716
|
+
type: dto.type
|
|
717
|
+
}),
|
|
718
|
+
getProducts: (dto) => dto.map(productsMappers.getProduct)
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
// src/services/dashboard/products/products.service.ts
|
|
722
|
+
var createProductsServices = (client) => ({
|
|
723
|
+
getProducts: async ({
|
|
724
|
+
pathParams,
|
|
725
|
+
params
|
|
726
|
+
}) => {
|
|
727
|
+
try {
|
|
728
|
+
const response = await client.typed(
|
|
729
|
+
"get",
|
|
730
|
+
"/farmers/{farmerId}/products",
|
|
731
|
+
{
|
|
732
|
+
pathParams,
|
|
733
|
+
params
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
return import_ts_belt12.R.Ok(productsMappers.getProducts(response.result.data.products));
|
|
737
|
+
} catch (error) {
|
|
738
|
+
return wrapError(error);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
|
|
642
743
|
// src/index.ts
|
|
643
744
|
var createSDK = (config, middlewares = []) => {
|
|
644
745
|
const client = createClient(config, middlewares);
|
|
@@ -652,7 +753,9 @@ var createSDK = (config, middlewares = []) => {
|
|
|
652
753
|
sensors: createSensorsServices(client),
|
|
653
754
|
varieties: createVarietiesService(client),
|
|
654
755
|
experiment: createExperimentServices(client),
|
|
655
|
-
croppingPattern: createCroppingPatternServices(client)
|
|
756
|
+
croppingPattern: createCroppingPatternServices(client),
|
|
757
|
+
statics: createStaticsServices(client),
|
|
758
|
+
products: createProductsServices(client)
|
|
656
759
|
}
|
|
657
760
|
};
|
|
658
761
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4033,7 +4033,7 @@ interface operations {
|
|
|
4033
4033
|
}
|
|
4034
4034
|
|
|
4035
4035
|
type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP" | "CROPPING_PATTERN";
|
|
4036
|
-
type StatusType = "SUBMIT" | "ACTIVE" | "INACTIVE" | "CONFIRMED" | "PAID" | "DRAFT" | "PENDING" | "PROCESSING" | "ARCHIVED" | "COMPLETED" | "PASS_PAYMENT" | "VALID" | "INVALID" | "WRITING" | "REJECTED" | "FAILED" | "SUCCESS" | "DONE" | "VERIFIED" | "UNLOCK" | "LOCK" | "MODIFIED" | "REFUNDED_INVOICE" | "ACTIVE_LABORTORY_FIELD_EXPERIMENT_KIND" | "INACTIVE_LABORTORY_FIELD_EXPERIMENT_KIND" | "VALID_DEVICE_PUSH_TOKEN" | "INVALID_DEVICE_PUSH_TOKEN" | "DRAFT_MISSION" | "APPROVED_MISSION" | "REJECTED_MISSION" | "CANCELED_MISSION" | "COMPLETED_MISSION" | "IN_PROGRESS_MISSION" | "AWAITING_START_MISSION" | "AWAITING_APPROVAL_MISSION" | "AWAITING_REVIEW_DATA_MISSION" | "AWAITING_SAMPLE_DELIVERY_LABORATORY_MISSION" | "COMPLETED_REQUEST" | "AWAITING_SEND_REQUEST" | "AWAITING_REVIEW_REQUEST" | "AWAITING_PAYMENT_REQUEST" | "AWAITING_REVIEW_OFFER" | "AWAITING_COLLEAGUE_APPROVAL_REQUEST" | "AWAITING_MISSION_COMPLETION_REQUEST" | "AWAITING_PURCHASE_REQUEST" | "AWAITING_REVIEW_MISSION_DATA_REQUEST" | "REJECTED_REGISTRATION" | "REJECTED_MODIFICATION" | "REJECTED_ACTIVATION" | "CONFIRMED_ACTIVATION" | "CONFIRMED_REGISTRATION" | "AWAITING_REVIEW_ACTIVATION" | "AWAITING_SUBMIT_ACTIVATION" | "AWAITING_REVIEW_REGISTRATION" | "AWAITING_REVIEW_MODIFICATION" | "APPROVED_EXPERIMENT_ANALYSIS_REQUEST" | "REJECTED_EXPERIMENT_ANALYSIS_REQUEST" | "CANCELED_EXPERIMENT_ANALYSIS_REQUEST" | "COMPLETED_EXPERIMENT_ANALYSIS_REQUEST" | "IN_PROGRESS_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_START_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_APPROVAL_EXPERIMENT_ANALYSIS_REQUEST" | "DRAFT_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_REVIEW_INQUIRY" | "COMPLETED_REGISTRATION" | "CANCELED_REQUEST" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "APPROVED_RESIDENT_LEADING_EXPERT" | "REJECTED_RESIDENT_LEADING_EXPERT" | "AWAITING_SIGNING_CONTRACT" | "ACTIVE_LEADING_EXPERT" | "FAILED_CHARGE_WALLET_TRANSACTION" | "VERIFIED_CHARGE_WALLET_TRANSACTION" | "SUCCESS_PAYMENT_WALLET_TRANSACTION" | "SUCCESS_REFUND_WALLET_TRANSACTION" | "AWAITING_VERIFICATION_CHARGE_WALLET_TRANSACTION";
|
|
4036
|
+
type StatusType = "SUBMIT" | "ACTIVE" | "INACTIVE" | "CONFIRMED" | "PAID" | "DRAFT" | "PENDING" | "PROCESSING" | "ARCHIVED" | "COMPLETED" | "PASS_PAYMENT" | "VALID" | "INVALID" | "WRITING" | "REJECTED" | "FAILED" | "SUCCESS" | "DONE" | "VERIFIED" | "UNLOCK" | "LOCK" | "MODIFIED" | "REFUNDED_INVOICE" | "ACTIVE_LABORTORY_FIELD_EXPERIMENT_KIND" | "INACTIVE_LABORTORY_FIELD_EXPERIMENT_KIND" | "VALID_DEVICE_PUSH_TOKEN" | "INVALID_DEVICE_PUSH_TOKEN" | "DRAFT_MISSION" | "APPROVED_MISSION" | "REJECTED_MISSION" | "CANCELED_MISSION" | "COMPLETED_MISSION" | "IN_PROGRESS_MISSION" | "AWAITING_START_MISSION" | "AWAITING_APPROVAL_MISSION" | "AWAITING_REVIEW_DATA_MISSION" | "AWAITING_SAMPLE_DELIVERY_LABORATORY_MISSION" | "COMPLETED_REQUEST" | "AWAITING_SEND_REQUEST" | "AWAITING_REVIEW_REQUEST" | "AWAITING_PAYMENT_REQUEST" | "AWAITING_REVIEW_OFFER" | "AWAITING_COLLEAGUE_APPROVAL_REQUEST" | "AWAITING_MISSION_COMPLETION_REQUEST" | "AWAITING_PURCHASE_REQUEST" | "AWAITING_REVIEW_MISSION_DATA_REQUEST" | "REJECTED_REGISTRATION" | "REJECTED_MODIFICATION" | "REJECTED_ACTIVATION" | "CONFIRMED_ACTIVATION" | "CONFIRMED_REGISTRATION" | "AWAITING_REVIEW_ACTIVATION" | "AWAITING_SUBMIT_ACTIVATION" | "AWAITING_REVIEW_REGISTRATION" | "AWAITING_REVIEW_MODIFICATION" | "APPROVED_EXPERIMENT_ANALYSIS_REQUEST" | "REJECTED_EXPERIMENT_ANALYSIS_REQUEST" | "CANCELED_EXPERIMENT_ANALYSIS_REQUEST" | "COMPLETED_EXPERIMENT_ANALYSIS_REQUEST" | "IN_PROGRESS_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_START_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_APPROVAL_EXPERIMENT_ANALYSIS_REQUEST" | "DRAFT_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_REVIEW_INQUIRY" | "COMPLETED_REGISTRATION" | "CANCELED_REQUEST" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "APPROVED_RESIDENT_LEADING_EXPERT" | "REJECTED_RESIDENT_LEADING_EXPERT" | "AWAITING_SIGNING_CONTRACT" | "ACTIVE_LEADING_EXPERT" | "FAILED_CHARGE_WALLET_TRANSACTION" | "VERIFIED_CHARGE_WALLET_TRANSACTION" | "SUCCESS_PAYMENT_WALLET_TRANSACTION" | "SUCCESS_REFUND_WALLET_TRANSACTION" | "AWAITING_VERIFICATION_CHARGE_WALLET_TRANSACTION" | "AWAITNG_APPROVAL_ORGANIZATION_MEMBERSHIP_REQUEST" | "APPROVED_ORGANIZATION_MEMBERSHIP_REQUEST" | "REJECTED_ORGANIZATION_MEMBERSHIP_REQUEST";
|
|
4037
4037
|
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";
|
|
4038
4038
|
type MechanizationType = "MOTORIZED" | "NON_MOTORIZED";
|
|
4039
4039
|
type MechanizationSeasonProcessType = "GROWING" | "HARVESTING" | "PLANTING" | "TRANSPORTATION";
|
|
@@ -4370,6 +4370,17 @@ type CroppingPatternModel = {
|
|
|
4370
4370
|
selectedCrops: Product[];
|
|
4371
4371
|
status: Status;
|
|
4372
4372
|
};
|
|
4373
|
+
type PlantTypeModel = {
|
|
4374
|
+
id: string;
|
|
4375
|
+
label: string;
|
|
4376
|
+
name: "FARM" | "ORCHARD";
|
|
4377
|
+
};
|
|
4378
|
+
type ProductModel = {
|
|
4379
|
+
id: string;
|
|
4380
|
+
name: string;
|
|
4381
|
+
persianName: string;
|
|
4382
|
+
type: "FARM" | "ORCHARD";
|
|
4383
|
+
};
|
|
4373
4384
|
|
|
4374
4385
|
type CreateVerifyPhoneNumberBody = paths["/auth/verify-phone-number"]["post"]["requestBody"]["content"]["application/json"];
|
|
4375
4386
|
type AuthType = ApiRequestType<{
|
|
@@ -4482,6 +4493,41 @@ type SensorType = ApiRequestType<{
|
|
|
4482
4493
|
};
|
|
4483
4494
|
}>;
|
|
4484
4495
|
|
|
4496
|
+
type GetOneCroppingPatternParams = paths["/farmers/{farmerId}/cropping-patterns/{croppingPatternId}"]["get"]["parameters"]["path"];
|
|
4497
|
+
type GetAllListCroppingPatternParams = paths["/farmers/{farmerId}/cropping-patterns"]["get"]["parameters"]["path"];
|
|
4498
|
+
type CreateCroppingPatternBody = paths["/farmers/{farmerId}/cropping-patterns"]["post"]["requestBody"]["content"]["application/json"];
|
|
4499
|
+
type CreateCroppingPatternParams = paths["/farmers/{farmerId}/cropping-patterns"]["post"]["parameters"];
|
|
4500
|
+
type CroppingPatternTypes = ApiRequestType<{
|
|
4501
|
+
croppingPattern: components["schemas"]["CroppingPattern"];
|
|
4502
|
+
}, {
|
|
4503
|
+
getOne: {
|
|
4504
|
+
pathParams: NonNullable<GetOneCroppingPatternParams>;
|
|
4505
|
+
};
|
|
4506
|
+
getAll: {
|
|
4507
|
+
pathParams: NonNullable<GetAllListCroppingPatternParams>;
|
|
4508
|
+
};
|
|
4509
|
+
create: {
|
|
4510
|
+
body: CreateCroppingPatternBody;
|
|
4511
|
+
pathParams: NonNullable<CreateCroppingPatternParams["path"]>;
|
|
4512
|
+
};
|
|
4513
|
+
}>;
|
|
4514
|
+
|
|
4515
|
+
type GetExperimentParams = paths["/farmers/{farmerId}/experiments/results"]["get"]["parameters"];
|
|
4516
|
+
type GetExperimentWithMeta = paths["/farmers/{farmerId}/experiments/results"]["get"]["responses"]["200"]["content"]["application/json"]["result"]["data"];
|
|
4517
|
+
type ExperimentsType = ApiRequestType<{
|
|
4518
|
+
experiment: components["schemas"]["Experiment"];
|
|
4519
|
+
experimentWithMeta: GetExperimentWithMeta;
|
|
4520
|
+
}, {
|
|
4521
|
+
getExperiments: {
|
|
4522
|
+
params: GetExperimentParams["query"];
|
|
4523
|
+
pathParams: GetExperimentParams["path"];
|
|
4524
|
+
};
|
|
4525
|
+
}>;
|
|
4526
|
+
|
|
4527
|
+
type StaticsTypes = ApiRequestType<{
|
|
4528
|
+
plantType: components["schemas"]["ProductKind"];
|
|
4529
|
+
}, {}>;
|
|
4530
|
+
|
|
4485
4531
|
type Parameters$1 = {
|
|
4486
4532
|
params?: Record<string, unknown>;
|
|
4487
4533
|
pathParams?: Record<string, unknown>;
|
|
@@ -4500,26 +4546,18 @@ declare namespace ApiTypes {
|
|
|
4500
4546
|
type SeasonsProcess = SeasonsProcessType;
|
|
4501
4547
|
type Sensor = SensorType;
|
|
4502
4548
|
type CroppingPattern = CroppingPatternTypes;
|
|
4549
|
+
type Experiments = ExperimentsType;
|
|
4550
|
+
type Statics = StaticsTypes;
|
|
4551
|
+
type Products = ProductsTypes;
|
|
4503
4552
|
}
|
|
4504
4553
|
|
|
4505
|
-
type
|
|
4506
|
-
type
|
|
4507
|
-
|
|
4508
|
-
}, {
|
|
4509
|
-
getOne: {
|
|
4510
|
-
pathParams: NonNullable<GetOneCroppingPatternParams>;
|
|
4511
|
-
};
|
|
4512
|
-
}>;
|
|
4513
|
-
|
|
4514
|
-
type GetExperimentParams = paths["/farmers/{farmerId}/experiments/results"]["get"]["parameters"];
|
|
4515
|
-
type GetExperimentWithMeta = paths["/farmers/{farmerId}/experiments/results"]["get"]["responses"]["200"]["content"]["application/json"]["result"]["data"];
|
|
4516
|
-
type ExperimentsType = ApiRequestType<{
|
|
4517
|
-
experiment: components["schemas"]["Experiment"];
|
|
4518
|
-
experimentWithMeta: GetExperimentWithMeta;
|
|
4554
|
+
type GetProductsParams = paths["/farmers/{farmerId}/products"]["get"]["parameters"];
|
|
4555
|
+
type ProductsTypes = ApiRequestType<{
|
|
4556
|
+
products: components["schemas"]["Product"];
|
|
4519
4557
|
}, {
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4558
|
+
getProducts: {
|
|
4559
|
+
pathParams: NonNullable<GetProductsParams["path"]>;
|
|
4560
|
+
params: NonNullable<GetProductsParams["query"]>;
|
|
4523
4561
|
};
|
|
4524
4562
|
}>;
|
|
4525
4563
|
|
|
@@ -4611,8 +4649,16 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
4611
4649
|
};
|
|
4612
4650
|
croppingPattern: {
|
|
4613
4651
|
getOne: ({ pathParams, }: CroppingPatternTypes["RequestParams"]["getOne"]) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<CroppingPatternModel>>;
|
|
4652
|
+
getAll: ({ pathParams, }: CroppingPatternTypes["RequestParams"]["getAll"]) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<CroppingPatternModel[]>>;
|
|
4653
|
+
create: ({ body, pathParams, }: CroppingPatternTypes["RequestParams"]["create"]) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<unknown>>;
|
|
4654
|
+
};
|
|
4655
|
+
statics: {
|
|
4656
|
+
getPlantType: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<PlantTypeModel[]>>;
|
|
4657
|
+
};
|
|
4658
|
+
products: {
|
|
4659
|
+
getProducts: ({ pathParams, params }: ProductsTypes["RequestParams"]["getProducts"]) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<ProductModel[]>>;
|
|
4614
4660
|
};
|
|
4615
4661
|
};
|
|
4616
4662
|
};
|
|
4617
4663
|
|
|
4618
|
-
export { type AnnuallyChartReportModel, type ApiRequestType, ApiTypes, type City, type CroppingPatternModel, type CroppingPatternReportModel, type CroppingPatternRiskChartModel, type DayOfYearChartReportModel, type DeviceCodeModel, type Experiment, type ExperimentModel, type ExperimentModelWithMeta, type ExperimentParameters, type ExperimentsModel, type Farm, type Farmer, Identifiers, type Invoice, type IrrigationSource, type Location, type MechanizationFuelConsumptionChangesModel, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesModelWithMeta, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationTemperatureChangesModel, type MechanizationType, type MechanizationVarietyModel, type MotorizedMechanizationSensorsModel, type MovementChangeModel, type OwnershipType, type Product, type ProductKind, type ProductKindType, type Province, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type Status, type StatusType, type TaskType, type TrackingDeviceCodeModel, type UnavailableExperimentParameters, type VarietyKind, type VerifyPhoneNumberModel, type WeatherStation, type WeatherStationAlertPhoneNumber, createSDK };
|
|
4664
|
+
export { type AnnuallyChartReportModel, type ApiRequestType, ApiTypes, type City, type CroppingPatternModel, type CroppingPatternReportModel, type CroppingPatternRiskChartModel, type DayOfYearChartReportModel, type DeviceCodeModel, type Experiment, type ExperimentModel, type ExperimentModelWithMeta, type ExperimentParameters, type ExperimentsModel, type Farm, type Farmer, Identifiers, type Invoice, type IrrigationSource, type Location, type MechanizationFuelConsumptionChangesModel, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesModelWithMeta, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationTemperatureChangesModel, type MechanizationType, type MechanizationVarietyModel, type MotorizedMechanizationSensorsModel, type MovementChangeModel, type OwnershipType, type PlantTypeModel, type Product, type ProductKind, type ProductKindType, type ProductModel, type Province, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type Status, type StatusType, type TaskType, type TrackingDeviceCodeModel, type UnavailableExperimentParameters, type VarietyKind, type VerifyPhoneNumberModel, type WeatherStation, type WeatherStationAlertPhoneNumber, createSDK };
|
package/dist/index.mjs
CHANGED
|
@@ -74,7 +74,9 @@ var croppingPatternMapper = {
|
|
|
74
74
|
dailyMinimumTemperatureChange: dto.dailyMinimumTemperatureChange,
|
|
75
75
|
selectedCrops: dto.selectedCrops,
|
|
76
76
|
status: dto.status
|
|
77
|
-
})
|
|
77
|
+
}),
|
|
78
|
+
getAll: (dto) => dto.map(croppingPatternMapper.getOne),
|
|
79
|
+
create: (_dto) => ({})
|
|
78
80
|
};
|
|
79
81
|
|
|
80
82
|
// src/services/dashboard/cropping-pattern/croppingPattern.service.ts
|
|
@@ -105,6 +107,44 @@ var createCroppingPatternServices = (client) => ({
|
|
|
105
107
|
} catch (error) {
|
|
106
108
|
return wrapError(error);
|
|
107
109
|
}
|
|
110
|
+
},
|
|
111
|
+
getAll: async ({
|
|
112
|
+
pathParams
|
|
113
|
+
}) => {
|
|
114
|
+
try {
|
|
115
|
+
const response = await client.typed(
|
|
116
|
+
"get",
|
|
117
|
+
"/farmers/{farmerId}/cropping-patterns",
|
|
118
|
+
{
|
|
119
|
+
pathParams
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
return R2.Ok(
|
|
123
|
+
croppingPatternMapper.getAll(response.result.data.croppingPatterns)
|
|
124
|
+
);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
return wrapError(error);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
create: async ({
|
|
130
|
+
body,
|
|
131
|
+
pathParams
|
|
132
|
+
}) => {
|
|
133
|
+
try {
|
|
134
|
+
const response = await client.typed(
|
|
135
|
+
"post",
|
|
136
|
+
"/farmers/{farmerId}/cropping-patterns",
|
|
137
|
+
{
|
|
138
|
+
pathParams,
|
|
139
|
+
body
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
return R2.Ok(
|
|
143
|
+
croppingPatternMapper.create(response.result.data.croppingPattern)
|
|
144
|
+
);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
return wrapError(error);
|
|
147
|
+
}
|
|
108
148
|
}
|
|
109
149
|
});
|
|
110
150
|
|
|
@@ -490,7 +530,7 @@ var mechanizationMapper = {
|
|
|
490
530
|
variety: varietiesMapper.getOne(dto.variety)
|
|
491
531
|
}),
|
|
492
532
|
getAll: (dto) => dto.map(mechanizationMapper.getOne),
|
|
493
|
-
create: (
|
|
533
|
+
create: (_dto) => ({})
|
|
494
534
|
};
|
|
495
535
|
|
|
496
536
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
@@ -603,6 +643,67 @@ var createExperimentServices = (client) => ({
|
|
|
603
643
|
}
|
|
604
644
|
});
|
|
605
645
|
|
|
646
|
+
// src/services/dashboard/statics/statics.mapper.ts
|
|
647
|
+
var staticsMappers = {
|
|
648
|
+
getPlantType: (dto) => ({
|
|
649
|
+
id: dto.id,
|
|
650
|
+
label: dto.label,
|
|
651
|
+
name: dto.name
|
|
652
|
+
}),
|
|
653
|
+
getPlantTypes: (dto) => dto.map(staticsMappers.getPlantType)
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
// src/services/dashboard/statics/statics.service.ts
|
|
657
|
+
import { R as R11 } from "@mobily/ts-belt";
|
|
658
|
+
var createStaticsServices = (client) => ({
|
|
659
|
+
getPlantType: async () => {
|
|
660
|
+
try {
|
|
661
|
+
const response = await client.typed("get", "/statics/product-kinds");
|
|
662
|
+
return R11.Ok(
|
|
663
|
+
staticsMappers.getPlantTypes(response.result.data.productKinds)
|
|
664
|
+
);
|
|
665
|
+
} catch (error) {
|
|
666
|
+
return wrapError(error);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
// src/services/dashboard/products/products.service.ts
|
|
672
|
+
import { R as R12 } from "@mobily/ts-belt";
|
|
673
|
+
|
|
674
|
+
// src/services/dashboard/products/products.mapper.ts
|
|
675
|
+
var productsMappers = {
|
|
676
|
+
getProduct: (dto) => ({
|
|
677
|
+
id: dto.id,
|
|
678
|
+
name: dto.name,
|
|
679
|
+
persianName: dto.persianName,
|
|
680
|
+
type: dto.type
|
|
681
|
+
}),
|
|
682
|
+
getProducts: (dto) => dto.map(productsMappers.getProduct)
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// src/services/dashboard/products/products.service.ts
|
|
686
|
+
var createProductsServices = (client) => ({
|
|
687
|
+
getProducts: async ({
|
|
688
|
+
pathParams,
|
|
689
|
+
params
|
|
690
|
+
}) => {
|
|
691
|
+
try {
|
|
692
|
+
const response = await client.typed(
|
|
693
|
+
"get",
|
|
694
|
+
"/farmers/{farmerId}/products",
|
|
695
|
+
{
|
|
696
|
+
pathParams,
|
|
697
|
+
params
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
return R12.Ok(productsMappers.getProducts(response.result.data.products));
|
|
701
|
+
} catch (error) {
|
|
702
|
+
return wrapError(error);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
|
|
606
707
|
// src/index.ts
|
|
607
708
|
var createSDK = (config, middlewares = []) => {
|
|
608
709
|
const client = createClient(config, middlewares);
|
|
@@ -616,7 +717,9 @@ var createSDK = (config, middlewares = []) => {
|
|
|
616
717
|
sensors: createSensorsServices(client),
|
|
617
718
|
varieties: createVarietiesService(client),
|
|
618
719
|
experiment: createExperimentServices(client),
|
|
619
|
-
croppingPattern: createCroppingPatternServices(client)
|
|
720
|
+
croppingPattern: createCroppingPatternServices(client),
|
|
721
|
+
statics: createStaticsServices(client),
|
|
722
|
+
products: createProductsServices(client)
|
|
620
723
|
}
|
|
621
724
|
};
|
|
622
725
|
};
|