import { DataContainerType } from './'; export declare namespace AppLoaderConfiguration { /** * The base structure for configuration file contains all resources, evnironments and headers * The process options define how this file is processed * * @defaultSnippets { "label": "Default Loader Configuration", "properties": ["applications:json:[{\"key\":\"default\", \"name\":\"My Application\"}]", "resources:json:[{\"url\":\"${baseUrl}/models/my-model.dcupl.json\", \"type\":\"model\"},{\"url\":\"${baseUrl}/data/some-data.json\", \"type\":\"data\", \"model\":\"MyModel\"}]"] } */ export type ProjectConfiguration = { resources: Resource[]; environments?: Environment[]; applications?: ApplicationConfiguration[]; options?: Options; }; type StringOrStringArray = (string | string[])[]; /** * @defaultSnippets { "label": "Application", "properties": ["key", "name", "description", "resourceTags:array"] } */ export type ApplicationConfiguration = { key: string; name?: string; description?: string; resourceTags?: StringOrStringArray; variables?: Variable[]; }; export type ProcessOptions = { applicationKey?: string; environmentKeys?: string[]; resourceTags?: StringOrStringArray; variables?: Variable[]; options?: Options; }; export type FetchOptions = { /** * The base URL to use for all resources * If not set the baseUrl points to the draft version of the CDN */ baseUrl?: string; /** * The name of the loader file to use * If not set the loader file is named 'dcupl.lc.json' */ loaderFileName?: string; /** * Custom Headers used for fetching the loader file * For example authorization headers */ headers?: AppLoaderConfiguration.AppLoaderConfigHeader[]; /** * If set to false the fetched config is not applied to the loader but only returned */ skipApply?: boolean; }; export type Options = { defaultDataContainerUpdateType?: DataContainerType; csvParserOptions?: CsvParserOptions; missingModelHandling?: { autoGenerateProperties?: boolean; }; }; export type CsvParserOptions = { delimiter?: string; quoteChar?: string; escapeChar?: string; commentChar?: string; }; export type TransformerType = 'rawFileTransformer' | 'parsedFileTransformer'; /** * @defaultSnippets { "label": "Environment", "properties": ["key", "description", "variables:array", "headers:array", "queryParams:array"] } */ export type Environment = { key: string; description?: string; variables?: Variable[]; headers?: HttpHeaderConfiguration[]; queryParams?: HttpQueryParamConfiguration[]; }; /** * @defaultSnippets { "label": "Variable", "properties": ["key", "description", "value:string"] } */ export type Variable = { key: T; description?: string; value: string | undefined; }; export type EnvironmentVariableAsObject = Record; /** * @defaultSnippets { "label": "Query Parameter Configuration", "properties": ["key", "description", "value:string", "tags:array"] } */ export type HttpQueryParamConfiguration = { key: string; description?: string; value: string; tags?: string[]; condition?: { applyIfVariableHasValue?: string; }; }; /** * @defaultSnippets { "label": "Header Configuration", "properties": ["key", "description", "value:string", "tags:array"] } */ export type HttpHeaderConfiguration = { key: string; description?: string; value: string; tags?: string[]; condition?: { applyIfVariableHasValue?: string; }; }; export type HttpHeaderAsObject = { [key: string]: string; }; type ResourceType = 'model' | 'data' | 'transformer' | 'operator' | 'script'; type ResourceBase = { key?: string; url: string; type: ResourceType; tags?: string[]; }; /** * A model describes a real world object of your applicatoin like a customer, a product or a sales order. * * @defaultSnippets { "label": "Model", "properties": ["url:string:${baseUrl}/models/my-model.dcupl.json", "type:model", "tags:array"] } */ export type ModelResource = ResourceBase & { type: 'model'; }; /** * A data resource contains data for a model. * * @defaultSnippets { "label": "Data", "properties": ["url:string:${baseUrl}/data/my-data.json", "type:data", "model", "tags:array"] } */ export type DataResource = ResourceBase & { type: 'data'; model: string; options?: DataResourceOptions; }; /** * A transformer resource points to a javascript file that can be used to transform the data of a data resource. * * @defaultSnippets { "label": "Transformer", "properties": ["url:string:${baseUrl}/transformers/my-transformer.js", "type:transformer", "applyTo:array", "tags:array"] } */ export type TransformerResource = ResourceBase & { type: 'transformer'; /** * The tags the transformer applies to */ applyTo?: string[]; /** * The transformer type * rawFileTransformer: The transformer is applied to the raw file * parsedFileTransformer: The transformer is applied to the parsed file * default: rawFileTransformer */ transformerType?: TransformerType; }; /** * A script resource. * * @defaultSnippets { "label": "Query Operator", "properties": ["url:string:${baseUrl}/models/my-operator.js", "type:operator", "operator:my_operator", "tags:array"] } */ export type CustomScriptResource = ResourceBase & { type: 'script'; /** * The operator name that can be used in a query */ scriptKey: string; }; /** * A query operator resource points to a javascript file that defines a custom query operator. * * @defaultSnippets { "label": "Query Operator", "properties": ["url:string:${baseUrl}/models/my-operator.js", "type:operator", "operator:my_operator", "tags:array"] } */ export type CustomOperatorResource = ResourceBase & { type: 'operator'; /** * The operator name that can be used in a query */ operator: string; }; export type DataResourceOptions = { updateType?: DataContainerType; keyProperty?: string; autoGenerateKey?: boolean; autoGenerateProperties?: boolean; csvParserOptions?: CsvParserOptions; }; export type Resource = ModelResource | DataResource | TransformerResource | CustomOperatorResource | CustomScriptResource; export type AppLoaderConfigHeader = { key: string; value: string; }; export {}; } export type FilesApiStatusResponse = { changedAt: number; }; /** * The input type is depending on the resource type (csv/json) and if it's a raw or parsed transformer * Shuld return the transformed data */ export type AppLoaderTransformerFunction = (item: AppLoaderConfiguration.Resource, input: any) => any; export declare namespace AppLoaderProgress { type ResourceItem = AppLoaderConfiguration.Resource & { success?: boolean; status?: number; }; type ProgressItem = { total: number; processed: number; remaining: number; progress: number; context: string; currentItem: ResourceItem; totalItems: ResourceItem[]; processedItems: ResourceItem[]; downloadedItems: ResourceItem[]; failedItems: ResourceItem[]; remainingItems: ResourceItem[]; }; type CallbackFunction = (item: ProgressItem) => void; }