argos/dmp-frontend/src/app/core/model/external-fetcher/external-fetcher.ts

144 lines
3.4 KiB
TypeScript
Raw Normal View History

2024-02-26 18:40:31 +01:00
import { ExternalFetcherApiHTTPMethodType } from "@app/core/common/enum/external-fetcher-api-http-method-type";
import { ReferenceType } from "../reference-type/reference-type";
import { ExternalFetcherSourceType } from "@app/core/common/enum/external-fetcher-source-type";
import { Guid } from "@common/types/guid";
2024-04-16 17:20:43 +02:00
export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherApiSourceConfiguration, ExternalFetcherStaticOptionSourceConfiguration {
2024-02-26 18:40:31 +01:00
type: ExternalFetcherSourceType;
key: string;
label: string;
ordinal: number;
referenceTypeDependencies?: ReferenceType[];
}
2024-04-16 17:20:43 +02:00
export interface ExternalFetcherApiSourceConfiguration {
2024-02-26 18:40:31 +01:00
url: string;
results: ResultsConfiguration;
paginationPath: string;
contentType: string;
firstPage: string;
httpMethod: ExternalFetcherApiHTTPMethodType;
requestBody?: string;
filterType?: string;
auth: AuthenticationConfiguration;
queries?: QueryConfig[];
}
2024-04-16 17:20:43 +02:00
export interface ResultsConfiguration {
2024-02-26 18:40:31 +01:00
resultsArrayPath: string;
fieldsMapping: ResultFieldsMappingConfiguration[];
}
2024-04-16 17:20:43 +02:00
export interface ResultFieldsMappingConfiguration {
2024-02-26 18:40:31 +01:00
code: string;
responsePath: string;
}
2024-04-16 17:20:43 +02:00
export interface AuthenticationConfiguration {
2024-02-26 18:40:31 +01:00
enabled: boolean;
authUrl: string;
authMethod: ExternalFetcherApiHTTPMethodType;
authTokenPath: string;
authRequestBody: string;
type: string;
}
2024-04-16 17:20:43 +02:00
export interface QueryConfig {
2024-02-26 18:40:31 +01:00
name: string;
defaultValue: string;
cases: QueryCaseConfig[];
}
2024-04-16 17:20:43 +02:00
export interface QueryCaseConfig {
2024-02-26 18:40:31 +01:00
likePattern: string,
separator: string;
value: string;
referenceType?: ReferenceType;
referenceTypeSourceKey: string
}
2024-04-16 17:20:43 +02:00
export interface ExternalFetcherStaticOptionSourceConfiguration {
items: Static[];
}
2024-04-16 17:20:43 +02:00
export interface Static {
2024-02-26 18:40:31 +01:00
options: StaticOption[];
}
2024-04-16 17:20:43 +02:00
export interface StaticOption {
2024-02-26 18:40:31 +01:00
code: string;
value: string;
}
//
// Persist
//
2024-04-16 17:20:43 +02:00
export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalFetcherApiSourceConfigurationPersist, ExternalFetcherStaticOptionSourceConfigurationPersist {
2024-02-26 18:40:31 +01:00
type: ExternalFetcherSourceType;
key: string;
label: string;
ordinal: number;
referenceTypeDependencyIds?: Guid[];
}
2024-04-16 17:20:43 +02:00
export interface ExternalFetcherApiSourceConfigurationPersist {
2024-02-26 18:40:31 +01:00
url: string;
results: ResultsConfigurationPersist;
paginationPath: string;
contentType: string;
firstPage: string;
httpMethod: ExternalFetcherApiHTTPMethodType;
requestBody?: string;
filterType?: string;
auth: AuthenticationConfigurationPersist;
queries?: QueryConfigPersist[];
}
2024-04-16 17:20:43 +02:00
export interface ResultsConfigurationPersist {
2024-02-26 18:40:31 +01:00
resultsArrayPath: string;
fieldsMapping: ResultFieldsMappingConfigurationPersist[];
}
2024-04-16 17:20:43 +02:00
export interface ResultFieldsMappingConfigurationPersist {
2024-02-26 18:40:31 +01:00
code: string;
responsePath: string;
}
2024-04-16 17:20:43 +02:00
export interface AuthenticationConfigurationPersist {
2024-02-26 18:40:31 +01:00
enabled: boolean;
authUrl: string;
authMethod: ExternalFetcherApiHTTPMethodType;
authTokenPath: string;
authRequestBody: string;
type: string;
}
2024-04-16 17:20:43 +02:00
export interface QueryConfigPersist {
2024-02-26 18:40:31 +01:00
name: string;
defaultValue: string;
cases: QueryCaseConfigPersist[];
}
2024-04-16 17:20:43 +02:00
export interface QueryCaseConfigPersist {
2024-02-26 18:40:31 +01:00
likePattern: string,
separator: string;
value: string;
referenceTypeId: Guid;
referenceTypeSourceKey: string
}
export interface ExternalFetcherStaticOptionSourceConfigurationPersist {
items: StaticPersist[];
}
2024-04-16 17:20:43 +02:00
export interface StaticPersist {
2024-02-26 18:40:31 +01:00
options: StaticOptionPersist[];
}
2024-04-16 17:20:43 +02:00
export interface StaticOptionPersist {
2024-02-26 18:40:31 +01:00
code: string;
value: string;
}