@epistola.app/valtimo-plugin 0.5.2 → 0.7.0

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.
Files changed (39) hide show
  1. package/fesm2022/epistola.app-valtimo-plugin.mjs +2531 -561
  2. package/fesm2022/epistola.app-valtimo-plugin.mjs.map +1 -1
  3. package/lib/assets/epistola-logo.d.ts +1 -1
  4. package/lib/components/epistola-admin-page/epistola-admin-page.component.d.ts +52 -0
  5. package/lib/components/epistola-document-preview/epistola-document-preview.component.d.ts +28 -5
  6. package/lib/components/epistola-document-preview/preview-utils.d.ts +18 -0
  7. package/lib/components/expected-structure/expected-structure.component.d.ts +11 -0
  8. package/lib/components/generate-document-configuration/generate-document-configuration.component.d.ts +29 -3
  9. package/lib/components/jsonata-editor/jsonata-editor.component.d.ts +29 -0
  10. package/lib/components/mapping-builder/builder-field/builder-field.component.d.ts +21 -0
  11. package/lib/components/mapping-builder/mapping-builder.component.d.ts +37 -0
  12. package/lib/components/mapping-preview/mapping-preview.component.d.ts +26 -0
  13. package/lib/components/override-builder/override-builder.component.d.ts +42 -0
  14. package/lib/components/override-builder/override-builder.formio.d.ts +4 -0
  15. package/lib/components/process-link-selector/process-link-selector.component.d.ts +31 -0
  16. package/lib/components/process-link-selector/process-link-selector.formio.d.ts +4 -0
  17. package/lib/epistola-admin-routing.module.d.ts +7 -0
  18. package/lib/epistola-enabled.guard.d.ts +2 -0
  19. package/lib/epistola-runtime-config.d.ts +28 -0
  20. package/lib/epistola.module.d.ts +11 -14
  21. package/lib/models/admin.d.ts +49 -0
  22. package/lib/models/config.d.ts +30 -2
  23. package/lib/models/expression.d.ts +13 -0
  24. package/lib/models/index.d.ts +2 -0
  25. package/lib/models/template.d.ts +0 -6
  26. package/lib/services/epistola-admin.service.d.ts +37 -0
  27. package/lib/services/epistola-menu.service.d.ts +13 -0
  28. package/lib/services/epistola-plugin.service.d.ts +16 -3
  29. package/lib/services/index.d.ts +2 -0
  30. package/lib/utils/jsonata-converter.d.ts +26 -0
  31. package/lib/utils/jsonata-monaco.d.ts +14 -0
  32. package/package.json +10 -6
  33. package/public_api.d.ts +9 -5
  34. package/lib/components/array-field/array-field.component.d.ts +0 -27
  35. package/lib/components/data-mapping-tree/data-mapping-tree.component.d.ts +0 -27
  36. package/lib/components/field-tree/field-tree.component.d.ts +0 -27
  37. package/lib/components/scalar-field/scalar-field.component.d.ts +0 -16
  38. package/lib/components/value-input/value-input.component.d.ts +0 -34
  39. package/lib/utils/template-field-utils.d.ts +0 -6
@@ -0,0 +1,13 @@
1
+ export interface ExpressionFunctionInfo {
2
+ name: string;
3
+ description: string;
4
+ overloads: OverloadInfo[];
5
+ }
6
+ export interface OverloadInfo {
7
+ arguments: ArgumentInfo[];
8
+ returnType: string;
9
+ }
10
+ export interface ArgumentInfo {
11
+ name: string;
12
+ type: string;
13
+ }
@@ -1,3 +1,5 @@
1
+ export * from './admin';
1
2
  export * from './async-resource';
2
3
  export * from './config';
4
+ export * from './expression';
3
5
  export * from './template';
@@ -41,12 +41,6 @@ export interface DataMappingEntry {
41
41
  */
42
42
  export type DataSourceType = 'document' | 'processVariable' | 'manual';
43
43
  /**
44
- * Validation result from the backend.
45
- */
46
- export interface ValidationResult {
47
- valid: boolean;
48
- missingRequiredFields: string[];
49
- }
50
44
  /**
51
45
  * Information about an Epistola environment.
52
46
  */
@@ -0,0 +1,37 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { ConfigService } from '@valtimo/shared';
3
+ import { Observable } from 'rxjs';
4
+ import { ConnectionStatus, PendingJob, PluginUsageEntry, VersionInfo } from '../models';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Service for Epistola plugin administrative operations.
8
+ * Provides health checks, version info, and usage overview.
9
+ */
10
+ export declare class EpistolaAdminService {
11
+ private readonly http;
12
+ private readonly configService;
13
+ private readonly apiEndpoint;
14
+ constructor(http: HttpClient, configService: ConfigService);
15
+ /**
16
+ * Check connectivity to Epistola for all plugin configurations.
17
+ */
18
+ getConnectionStatus(): Observable<ConnectionStatus[]>;
19
+ /**
20
+ * Get version information for the plugin and connected Epistola server.
21
+ */
22
+ getVersions(): Observable<VersionInfo>;
23
+ /**
24
+ * Get an overview of all Epistola plugin usages across process definitions.
25
+ */
26
+ getPluginUsage(): Observable<PluginUsageEntry[]>;
27
+ /**
28
+ * Get all process instances currently waiting for an Epistola document generation result.
29
+ */
30
+ getPendingJobs(): Observable<PendingJob[]>;
31
+ /**
32
+ * Export a single process link as a .process-link.json file.
33
+ */
34
+ exportProcessLink(processLinkId: string): Observable<Blob>;
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<EpistolaAdminService, never>;
36
+ static ɵprov: i0.ɵɵInjectableDeclaration<EpistolaAdminService>;
37
+ }
@@ -0,0 +1,13 @@
1
+ import { MenuService } from '@valtimo/components';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Registers the Epistola admin page menu item under the Admin > Other section.
5
+ * Instantiated eagerly via ENVIRONMENT_INITIALIZER so the menu item
6
+ * appears without any manual configuration in the host application.
7
+ */
8
+ export declare class EpistolaMenuService {
9
+ private readonly menuService;
10
+ constructor(menuService: MenuService);
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<EpistolaMenuService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<EpistolaMenuService>;
13
+ }
@@ -1,7 +1,7 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { ConfigService } from '@valtimo/shared';
3
3
  import { Observable } from 'rxjs';
4
- import { AttributeDefinition, CatalogInfo, EnvironmentInfo, PreviewSource, TemplateDetails, TemplateInfo, ValidationResult, VariantInfo } from '../models';
4
+ import { AttributeDefinition, CatalogInfo, EnvironmentInfo, ExpressionFunctionInfo, JsonataValidationResult, PreviewSource, TemplateDetails, TemplateInfo, EvaluationResult, ValidateJsonataRequest, VariableSuggestions, VariantInfo } from '../models';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Service for interacting with Epistola plugin API endpoints.
@@ -42,13 +42,26 @@ export declare class EpistolaPluginService {
42
42
  */
43
43
  getProcessVariables(processDefinitionKey: string): Observable<string[]>;
44
44
  /**
45
- * Validate that a data mapping covers all required template fields.
45
+ * Get variable suggestions for JSONata autocompletion.
46
46
  */
47
- validateMapping(pluginConfigurationId: string, templateId: string, dataMapping: Record<string, any>): Observable<ValidationResult>;
47
+ getVariableSuggestions(caseDefinitionKey?: string, processDefinitionKey?: string): Observable<VariableSuggestions>;
48
+ /**
49
+ * Evaluate a JSONata expression against a real document.
50
+ */
51
+ evaluateMapping(expression: string, documentId: string, processInstanceId?: string): Observable<EvaluationResult>;
48
52
  /**
49
53
  * Get a dynamically generated Formio form for retrying a failed document generation.
50
54
  */
51
55
  getRetryForm(processInstanceId: string, documentId?: string, sourceActivityId?: string): Observable<any>;
56
+ /**
57
+ * List all available expression functions for expr: data mapping values.
58
+ */
59
+ getExpressionFunctions(): Observable<ExpressionFunctionInfo[]>;
60
+ /**
61
+ * Validate the JSONata syntax of action-config expressions before save.
62
+ * Parse-only; runtime errors (missing variables, type mismatches) are not detected.
63
+ */
64
+ validateJsonata(request: ValidateJsonataRequest): Observable<JsonataValidationResult>;
52
65
  /**
53
66
  * Discover all previewable document sources for a given Valtimo document.
54
67
  */
@@ -1 +1,3 @@
1
+ export * from './epistola-admin.service';
2
+ export * from './epistola-menu.service';
1
3
  export * from './epistola-plugin.service';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Represents a field in the visual builder.
3
+ * - mode 'ref': a simple $doc/$pv/$case path reference
4
+ * - mode 'raw': raw JSONata text the builder can't represent visually
5
+ */
6
+ export interface BuilderField {
7
+ name: string;
8
+ mode: 'ref' | 'raw';
9
+ value: string;
10
+ children?: BuilderField[];
11
+ }
12
+ /**
13
+ * Parse a JSONata expression into BuilderField array.
14
+ * Only supports top-level object literals with simple path references or nested objects.
15
+ * Anything else is stored as raw JSONata text.
16
+ */
17
+ export declare function parseJsonataToBuilder(expression: string): BuilderField[];
18
+ /**
19
+ * Convert BuilderField array back to a JSONata expression string.
20
+ */
21
+ export declare function builderToJsonata(fields: BuilderField[]): string;
22
+ /**
23
+ * Check if a JSONata expression can be fully represented by the builder
24
+ * (i.e., all fields are simple refs or nested objects of simple refs).
25
+ */
26
+ export declare function isBuilderCompatible(expression: string): boolean;
@@ -0,0 +1,14 @@
1
+ import { ExpressionFunctionInfo, VariableSuggestions } from '../models';
2
+ /**
3
+ * Shared state for the JSONata completion provider.
4
+ * Updated by the editor component when suggestions/functions change.
5
+ */
6
+ export declare const jsonataCompletionData: {
7
+ suggestions: VariableSuggestions | null;
8
+ functions: ExpressionFunctionInfo[];
9
+ };
10
+ /**
11
+ * Register the JSONata language in Monaco editor.
12
+ * Call this once when Monaco is available (e.g., in editor component OnInit).
13
+ */
14
+ export declare function registerJsonataLanguage(monaco: any): void;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@epistola.app/valtimo-plugin",
3
- "version": "0.5.2",
3
+ "version": "0.7.0",
4
4
  "description": "Epistola document generation plugin for Valtimo",
5
5
  "license": "EUPL-1.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/epistola-app/valtimo-epistola-plugin"
9
9
  },
10
+ "sideEffects": false,
10
11
  "module": "fesm2022/epistola.app-valtimo-plugin.mjs",
11
12
  "typings": "index.d.ts",
12
13
  "exports": {
@@ -18,17 +19,20 @@
18
19
  "default": "./fesm2022/epistola.app-valtimo-plugin.mjs"
19
20
  }
20
21
  },
21
- "sideEffects": false,
22
+ "dependencies": {
23
+ "tslib": "^2.6.0"
24
+ },
22
25
  "peerDependencies": {
23
26
  "@angular/common": ">=17.0.0",
24
27
  "@angular/core": ">=17.0.0",
25
28
  "@angular/forms": ">=17.0.0",
29
+ "@angular/router": ">=17.0.0",
26
30
  "@valtimo/components": "^13.21.0",
27
31
  "@valtimo/plugin": "^13.21.0",
28
32
  "@valtimo/process-link": "^13.21.0",
29
- "@valtimo/shared": "^13.21.0"
30
- },
31
- "dependencies": {
32
- "tslib": "^2.6.0"
33
+ "@valtimo/security": "^13.21.0",
34
+ "@valtimo/shared": "^13.21.0",
35
+ "jsonata": "^2.1.0",
36
+ "monaco-editor": ">=0.40.0"
33
37
  }
34
38
  }
package/public_api.d.ts CHANGED
@@ -2,15 +2,15 @@ export * from './lib/models';
2
2
  export * from './lib/services';
3
3
  export * from './lib/epistola.module';
4
4
  export * from './lib/epistola.specification';
5
+ export * from './lib/epistola-runtime-config';
6
+ export * from './lib/epistola-admin-routing.module';
7
+ export * from './lib/components/epistola-admin-page/epistola-admin-page.component';
5
8
  export * from './lib/components/epistola-configuration/epistola-configuration.component';
6
9
  export * from './lib/components/generate-document-configuration/generate-document-configuration.component';
7
10
  export * from './lib/components/check-job-status-configuration/check-job-status-configuration.component';
8
11
  export * from './lib/components/download-document-configuration/download-document-configuration.component';
9
- export * from './lib/components/value-input/value-input.component';
10
- export * from './lib/components/scalar-field/scalar-field.component';
11
- export * from './lib/components/array-field/array-field.component';
12
- export * from './lib/components/field-tree/field-tree.component';
13
- export * from './lib/components/data-mapping-tree/data-mapping-tree.component';
12
+ export * from './lib/components/jsonata-editor/jsonata-editor.component';
13
+ export * from './lib/components/mapping-builder/mapping-builder.component';
14
14
  export * from './lib/components/epistola-download/epistola-download.component';
15
15
  export * from './lib/components/epistola-download/epistola-download.formio';
16
16
  export * from './lib/components/epistola-retry-form/epistola-retry-form.component';
@@ -19,3 +19,7 @@ export * from './lib/components/epistola-preview-button/epistola-preview-button.
19
19
  export * from './lib/components/epistola-preview-button/epistola-preview-button.formio';
20
20
  export * from './lib/components/epistola-document-preview/epistola-document-preview.component';
21
21
  export * from './lib/components/epistola-document-preview/epistola-document-preview.formio';
22
+ export * from './lib/components/override-builder/override-builder.component';
23
+ export * from './lib/components/override-builder/override-builder.formio';
24
+ export * from './lib/components/process-link-selector/process-link-selector.component';
25
+ export * from './lib/components/process-link-selector/process-link-selector.formio';
@@ -1,27 +0,0 @@
1
- import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
- import { TemplateField } from '../../models';
3
- import * as i0 from "@angular/core";
4
- export declare class ArrayFieldComponent implements OnChanges {
5
- field: TemplateField;
6
- value: any;
7
- pluginId: string;
8
- caseDefinitionKey: string | null;
9
- processVariables: string[];
10
- disabled: boolean;
11
- valueChange: EventEmitter<any>;
12
- expanded: boolean;
13
- arrayPerFieldMode: boolean;
14
- mappedCount: number;
15
- totalRequired: number;
16
- ngOnChanges(changes: SimpleChanges): void;
17
- toggleExpanded(): void;
18
- getSourceValue(): string;
19
- onSourceValueChange(newValue: string): void;
20
- toggleArrayPerFieldMode(): void;
21
- onItemFieldChange(childName: string, sourceFieldName: string): void;
22
- getItemFieldValue(childName: string): string;
23
- hasArrayChildren(): boolean;
24
- private updateCompleteness;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<ArrayFieldComponent, never>;
26
- static ɵcmp: i0.ɵɵComponentDeclaration<ArrayFieldComponent, "epistola-array-field", never, { "field": { "alias": "field"; "required": false; }; "value": { "alias": "value"; "required": false; }; "pluginId": { "alias": "pluginId"; "required": false; }; "caseDefinitionKey": { "alias": "caseDefinitionKey"; "required": false; }; "processVariables": { "alias": "processVariables"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
27
- }
@@ -1,27 +0,0 @@
1
- import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
- import { TemplateField } from '../../models';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Top-level wrapper that hosts FieldTreeComponent instances for each top-level template field.
6
- * Manages the full nested mapping object, completeness tracking, and emits mapping changes.
7
- */
8
- export declare class DataMappingTreeComponent implements OnChanges {
9
- pluginId: string;
10
- templateFields: TemplateField[];
11
- prefillMapping: Record<string, any>;
12
- disabled: boolean;
13
- caseDefinitionKey: string | null;
14
- processVariables: string[];
15
- mappingChange: EventEmitter<Record<string, any>>;
16
- requiredFieldsStatus: EventEmitter<{
17
- mapped: number;
18
- total: number;
19
- }>;
20
- mapping: Record<string, any>;
21
- ngOnChanges(changes: SimpleChanges): void;
22
- onFieldValueChange(fieldName: string, value: any): void;
23
- getFieldValue(fieldName: string): any;
24
- private emitRequiredFieldsStatus;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<DataMappingTreeComponent, never>;
26
- static ɵcmp: i0.ɵɵComponentDeclaration<DataMappingTreeComponent, "epistola-data-mapping-tree", never, { "pluginId": { "alias": "pluginId"; "required": false; }; "templateFields": { "alias": "templateFields"; "required": false; }; "prefillMapping": { "alias": "prefillMapping"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "caseDefinitionKey": { "alias": "caseDefinitionKey"; "required": false; }; "processVariables": { "alias": "processVariables"; "required": false; }; }, { "mappingChange": "mappingChange"; "requiredFieldsStatus": "requiredFieldsStatus"; }, never, never, true, never>;
27
- }
@@ -1,27 +0,0 @@
1
- import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
- import { TemplateField } from '../../models';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Recursive field tree component.
6
- * Dispatches SCALAR and ARRAY to dedicated sub-components.
7
- * Handles OBJECT inline to avoid circular import issues (OBJECT children recurse back to this component).
8
- * Uses forwardRef(() => FieldTreeComponent) in imports to allow self-referencing in the template.
9
- */
10
- export declare class FieldTreeComponent implements OnChanges {
11
- field: TemplateField;
12
- value: any;
13
- pluginId: string;
14
- caseDefinitionKey: string | null;
15
- processVariables: string[];
16
- disabled: boolean;
17
- valueChange: EventEmitter<any>;
18
- expanded: boolean;
19
- mappedCount: number;
20
- totalRequired: number;
21
- ngOnChanges(changes: SimpleChanges): void;
22
- toggleExpanded(): void;
23
- onChildChange(childName: string, childValue: any): void;
24
- getChildValue(childName: string): any;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<FieldTreeComponent, never>;
26
- static ɵcmp: i0.ɵɵComponentDeclaration<FieldTreeComponent, "epistola-field-tree", never, { "field": { "alias": "field"; "required": false; }; "value": { "alias": "value"; "required": false; }; "pluginId": { "alias": "pluginId"; "required": false; }; "caseDefinitionKey": { "alias": "caseDefinitionKey"; "required": false; }; "processVariables": { "alias": "processVariables"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
27
- }
@@ -1,16 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { TemplateField } from '../../models';
3
- import * as i0 from "@angular/core";
4
- export declare class ScalarFieldComponent {
5
- field: TemplateField;
6
- value: any;
7
- pluginId: string;
8
- caseDefinitionKey: string | null;
9
- processVariables: string[];
10
- disabled: boolean;
11
- valueChange: EventEmitter<any>;
12
- get stringValue(): string;
13
- onValueChange(newValue: string): void;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<ScalarFieldComponent, never>;
15
- static ɵcmp: i0.ɵɵComponentDeclaration<ScalarFieldComponent, "epistola-scalar-field", never, { "field": { "alias": "field"; "required": false; }; "value": { "alias": "value"; "required": false; }; "pluginId": { "alias": "pluginId"; "required": false; }; "caseDefinitionKey": { "alias": "caseDefinitionKey"; "required": false; }; "processVariables": { "alias": "processVariables"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
16
- }
@@ -1,34 +0,0 @@
1
- import { ChangeDetectorRef, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
- import { ValuePathSelectorPrefix } from '@valtimo/components';
3
- import * as i0 from "@angular/core";
4
- export type InputMode = 'browse' | 'pv' | 'expression';
5
- /**
6
- * Reusable 3-mode input (browse / pv / expression) for value resolver expressions.
7
- * Used by both ScalarFieldComponent and ArrayFieldComponent for source mapping.
8
- */
9
- export declare class ValueInputComponent implements OnChanges {
10
- private readonly cdr;
11
- name: string;
12
- value: string;
13
- pluginId: string;
14
- caseDefinitionKey: string | null;
15
- processVariables: string[];
16
- disabled: boolean;
17
- placeholder: string;
18
- valueChange: EventEmitter<string>;
19
- readonly ValuePathSelectorPrefix: typeof ValuePathSelectorPrefix;
20
- inputMode: InputMode;
21
- selectedPv: string;
22
- browseDefault: string;
23
- constructor(cdr: ChangeDetectorRef);
24
- ngOnChanges(changes: SimpleChanges): void;
25
- setInputMode(mode: InputMode): void;
26
- onBrowseValueChange(newValue: string): void;
27
- onPvChange(newValue: string): void;
28
- onExpressionValueChange(newValue: string): void;
29
- private detectInputMode;
30
- static ɵfac: i0.ɵɵFactoryDeclaration<ValueInputComponent, never>;
31
- static ɵcmp: i0.ɵɵComponentDeclaration<ValueInputComponent, "epistola-value-input", never, { "name": { "alias": "name"; "required": false; }; "value": { "alias": "value"; "required": false; }; "pluginId": { "alias": "pluginId"; "required": false; }; "caseDefinitionKey": { "alias": "caseDefinitionKey"; "required": false; }; "processVariables": { "alias": "processVariables"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
32
- }
33
- /** Convert slash-notation paths (e.g. doc:/a/b) to dot notation (doc:a.b). */
34
- export declare function normalizeToDots(value: string): string;
@@ -1,6 +0,0 @@
1
- import { TemplateField } from '../models';
2
- export interface RequiredFieldsStatus {
3
- mapped: number;
4
- total: number;
5
- }
6
- export declare function countRequiredMapped(fields: TemplateField[], mapping: Record<string, any>): RequiredFieldsStatus;