@epistola.app/valtimo-plugin 0.0.1
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/fesm2022/epistola.app-valtimo-plugin.mjs +1393 -0
- package/dist/fesm2022/epistola.app-valtimo-plugin.mjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/lib/assets/epistola-logo.d.ts +1 -0
- package/dist/lib/assets/index.d.ts +1 -0
- package/dist/lib/components/check-job-status-configuration/check-job-status-configuration.component.d.ts +25 -0
- package/dist/lib/components/data-mapping-tree/data-mapping-tree.component.d.ts +33 -0
- package/dist/lib/components/download-document-configuration/download-document-configuration.component.d.ts +25 -0
- package/dist/lib/components/epistola-configuration/epistola-configuration.component.d.ts +29 -0
- package/dist/lib/components/epistola-download/epistola-download.component.d.ts +24 -0
- package/dist/lib/components/epistola-download/epistola-download.formio.d.ts +4 -0
- package/dist/lib/components/field-tree/field-tree.component.d.ts +75 -0
- package/dist/lib/components/generate-document-configuration/generate-document-configuration.component.d.ts +78 -0
- package/dist/lib/epistola.module.d.ts +17 -0
- package/dist/lib/epistola.specification.d.ts +3 -0
- package/dist/lib/models/config.d.ts +49 -0
- package/dist/lib/models/index.d.ts +2 -0
- package/dist/lib/models/template.d.ts +63 -0
- package/dist/lib/services/epistola-plugin.service.d.ts +42 -0
- package/dist/lib/services/index.d.ts +1 -0
- package/dist/public_api.d.ts +12 -0
- package/ng-package.json +17 -0
- package/package.json +38 -0
- package/src/lib/assets/epistola-logo.ts +4 -0
- package/src/lib/assets/index.ts +1 -0
- package/src/lib/components/check-job-status-configuration/check-job-status-configuration.component.html +51 -0
- package/src/lib/components/check-job-status-configuration/check-job-status-configuration.component.scss +1 -0
- package/src/lib/components/check-job-status-configuration/check-job-status-configuration.component.ts +71 -0
- package/src/lib/components/data-mapping-tree/data-mapping-tree.component.html +23 -0
- package/src/lib/components/data-mapping-tree/data-mapping-tree.component.scss +38 -0
- package/src/lib/components/data-mapping-tree/data-mapping-tree.component.ts +124 -0
- package/src/lib/components/download-document-configuration/download-document-configuration.component.html +29 -0
- package/src/lib/components/download-document-configuration/download-document-configuration.component.scss +1 -0
- package/src/lib/components/download-document-configuration/download-document-configuration.component.ts +71 -0
- package/src/lib/components/epistola-configuration/epistola-configuration.component.html +74 -0
- package/src/lib/components/epistola-configuration/epistola-configuration.component.scss +1 -0
- package/src/lib/components/epistola-configuration/epistola-configuration.component.ts +96 -0
- package/src/lib/components/epistola-download/epistola-download.component.ts +79 -0
- package/src/lib/components/epistola-download/epistola-download.formio.ts +19 -0
- package/src/lib/components/field-tree/field-tree.component.html +192 -0
- package/src/lib/components/field-tree/field-tree.component.scss +255 -0
- package/src/lib/components/field-tree/field-tree.component.ts +321 -0
- package/src/lib/components/generate-document-configuration/generate-document-configuration.component.html +182 -0
- package/src/lib/components/generate-document-configuration/generate-document-configuration.component.scss +150 -0
- package/src/lib/components/generate-document-configuration/generate-document-configuration.component.ts +422 -0
- package/src/lib/epistola.module.ts +50 -0
- package/src/lib/epistola.specification.ts +208 -0
- package/src/lib/models/config.ts +53 -0
- package/src/lib/models/index.ts +2 -0
- package/src/lib/models/template.ts +70 -0
- package/src/lib/services/epistola-plugin.service.ts +82 -0
- package/src/lib/services/index.ts +1 -0
- package/src/public_api.ts +16 -0
- package/tsconfig.lib.json +21 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { FunctionConfigurationComponent, PluginConfigurationData } from '@valtimo/plugin';
|
|
3
|
+
import { FormOutput, SelectItem } from '@valtimo/components';
|
|
4
|
+
import { CaseManagementParams, ManagementContext } from '@valtimo/shared';
|
|
5
|
+
import { ProcessLinkStateService } from '@valtimo/process-link';
|
|
6
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
7
|
+
import { GenerateDocumentConfig, TemplateField } from '../../models';
|
|
8
|
+
import { EpistolaPluginService } from '../../services';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export type VariantSelectionMode = 'explicit' | 'attributes';
|
|
11
|
+
export declare class GenerateDocumentConfigurationComponent implements FunctionConfigurationComponent, OnInit, OnDestroy {
|
|
12
|
+
private readonly epistolaPluginService;
|
|
13
|
+
private readonly processLinkStateService;
|
|
14
|
+
save$: Observable<void>;
|
|
15
|
+
disabled$: Observable<boolean>;
|
|
16
|
+
pluginId: string;
|
|
17
|
+
prefillConfiguration$: Observable<GenerateDocumentConfig>;
|
|
18
|
+
selectedPluginConfigurationData$?: Observable<PluginConfigurationData>;
|
|
19
|
+
context$?: Observable<[ManagementContext, CaseManagementParams]>;
|
|
20
|
+
valid: EventEmitter<boolean>;
|
|
21
|
+
configuration: EventEmitter<GenerateDocumentConfig>;
|
|
22
|
+
templateOptions$: BehaviorSubject<SelectItem[]>;
|
|
23
|
+
templatesLoading$: BehaviorSubject<boolean>;
|
|
24
|
+
variantOptions$: BehaviorSubject<SelectItem[]>;
|
|
25
|
+
variantsLoading$: BehaviorSubject<boolean>;
|
|
26
|
+
environmentOptions$: BehaviorSubject<SelectItem[]>;
|
|
27
|
+
environmentsLoading$: BehaviorSubject<boolean>;
|
|
28
|
+
templateFields$: BehaviorSubject<TemplateField[]>;
|
|
29
|
+
templateFieldsLoading$: BehaviorSubject<boolean>;
|
|
30
|
+
dataMapping$: BehaviorSubject<Record<string, any>>;
|
|
31
|
+
prefillDataMapping$: Observable<Record<string, any>>;
|
|
32
|
+
outputFormatOptions: SelectItem[];
|
|
33
|
+
readonly selectedTemplateId$: BehaviorSubject<string>;
|
|
34
|
+
readonly selectedVariantId$: BehaviorSubject<string>;
|
|
35
|
+
variantSelectionMode: VariantSelectionMode;
|
|
36
|
+
variantAttributeEntries: {
|
|
37
|
+
key: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}[];
|
|
40
|
+
caseDefinitionKey: string | null;
|
|
41
|
+
processVariables: string[];
|
|
42
|
+
requiredFieldsStatus: {
|
|
43
|
+
mapped: number;
|
|
44
|
+
total: number;
|
|
45
|
+
};
|
|
46
|
+
private readonly destroy$;
|
|
47
|
+
private saveSubscription;
|
|
48
|
+
private readonly formValue$;
|
|
49
|
+
private readonly valid$;
|
|
50
|
+
private pluginConfigurationId$;
|
|
51
|
+
constructor(epistolaPluginService: EpistolaPluginService, processLinkStateService: ProcessLinkStateService);
|
|
52
|
+
ngOnInit(): void;
|
|
53
|
+
ngOnDestroy(): void;
|
|
54
|
+
formValueChange(formOutput: FormOutput): void;
|
|
55
|
+
onDataMappingChange(mapping: Record<string, any>): void;
|
|
56
|
+
onRequiredFieldsStatusChange(status: {
|
|
57
|
+
mapped: number;
|
|
58
|
+
total: number;
|
|
59
|
+
}): void;
|
|
60
|
+
onVariantSelectionModeChange(mode: VariantSelectionMode): void;
|
|
61
|
+
addAttributeEntry(): void;
|
|
62
|
+
removeAttributeEntry(index: number): void;
|
|
63
|
+
onAttributeEntryChange(): void;
|
|
64
|
+
private revalidate;
|
|
65
|
+
private formatAttributes;
|
|
66
|
+
private initContext;
|
|
67
|
+
private initPrefillDataMapping;
|
|
68
|
+
private initPluginConfiguration;
|
|
69
|
+
private initTemplatesLoading;
|
|
70
|
+
private initEnvironmentsLoading;
|
|
71
|
+
private initVariantsLoading;
|
|
72
|
+
private initTemplateFieldsLoading;
|
|
73
|
+
private loadProcessVariables;
|
|
74
|
+
private handleValid;
|
|
75
|
+
private openSaveSubscription;
|
|
76
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GenerateDocumentConfigurationComponent, never>;
|
|
77
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GenerateDocumentConfigurationComponent, "epistola-generate-document-configuration", never, { "save$": { "alias": "save$"; "required": false; }; "disabled$": { "alias": "disabled$"; "required": false; }; "pluginId": { "alias": "pluginId"; "required": false; }; "prefillConfiguration$": { "alias": "prefillConfiguration$"; "required": false; }; "selectedPluginConfigurationData$": { "alias": "selectedPluginConfigurationData$"; "required": false; }; "context$": { "alias": "context$"; "required": false; }; }, { "valid": "valid"; "configuration": "configuration"; }, never, never, true, never>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "@angular/common";
|
|
3
|
+
import * as i2 from "@angular/common/http";
|
|
4
|
+
import * as i3 from "@valtimo/plugin";
|
|
5
|
+
import * as i4 from "@valtimo/components";
|
|
6
|
+
import * as i5 from "./components/epistola-configuration/epistola-configuration.component";
|
|
7
|
+
import * as i6 from "./components/generate-document-configuration/generate-document-configuration.component";
|
|
8
|
+
import * as i7 from "./components/check-job-status-configuration/check-job-status-configuration.component";
|
|
9
|
+
import * as i8 from "./components/download-document-configuration/download-document-configuration.component";
|
|
10
|
+
import * as i9 from "./components/data-mapping-tree/data-mapping-tree.component";
|
|
11
|
+
import * as i10 from "./components/field-tree/field-tree.component";
|
|
12
|
+
import * as i11 from "./components/epistola-download/epistola-download.component";
|
|
13
|
+
export declare class EpistolaPluginModule {
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EpistolaPluginModule, never>;
|
|
15
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EpistolaPluginModule, never, [typeof i1.CommonModule, typeof i2.HttpClientModule, typeof i3.PluginTranslatePipeModule, typeof i4.FormModule, typeof i4.InputModule, typeof i4.SelectModule, typeof i5.EpistolaConfigurationComponent, typeof i6.GenerateDocumentConfigurationComponent, typeof i7.CheckJobStatusConfigurationComponent, typeof i8.DownloadDocumentConfigurationComponent, typeof i9.DataMappingTreeComponent, typeof i10.FieldTreeComponent, typeof i11.EpistolaDownloadComponent], [typeof i5.EpistolaConfigurationComponent, typeof i6.GenerateDocumentConfigurationComponent, typeof i7.CheckJobStatusConfigurationComponent, typeof i8.DownloadDocumentConfigurationComponent, typeof i9.DataMappingTreeComponent, typeof i10.FieldTreeComponent, typeof i11.EpistolaDownloadComponent]>;
|
|
16
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<EpistolaPluginModule>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PluginConfigurationData } from '@valtimo/plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin-level configuration for Epistola.
|
|
4
|
+
* Contains connection settings and defaults.
|
|
5
|
+
*/
|
|
6
|
+
export interface EpistolaPluginConfig extends PluginConfigurationData {
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
tenantId: string;
|
|
10
|
+
defaultEnvironmentId?: string;
|
|
11
|
+
templateSyncEnabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Action configuration for the generate-document action.
|
|
15
|
+
* Contains all parameters needed to generate a document.
|
|
16
|
+
*
|
|
17
|
+
* Variant selection supports two modes:
|
|
18
|
+
* - Explicit: set variantId directly
|
|
19
|
+
* - By attributes: set variantAttributes with key-value pairs (values can be value resolver expressions)
|
|
20
|
+
*/
|
|
21
|
+
export interface GenerateDocumentConfig {
|
|
22
|
+
templateId: string;
|
|
23
|
+
variantId?: string;
|
|
24
|
+
variantAttributes?: Record<string, string>;
|
|
25
|
+
environmentId?: string;
|
|
26
|
+
dataMapping: Record<string, any>;
|
|
27
|
+
outputFormat: 'PDF' | 'HTML';
|
|
28
|
+
filename: string;
|
|
29
|
+
correlationId?: string;
|
|
30
|
+
resultProcessVariable: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Action configuration for the check-job-status action.
|
|
34
|
+
* Specifies which process variables to read from and write to.
|
|
35
|
+
*/
|
|
36
|
+
export interface CheckJobStatusConfig {
|
|
37
|
+
requestIdVariable: string;
|
|
38
|
+
statusVariable: string;
|
|
39
|
+
documentIdVariable?: string;
|
|
40
|
+
errorMessageVariable?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Action configuration for the download-document action.
|
|
44
|
+
* Specifies which process variables to read from and write to.
|
|
45
|
+
*/
|
|
46
|
+
export interface DownloadDocumentConfig {
|
|
47
|
+
documentIdVariable: string;
|
|
48
|
+
contentVariable: string;
|
|
49
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic information about an Epistola template.
|
|
3
|
+
*/
|
|
4
|
+
export interface TemplateInfo {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Detailed information about an Epistola template including its fields.
|
|
11
|
+
*/
|
|
12
|
+
export interface TemplateDetails {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
fields: TemplateField[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents a field in an Epistola template.
|
|
19
|
+
* Supports nested structures through the children property.
|
|
20
|
+
*/
|
|
21
|
+
export interface TemplateField {
|
|
22
|
+
name: string;
|
|
23
|
+
path: string;
|
|
24
|
+
type: string;
|
|
25
|
+
fieldType: 'SCALAR' | 'OBJECT' | 'ARRAY';
|
|
26
|
+
required: boolean;
|
|
27
|
+
description?: string;
|
|
28
|
+
children?: TemplateField[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a single data mapping entry.
|
|
32
|
+
*/
|
|
33
|
+
export interface DataMappingEntry {
|
|
34
|
+
templateField: string;
|
|
35
|
+
dataSource: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Source type for data mapping: how the value is provided.
|
|
39
|
+
*/
|
|
40
|
+
export type DataSourceType = 'document' | 'processVariable' | 'manual';
|
|
41
|
+
/**
|
|
42
|
+
* Validation result from the backend.
|
|
43
|
+
*/
|
|
44
|
+
export interface ValidationResult {
|
|
45
|
+
valid: boolean;
|
|
46
|
+
missingRequiredFields: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Information about an Epistola environment.
|
|
50
|
+
*/
|
|
51
|
+
export interface EnvironmentInfo {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Information about an Epistola template variant.
|
|
57
|
+
*/
|
|
58
|
+
export interface VariantInfo {
|
|
59
|
+
id: string;
|
|
60
|
+
templateId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
attributes: Record<string, string>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { ConfigService } from '@valtimo/shared';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { EnvironmentInfo, TemplateDetails, TemplateInfo, ValidationResult, VariantInfo } from '../models';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Service for interacting with Epistola plugin API endpoints.
|
|
8
|
+
* Provides methods to fetch templates, environments, variants,
|
|
9
|
+
* process variables, and validate mappings.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EpistolaPluginService {
|
|
12
|
+
private readonly http;
|
|
13
|
+
private readonly configService;
|
|
14
|
+
private readonly apiEndpoint;
|
|
15
|
+
constructor(http: HttpClient, configService: ConfigService);
|
|
16
|
+
/**
|
|
17
|
+
* Get all available templates for a plugin configuration.
|
|
18
|
+
*/
|
|
19
|
+
getTemplates(pluginConfigurationId: string): Observable<TemplateInfo[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Get template details including its fields.
|
|
22
|
+
*/
|
|
23
|
+
getTemplateDetails(pluginConfigurationId: string, templateId: string): Observable<TemplateDetails>;
|
|
24
|
+
/**
|
|
25
|
+
* Get all available environments for a plugin configuration.
|
|
26
|
+
*/
|
|
27
|
+
getEnvironments(pluginConfigurationId: string): Observable<EnvironmentInfo[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Get all variants for a specific template.
|
|
30
|
+
*/
|
|
31
|
+
getVariants(pluginConfigurationId: string, templateId: string): Observable<VariantInfo[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Discover process variable names for a given process definition.
|
|
34
|
+
*/
|
|
35
|
+
getProcessVariables(processDefinitionKey: string): Observable<string[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Validate that a data mapping covers all required template fields.
|
|
38
|
+
*/
|
|
39
|
+
validateMapping(pluginConfigurationId: string, templateId: string, dataMapping: Record<string, any>): Observable<ValidationResult>;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EpistolaPluginService, never>;
|
|
41
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EpistolaPluginService>;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './epistola-plugin.service';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './lib/models';
|
|
2
|
+
export * from './lib/services';
|
|
3
|
+
export * from './lib/epistola.module';
|
|
4
|
+
export * from './lib/epistola.specification';
|
|
5
|
+
export * from './lib/components/epistola-configuration/epistola-configuration.component';
|
|
6
|
+
export * from './lib/components/generate-document-configuration/generate-document-configuration.component';
|
|
7
|
+
export * from './lib/components/check-job-status-configuration/check-job-status-configuration.component';
|
|
8
|
+
export * from './lib/components/download-document-configuration/download-document-configuration.component';
|
|
9
|
+
export * from './lib/components/field-tree/field-tree.component';
|
|
10
|
+
export * from './lib/components/data-mapping-tree/data-mapping-tree.component';
|
|
11
|
+
export * from './lib/components/epistola-download/epistola-download.component';
|
|
12
|
+
export * from './lib/components/epistola-download/epistola-download.formio';
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "dist",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/public_api.ts"
|
|
6
|
+
},
|
|
7
|
+
"allowedNonPeerDependencies": [
|
|
8
|
+
"@angular/common",
|
|
9
|
+
"@angular/core",
|
|
10
|
+
"@angular/forms",
|
|
11
|
+
"@valtimo/plugin",
|
|
12
|
+
"@valtimo/components",
|
|
13
|
+
"@ngx-translate/core",
|
|
14
|
+
"rxjs",
|
|
15
|
+
"tslib"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@epistola.app/valtimo-plugin",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Epistola document generation plugin for Valtimo",
|
|
5
|
+
"license": "EUPL-1.2",
|
|
6
|
+
"module": "dist/fesm2022/epistola.app-valtimo-plugin.mjs",
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": {
|
|
10
|
+
"default": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/fesm2022/epistola.app-valtimo-plugin.mjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "ng-packagr -p ng-package.json",
|
|
20
|
+
"watch": "ng-packagr -p ng-package.json --watch",
|
|
21
|
+
"test": "echo 'No tests configured yet'"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@angular/common": ">=17.0.0",
|
|
25
|
+
"@angular/core": ">=17.0.0",
|
|
26
|
+
"@angular/forms": ">=17.0.0",
|
|
27
|
+
"@valtimo/plugin": "^13.0.0",
|
|
28
|
+
"@valtimo/components": "^13.0.0",
|
|
29
|
+
"@valtimo/shared": "^13.0.0",
|
|
30
|
+
"@valtimo/process-link": "^13.0.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"tslib": "^2.6.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"ng-packagr": "^19.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Placeholder logo - a simple document icon in SVG format, base64 encoded
|
|
2
|
+
// TODO: Replace with actual Epistola logo
|
|
3
|
+
export const EPISTOLA_PLUGIN_LOGO_BASE64 =
|
|
4
|
+
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iIzMzNjZjYyI+PHBhdGggZD0iTTE0IDJINmMtMS4xIDAtMiAuOS0yIDJ2MTZjMCAxLjEuOSAyIDIgMmgxMmMxLjEgMCAyLS45IDItMlY4bC02LTZ6bTQgMThINlY0aDd2NWg1djExeiIvPjxwYXRoIGQ9Ik04IDEyaDh2Mkg4em0wIDRoOHYtMkg4em0wLThWNmg0djJ6Ii8+PC9zdmc+';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './epistola-logo';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<v-form
|
|
2
|
+
(valueChange)="formValueChange($event)"
|
|
3
|
+
*ngIf="{
|
|
4
|
+
disabled: safeDisabled$ | async,
|
|
5
|
+
prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null
|
|
6
|
+
} as obs"
|
|
7
|
+
>
|
|
8
|
+
<v-input
|
|
9
|
+
name="requestIdVariable"
|
|
10
|
+
[title]="'requestIdVariable' | pluginTranslate: pluginId | async"
|
|
11
|
+
[tooltip]="'requestIdVariableTooltip' | pluginTranslate: pluginId | async"
|
|
12
|
+
[margin]="true"
|
|
13
|
+
[defaultValue]="obs.prefill?.requestIdVariable || 'epistolaRequestId'"
|
|
14
|
+
[disabled]="obs.disabled"
|
|
15
|
+
[required]="true"
|
|
16
|
+
>
|
|
17
|
+
</v-input>
|
|
18
|
+
|
|
19
|
+
<v-input
|
|
20
|
+
name="statusVariable"
|
|
21
|
+
[title]="'statusVariable' | pluginTranslate: pluginId | async"
|
|
22
|
+
[tooltip]="'statusVariableTooltip' | pluginTranslate: pluginId | async"
|
|
23
|
+
[margin]="true"
|
|
24
|
+
[defaultValue]="obs.prefill?.statusVariable || 'epistolaStatus'"
|
|
25
|
+
[disabled]="obs.disabled"
|
|
26
|
+
[required]="true"
|
|
27
|
+
>
|
|
28
|
+
</v-input>
|
|
29
|
+
|
|
30
|
+
<v-input
|
|
31
|
+
name="documentIdVariable"
|
|
32
|
+
[title]="'documentIdVariable' | pluginTranslate: pluginId | async"
|
|
33
|
+
[tooltip]="'documentIdVariableTooltip' | pluginTranslate: pluginId | async"
|
|
34
|
+
[margin]="true"
|
|
35
|
+
[defaultValue]="obs.prefill?.documentIdVariable || 'epistolaDocumentId'"
|
|
36
|
+
[disabled]="obs.disabled"
|
|
37
|
+
[required]="false"
|
|
38
|
+
>
|
|
39
|
+
</v-input>
|
|
40
|
+
|
|
41
|
+
<v-input
|
|
42
|
+
name="errorMessageVariable"
|
|
43
|
+
[title]="'errorMessageVariable' | pluginTranslate: pluginId | async"
|
|
44
|
+
[tooltip]="'errorMessageVariableTooltip' | pluginTranslate: pluginId | async"
|
|
45
|
+
[margin]="true"
|
|
46
|
+
[defaultValue]="obs.prefill?.errorMessageVariable || 'epistolaErrorMessage'"
|
|
47
|
+
[disabled]="obs.disabled"
|
|
48
|
+
[required]="false"
|
|
49
|
+
>
|
|
50
|
+
</v-input>
|
|
51
|
+
</v-form>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Check job status configuration styles
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {FunctionConfigurationComponent, PluginTranslatePipeModule} from '@valtimo/plugin';
|
|
4
|
+
import {FormModule, FormOutput, InputModule} from '@valtimo/components';
|
|
5
|
+
import {BehaviorSubject, combineLatest, Observable, Subscription, take} from 'rxjs';
|
|
6
|
+
import {delay, startWith} from 'rxjs/operators';
|
|
7
|
+
import {CheckJobStatusConfig} from '../../models';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'epistola-check-job-status-configuration',
|
|
11
|
+
templateUrl: './check-job-status-configuration.component.html',
|
|
12
|
+
styleUrls: ['./check-job-status-configuration.component.scss'],
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [CommonModule, PluginTranslatePipeModule, FormModule, InputModule]
|
|
15
|
+
})
|
|
16
|
+
export class CheckJobStatusConfigurationComponent
|
|
17
|
+
implements FunctionConfigurationComponent, OnInit, OnDestroy
|
|
18
|
+
{
|
|
19
|
+
@Input() save$!: Observable<void>;
|
|
20
|
+
@Input() disabled$!: Observable<boolean>;
|
|
21
|
+
@Input() pluginId!: string;
|
|
22
|
+
@Input() prefillConfiguration$!: Observable<CheckJobStatusConfig>;
|
|
23
|
+
|
|
24
|
+
@Output() valid: EventEmitter<boolean> = new EventEmitter<boolean>();
|
|
25
|
+
@Output() configuration: EventEmitter<CheckJobStatusConfig> = new EventEmitter<CheckJobStatusConfig>();
|
|
26
|
+
|
|
27
|
+
private saveSubscription!: Subscription;
|
|
28
|
+
private readonly formValue$ = new BehaviorSubject<CheckJobStatusConfig | null>(null);
|
|
29
|
+
private readonly valid$ = new BehaviorSubject<boolean>(false);
|
|
30
|
+
|
|
31
|
+
safeDisabled$!: Observable<boolean>;
|
|
32
|
+
|
|
33
|
+
ngOnInit(): void {
|
|
34
|
+
this.safeDisabled$ = this.disabled$.pipe(
|
|
35
|
+
startWith(true),
|
|
36
|
+
delay(0)
|
|
37
|
+
);
|
|
38
|
+
this.openSaveSubscription();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ngOnDestroy() {
|
|
42
|
+
this.saveSubscription?.unsubscribe();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
formValueChange(formOutput: FormOutput): void {
|
|
46
|
+
const formValue = formOutput as unknown as CheckJobStatusConfig;
|
|
47
|
+
this.formValue$.next(formValue);
|
|
48
|
+
this.handleValid(formValue);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private handleValid(formValue: CheckJobStatusConfig): void {
|
|
52
|
+
const valid = !!(
|
|
53
|
+
formValue?.requestIdVariable &&
|
|
54
|
+
formValue?.statusVariable
|
|
55
|
+
);
|
|
56
|
+
this.valid$.next(valid);
|
|
57
|
+
this.valid.emit(valid);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private openSaveSubscription(): void {
|
|
61
|
+
this.saveSubscription = this.save$?.subscribe(() => {
|
|
62
|
+
combineLatest([this.formValue$, this.valid$])
|
|
63
|
+
.pipe(take(1))
|
|
64
|
+
.subscribe(([formValue, valid]) => {
|
|
65
|
+
if (valid && formValue) {
|
|
66
|
+
this.configuration.emit(formValue);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<div class="data-mapping-tree">
|
|
2
|
+
<div class="mapping-header">
|
|
3
|
+
<h5>{{ 'dataMappingTitle' | pluginTranslate: pluginId | async }}</h5>
|
|
4
|
+
<p class="helper-text">{{ 'dataMappingDescription' | pluginTranslate: pluginId | async }}</p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="field-tree-root" *ngIf="templateFields.length > 0">
|
|
8
|
+
<epistola-field-tree
|
|
9
|
+
*ngFor="let field of templateFields"
|
|
10
|
+
[field]="field"
|
|
11
|
+
[value]="getFieldValue(field.name)"
|
|
12
|
+
[pluginId]="pluginId"
|
|
13
|
+
[caseDefinitionKey]="caseDefinitionKey"
|
|
14
|
+
[processVariables]="processVariables"
|
|
15
|
+
[disabled]="disabled"
|
|
16
|
+
(valueChange)="onFieldValueChange(field.name, $event)"
|
|
17
|
+
></epistola-field-tree>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="no-fields" *ngIf="templateFields.length === 0">
|
|
21
|
+
<p>{{ 'noTemplateFields' | pluginTranslate: pluginId | async }}</p>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.data-mapping-tree {
|
|
2
|
+
margin-top: 1rem;
|
|
3
|
+
margin-bottom: 1rem;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.mapping-header {
|
|
7
|
+
margin-bottom: 0.75rem;
|
|
8
|
+
|
|
9
|
+
h5 {
|
|
10
|
+
margin-bottom: 0.25rem;
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.helper-text {
|
|
15
|
+
color: #6c757d;
|
|
16
|
+
font-size: 0.875rem;
|
|
17
|
+
margin-bottom: 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.field-tree-root {
|
|
22
|
+
border: 1px solid #e0e0e0;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
padding: 0.5rem 0.75rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.no-fields {
|
|
28
|
+
padding: 1rem;
|
|
29
|
+
text-align: center;
|
|
30
|
+
color: #6c757d;
|
|
31
|
+
background-color: #f8f9fa;
|
|
32
|
+
border: 1px solid #dee2e6;
|
|
33
|
+
border-radius: 4px;
|
|
34
|
+
|
|
35
|
+
p {
|
|
36
|
+
margin-bottom: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {PluginTranslatePipeModule} from '@valtimo/plugin';
|
|
4
|
+
import {Observable, Subject} from 'rxjs';
|
|
5
|
+
import {takeUntil} from 'rxjs/operators';
|
|
6
|
+
import {TemplateField} from '../../models';
|
|
7
|
+
import {FieldTreeComponent} from '../field-tree/field-tree.component';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Top-level wrapper that hosts FieldTreeComponent instances for each top-level template field.
|
|
11
|
+
* Manages the full nested mapping object, completeness tracking, and emits mapping changes.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'epistola-data-mapping-tree',
|
|
15
|
+
templateUrl: './data-mapping-tree.component.html',
|
|
16
|
+
styleUrls: ['./data-mapping-tree.component.scss'],
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [
|
|
19
|
+
CommonModule,
|
|
20
|
+
PluginTranslatePipeModule,
|
|
21
|
+
FieldTreeComponent
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
export class DataMappingTreeComponent implements OnInit, OnDestroy {
|
|
25
|
+
@Input() pluginId!: string;
|
|
26
|
+
@Input() templateFields$!: Observable<TemplateField[]>;
|
|
27
|
+
@Input() prefillMapping$!: Observable<Record<string, any>>;
|
|
28
|
+
@Input() disabled$!: Observable<boolean>;
|
|
29
|
+
@Input() caseDefinitionKey: string | null = null;
|
|
30
|
+
@Input() processVariables: string[] = [];
|
|
31
|
+
|
|
32
|
+
@Output() mappingChange = new EventEmitter<Record<string, any>>();
|
|
33
|
+
@Output() requiredFieldsStatus = new EventEmitter<{mapped: number; total: number}>();
|
|
34
|
+
|
|
35
|
+
templateFields: TemplateField[] = [];
|
|
36
|
+
mapping: Record<string, any> = {};
|
|
37
|
+
disabled = false;
|
|
38
|
+
|
|
39
|
+
private readonly destroy$ = new Subject<void>();
|
|
40
|
+
|
|
41
|
+
ngOnInit(): void {
|
|
42
|
+
this.templateFields$.pipe(
|
|
43
|
+
takeUntil(this.destroy$)
|
|
44
|
+
).subscribe(fields => {
|
|
45
|
+
this.templateFields = fields;
|
|
46
|
+
this.emitRequiredFieldsStatus();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
this.prefillMapping$.pipe(
|
|
50
|
+
takeUntil(this.destroy$)
|
|
51
|
+
).subscribe(mapping => {
|
|
52
|
+
if (mapping && Object.keys(mapping).length > 0) {
|
|
53
|
+
this.mapping = {...mapping};
|
|
54
|
+
}
|
|
55
|
+
this.emitRequiredFieldsStatus();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
this.disabled$.pipe(
|
|
59
|
+
takeUntil(this.destroy$)
|
|
60
|
+
).subscribe(disabled => {
|
|
61
|
+
this.disabled = disabled;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
ngOnDestroy(): void {
|
|
66
|
+
this.destroy$.next();
|
|
67
|
+
this.destroy$.complete();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
onFieldValueChange(fieldName: string, value: any): void {
|
|
71
|
+
if (value === undefined || value === null || value === '') {
|
|
72
|
+
const {[fieldName]: _, ...rest} = this.mapping;
|
|
73
|
+
this.mapping = rest;
|
|
74
|
+
} else {
|
|
75
|
+
this.mapping = {...this.mapping, [fieldName]: value};
|
|
76
|
+
}
|
|
77
|
+
this.mappingChange.emit(this.mapping);
|
|
78
|
+
this.emitRequiredFieldsStatus();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getFieldValue(fieldName: string): any {
|
|
82
|
+
return this.mapping[fieldName];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private emitRequiredFieldsStatus(): void {
|
|
86
|
+
const stats = this.countRequiredMapped(this.templateFields, this.mapping);
|
|
87
|
+
this.requiredFieldsStatus.emit(stats);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private countRequiredMapped(
|
|
91
|
+
fields: TemplateField[],
|
|
92
|
+
mapping: Record<string, any>
|
|
93
|
+
): {mapped: number; total: number} {
|
|
94
|
+
let mapped = 0;
|
|
95
|
+
let total = 0;
|
|
96
|
+
for (const field of fields) {
|
|
97
|
+
if (field.fieldType === 'SCALAR' && field.required) {
|
|
98
|
+
total++;
|
|
99
|
+
const val = mapping[field.name];
|
|
100
|
+
if (typeof val === 'string' && val.trim().length > 0) {
|
|
101
|
+
mapped++;
|
|
102
|
+
}
|
|
103
|
+
} else if (field.fieldType === 'ARRAY' && field.required) {
|
|
104
|
+
total++;
|
|
105
|
+
const val = mapping[field.name];
|
|
106
|
+
if (typeof val === 'string' && val.trim().length > 0) {
|
|
107
|
+
mapped++;
|
|
108
|
+
} else if (typeof val === 'object' && val !== null && '_source' in val) {
|
|
109
|
+
if (typeof val['_source'] === 'string' && val['_source'].trim().length > 0) {
|
|
110
|
+
mapped++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else if (field.fieldType === 'OBJECT' && field.children) {
|
|
114
|
+
const nested = (typeof mapping[field.name] === 'object' && mapping[field.name] !== null)
|
|
115
|
+
? mapping[field.name]
|
|
116
|
+
: {};
|
|
117
|
+
const childStats = this.countRequiredMapped(field.children, nested);
|
|
118
|
+
mapped += childStats.mapped;
|
|
119
|
+
total += childStats.total;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {mapped, total};
|
|
123
|
+
}
|
|
124
|
+
}
|