@veeroute/lss-agro-angular
v7.38.3336
Published
OpenAPI client for @veeroute/lss-agro-angular
Readme
@veeroute/[email protected]
Programming interface for Veeroute Agro. # Description The service is designed to compute the work plan of production facilities. ## General schema ### Field - produces a specific agricultural crop with a specific moisture level - crop output from the field can be moved only to an Elevator or a Plant ### Elevator (Threshing floor) - consists of Gates, Dryers, short-term and long-term storage locations - dries the grain (if the crop moisture is above the allowed level) - stores dry grain in short-term storage locations (warehouses); unloading and loading of grain within a single day is allowed - stores dry grain in long-term storage locations (sleeves, trenches, mounds) - only one type of crop can be stored in a single storage at a time - sells surplus grain to the Market - production processes inside the facility: drying, loading/unloading to a storage location, storage ### Plant - consists of Gates, Dryers, Bunkers, Consumers - [if drying is present] dries the grain (if the crop moisture is above the allowed level) - stores dry grain in Bunkers (short-term storage tied to a specific crop) - maintains a minimum stock of grain in Bunkers for consumption - consumes grain from Bunkers - buys missing grain from the Market - production processes inside the facility: drying, loading/unloading to a storage location, storage, consumption ### Market - buys grain from Elevators - sells grain to Plants ## Project A project reflects the planned sequence of operations on agricultural crops; the operation types are described below. ### HARVEST Harvesting of an agricultural crop: - between production facilities (a Field and an Elevator or a Plant) - the operation occurs within a single day - grain moisture is determined at the Field | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|--------------------------------| | Source | Field | - | | Destination | Elevator or Plant | Gates | ### DRY Drying of a crop: - inside a production facility (Elevator or Plant) - duration of the operation — one day - during drying both the mass and the moisture type change (WET -> DRY) - the source specifies the mass of the wet crop - the destination specifies the resulting mass of the dry crop | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|--------------------------------| | Source | Elevator or Plant | Gates | | Destination | Elevator or Plant | Dryer | ### LOAD Loading of a crop from the Gates into a Storage location (long-term, short-term, bunker): - between parts of the same production facility (Elevator or Plant) - the operation occurs within a single day | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|-----------------------------------------------------------| | Source | Elevator or Plant | Gates or Dryer | | Destination | Elevator or Plant | Storage location (long-term, short-term, bunker) | ### UNLOAD Unloading of a crop from a storage location to the Gates: - between parts of the same production facility (Elevator) - the operation occurs within a single day | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|----------------------------------------------------------------------| | Source | Elevator | Storage location (long-term, short-term, bunker) or Dryer | | Destination | Elevator | Gates | ### STORE Crop storage: - the storage location does not change - duration of the operation — one day - the operation occurs overnight | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|-----------------------------------------------------------| | Source | Elevator or Plant | Storage location (long-term, short-term, bunker) | | Destination | Elevator or Plant | The same storage location | ### RELOCATE Transport between production facilities: - between production facilities (Elevator and Plant) - the operation occurs within a single day | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|--------------------------------| | Source | Elevator | Gates | | Destination | Plant | Gates | ### CONSUMPTION Consumption of a crop by the plant: - between parts of the same production facility (Plant) - the operation occurs within a single day - consumption goes from a Bunker - additionally we can consume directly from the Gates or the Dryer without storing in a Bunker | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|--------------------------------| | Source | Plant | Bunker or Gates or Dryer | | Destination | Plant | Consumer | ### SELL Sale of a crop: - between production facilities (Elevator and Market) - the operation occurs within a single day | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|--------------------------------| | Source | Elevator | Gates | | Destination | Market | Contract | ### BUY Purchase of a crop: - between production facilities (Market and Plant) - the operation occurs within a single day | | Object (target_key) | Sub-object (target_detail_key) | |--------------------------|----------------------|--------------------------------| | Source | Market | Contract | | Destination | Plant | Gates | ## Entity diagram
The version of the OpenAPI document: 7.38.3336
Building
To install the required dependencies and to build the typescript sources run:
npm install
npm run buildPublishing
First build the package then run npm publish dist (don't forget to specify the dist folder!)
Consuming
Navigate to the folder of your consuming project and run one of next commands.
published:
npm install @veeroute/[email protected] --savewithout publishing (not recommended):
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --saveIt's important to take the tgz file, otherwise you'll get trouble with links on windows
using npm link:
In PATH_TO_GENERATED_PACKAGE/dist:
npm linkIn your project:
npm link @veeroute/lss-agro-angularNote for Windows users: The Angular CLI has troubles to use linked npm packages. Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. Published packages are not effected by this issue.
General usage
In your Angular project:
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '@veeroute/lss-agro-angular';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideApi()
],
};NOTE
If you're still using AppModule and haven't migrated yet, you can still import an Angular module:
import { LssAgroApiModule } from '@veeroute/lss-agro-angular';If different from the generated base path, during app bootstrap, you can provide the base path to your service.
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '@veeroute/lss-agro-angular';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideApi('http://localhost:9999')
],
};// with a custom configuration
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '@veeroute/lss-agro-angular';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideApi({
withCredentials: true,
username: 'user',
password: 'password'
})
],
};// with factory building a custom configuration
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi, Configuration } from '@veeroute/lss-agro-angular';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration({
basePath: 'http://localhost:9999',
withCredentials: true,
username: authService.getUsername(),
password: authService.getPassword(),
}),
deps: [AuthService],
multi: false
}
],
};Using multiple OpenAPI files / APIs
In order to use multiple APIs generated from different OpenAPI files, you can create an alias name when importing the modules in order to avoid naming conflicts:
import { provideApi as provideUserApi } from 'my-user-api-path';
import { provideApi as provideAdminApi } from 'my-admin-api-path';
import { HttpClientModule } from '@angular/common/http';
import { environment } from '../environments/environment';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideUserApi(environment.basePath),
provideAdminApi(environment.basePath),
],
};Customizing path parameter encoding
Without further customization, only path-parameters of style 'simple' and Dates for format 'date-time' are encoded correctly.
Other styles (e.g. "matrix") are not that easy to encode and thus are best delegated to other libraries (e.g.: @honoluluhenk/http-param-expander).
To implement your own parameter encoding (or call another library),
pass an arrow-function or method-reference to the encodeParam property of the Configuration-object
(see General Usage above).
Example value for use in your Configuration-Provider:
new Configuration({
encodeParam: (param: Param) => myFancyParamEncoder(param),
})