@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.
Files changed (54) hide show
  1. package/dist/fesm2022/epistola.app-valtimo-plugin.mjs +1393 -0
  2. package/dist/fesm2022/epistola.app-valtimo-plugin.mjs.map +1 -0
  3. package/dist/index.d.ts +5 -0
  4. package/dist/lib/assets/epistola-logo.d.ts +1 -0
  5. package/dist/lib/assets/index.d.ts +1 -0
  6. package/dist/lib/components/check-job-status-configuration/check-job-status-configuration.component.d.ts +25 -0
  7. package/dist/lib/components/data-mapping-tree/data-mapping-tree.component.d.ts +33 -0
  8. package/dist/lib/components/download-document-configuration/download-document-configuration.component.d.ts +25 -0
  9. package/dist/lib/components/epistola-configuration/epistola-configuration.component.d.ts +29 -0
  10. package/dist/lib/components/epistola-download/epistola-download.component.d.ts +24 -0
  11. package/dist/lib/components/epistola-download/epistola-download.formio.d.ts +4 -0
  12. package/dist/lib/components/field-tree/field-tree.component.d.ts +75 -0
  13. package/dist/lib/components/generate-document-configuration/generate-document-configuration.component.d.ts +78 -0
  14. package/dist/lib/epistola.module.d.ts +17 -0
  15. package/dist/lib/epistola.specification.d.ts +3 -0
  16. package/dist/lib/models/config.d.ts +49 -0
  17. package/dist/lib/models/index.d.ts +2 -0
  18. package/dist/lib/models/template.d.ts +63 -0
  19. package/dist/lib/services/epistola-plugin.service.d.ts +42 -0
  20. package/dist/lib/services/index.d.ts +1 -0
  21. package/dist/public_api.d.ts +12 -0
  22. package/ng-package.json +17 -0
  23. package/package.json +38 -0
  24. package/src/lib/assets/epistola-logo.ts +4 -0
  25. package/src/lib/assets/index.ts +1 -0
  26. package/src/lib/components/check-job-status-configuration/check-job-status-configuration.component.html +51 -0
  27. package/src/lib/components/check-job-status-configuration/check-job-status-configuration.component.scss +1 -0
  28. package/src/lib/components/check-job-status-configuration/check-job-status-configuration.component.ts +71 -0
  29. package/src/lib/components/data-mapping-tree/data-mapping-tree.component.html +23 -0
  30. package/src/lib/components/data-mapping-tree/data-mapping-tree.component.scss +38 -0
  31. package/src/lib/components/data-mapping-tree/data-mapping-tree.component.ts +124 -0
  32. package/src/lib/components/download-document-configuration/download-document-configuration.component.html +29 -0
  33. package/src/lib/components/download-document-configuration/download-document-configuration.component.scss +1 -0
  34. package/src/lib/components/download-document-configuration/download-document-configuration.component.ts +71 -0
  35. package/src/lib/components/epistola-configuration/epistola-configuration.component.html +74 -0
  36. package/src/lib/components/epistola-configuration/epistola-configuration.component.scss +1 -0
  37. package/src/lib/components/epistola-configuration/epistola-configuration.component.ts +96 -0
  38. package/src/lib/components/epistola-download/epistola-download.component.ts +79 -0
  39. package/src/lib/components/epistola-download/epistola-download.formio.ts +19 -0
  40. package/src/lib/components/field-tree/field-tree.component.html +192 -0
  41. package/src/lib/components/field-tree/field-tree.component.scss +255 -0
  42. package/src/lib/components/field-tree/field-tree.component.ts +321 -0
  43. package/src/lib/components/generate-document-configuration/generate-document-configuration.component.html +182 -0
  44. package/src/lib/components/generate-document-configuration/generate-document-configuration.component.scss +150 -0
  45. package/src/lib/components/generate-document-configuration/generate-document-configuration.component.ts +422 -0
  46. package/src/lib/epistola.module.ts +50 -0
  47. package/src/lib/epistola.specification.ts +208 -0
  48. package/src/lib/models/config.ts +53 -0
  49. package/src/lib/models/index.ts +2 -0
  50. package/src/lib/models/template.ts +70 -0
  51. package/src/lib/services/epistola-plugin.service.ts +82 -0
  52. package/src/lib/services/index.ts +1 -0
  53. package/src/public_api.ts +16 -0
  54. package/tsconfig.lib.json +21 -0
@@ -0,0 +1,53 @@
1
+ import {PluginConfigurationData} from '@valtimo/plugin';
2
+
3
+ /**
4
+ * Plugin-level configuration for Epistola.
5
+ * Contains connection settings and defaults.
6
+ */
7
+ export interface EpistolaPluginConfig extends PluginConfigurationData {
8
+ baseUrl: string;
9
+ apiKey: string;
10
+ tenantId: string;
11
+ defaultEnvironmentId?: string;
12
+ templateSyncEnabled?: boolean;
13
+ }
14
+
15
+ /**
16
+ * Action configuration for the generate-document action.
17
+ * Contains all parameters needed to generate a document.
18
+ *
19
+ * Variant selection supports two modes:
20
+ * - Explicit: set variantId directly
21
+ * - By attributes: set variantAttributes with key-value pairs (values can be value resolver expressions)
22
+ */
23
+ export interface GenerateDocumentConfig {
24
+ templateId: string;
25
+ variantId?: string;
26
+ variantAttributes?: Record<string, string>;
27
+ environmentId?: string;
28
+ dataMapping: Record<string, any>;
29
+ outputFormat: 'PDF' | 'HTML';
30
+ filename: string;
31
+ correlationId?: string;
32
+ resultProcessVariable: string;
33
+ }
34
+
35
+ /**
36
+ * Action configuration for the check-job-status action.
37
+ * Specifies which process variables to read from and write to.
38
+ */
39
+ export interface CheckJobStatusConfig {
40
+ requestIdVariable: string;
41
+ statusVariable: string;
42
+ documentIdVariable?: string;
43
+ errorMessageVariable?: string;
44
+ }
45
+
46
+ /**
47
+ * Action configuration for the download-document action.
48
+ * Specifies which process variables to read from and write to.
49
+ */
50
+ export interface DownloadDocumentConfig {
51
+ documentIdVariable: string;
52
+ contentVariable: string;
53
+ }
@@ -0,0 +1,2 @@
1
+ export * from './config';
2
+ export * from './template';
@@ -0,0 +1,70 @@
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
+ /**
11
+ * Detailed information about an Epistola template including its fields.
12
+ */
13
+ export interface TemplateDetails {
14
+ id: string;
15
+ name: string;
16
+ fields: TemplateField[];
17
+ }
18
+
19
+ /**
20
+ * Represents a field in an Epistola template.
21
+ * Supports nested structures through the children property.
22
+ */
23
+ export interface TemplateField {
24
+ name: string;
25
+ path: string;
26
+ type: string;
27
+ fieldType: 'SCALAR' | 'OBJECT' | 'ARRAY';
28
+ required: boolean;
29
+ description?: string;
30
+ children?: TemplateField[];
31
+ }
32
+
33
+ /**
34
+ * Represents a single data mapping entry.
35
+ */
36
+ export interface DataMappingEntry {
37
+ templateField: string;
38
+ dataSource: string;
39
+ }
40
+
41
+ /**
42
+ * Source type for data mapping: how the value is provided.
43
+ */
44
+ export type DataSourceType = 'document' | 'processVariable' | 'manual';
45
+
46
+ /**
47
+ * Validation result from the backend.
48
+ */
49
+ export interface ValidationResult {
50
+ valid: boolean;
51
+ missingRequiredFields: string[];
52
+ }
53
+
54
+ /**
55
+ * Information about an Epistola environment.
56
+ */
57
+ export interface EnvironmentInfo {
58
+ id: string;
59
+ name: string;
60
+ }
61
+
62
+ /**
63
+ * Information about an Epistola template variant.
64
+ */
65
+ export interface VariantInfo {
66
+ id: string;
67
+ templateId: string;
68
+ name: string;
69
+ attributes: Record<string, string>;
70
+ }
@@ -0,0 +1,82 @@
1
+ import {Injectable} from '@angular/core';
2
+ import {HttpClient} from '@angular/common/http';
3
+ import {ConfigService} from '@valtimo/shared';
4
+ import {Observable} from 'rxjs';
5
+ import {EnvironmentInfo, TemplateDetails, TemplateInfo, ValidationResult, VariantInfo} from '../models';
6
+
7
+ /**
8
+ * Service for interacting with Epistola plugin API endpoints.
9
+ * Provides methods to fetch templates, environments, variants,
10
+ * process variables, and validate mappings.
11
+ */
12
+ @Injectable()
13
+ export class EpistolaPluginService {
14
+ private readonly apiEndpoint: string;
15
+
16
+ constructor(
17
+ private readonly http: HttpClient,
18
+ private readonly configService: ConfigService
19
+ ) {
20
+ this.apiEndpoint = `${this.configService.config.valtimoApi.endpointUri}v1/plugin/epistola`;
21
+ }
22
+
23
+ /**
24
+ * Get all available templates for a plugin configuration.
25
+ */
26
+ getTemplates(pluginConfigurationId: string): Observable<TemplateInfo[]> {
27
+ return this.http.get<TemplateInfo[]>(
28
+ `${this.apiEndpoint}/configurations/${pluginConfigurationId}/templates`
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Get template details including its fields.
34
+ */
35
+ getTemplateDetails(pluginConfigurationId: string, templateId: string): Observable<TemplateDetails> {
36
+ return this.http.get<TemplateDetails>(
37
+ `${this.apiEndpoint}/configurations/${pluginConfigurationId}/templates/${templateId}`
38
+ );
39
+ }
40
+
41
+ /**
42
+ * Get all available environments for a plugin configuration.
43
+ */
44
+ getEnvironments(pluginConfigurationId: string): Observable<EnvironmentInfo[]> {
45
+ return this.http.get<EnvironmentInfo[]>(
46
+ `${this.apiEndpoint}/configurations/${pluginConfigurationId}/environments`
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Get all variants for a specific template.
52
+ */
53
+ getVariants(pluginConfigurationId: string, templateId: string): Observable<VariantInfo[]> {
54
+ return this.http.get<VariantInfo[]>(
55
+ `${this.apiEndpoint}/configurations/${pluginConfigurationId}/templates/${templateId}/variants`
56
+ );
57
+ }
58
+
59
+ /**
60
+ * Discover process variable names for a given process definition.
61
+ */
62
+ getProcessVariables(processDefinitionKey: string): Observable<string[]> {
63
+ return this.http.get<string[]>(
64
+ `${this.apiEndpoint}/process-variables`,
65
+ {params: {processDefinitionKey}}
66
+ );
67
+ }
68
+
69
+ /**
70
+ * Validate that a data mapping covers all required template fields.
71
+ */
72
+ validateMapping(
73
+ pluginConfigurationId: string,
74
+ templateId: string,
75
+ dataMapping: Record<string, any>
76
+ ): Observable<ValidationResult> {
77
+ return this.http.post<ValidationResult>(
78
+ `${this.apiEndpoint}/configurations/${pluginConfigurationId}/templates/${templateId}/validate-mapping`,
79
+ {dataMapping}
80
+ );
81
+ }
82
+ }
@@ -0,0 +1 @@
1
+ export * from './epistola-plugin.service';
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Public API Surface of epistola plugin
3
+ */
4
+
5
+ export * from './lib/models';
6
+ export * from './lib/services';
7
+ export * from './lib/epistola.module';
8
+ export * from './lib/epistola.specification';
9
+ export * from './lib/components/epistola-configuration/epistola-configuration.component';
10
+ export * from './lib/components/generate-document-configuration/generate-document-configuration.component';
11
+ export * from './lib/components/check-job-status-configuration/check-job-status-configuration.component';
12
+ export * from './lib/components/download-document-configuration/download-document-configuration.component';
13
+ export * from './lib/components/field-tree/field-tree.component';
14
+ export * from './lib/components/data-mapping-tree/data-mapping-tree.component';
15
+ export * from './lib/components/epistola-download/epistola-download.component';
16
+ export * from './lib/components/epistola-download/epistola-download.formio';
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "../../out-tsc/lib",
4
+ "target": "ES2022",
5
+ "module": "ES2022",
6
+ "moduleResolution": "node",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "sourceMap": true,
11
+ "importHelpers": true,
12
+ "experimentalDecorators": true,
13
+ "emitDecoratorMetadata": true,
14
+ "lib": ["ES2022", "dom"],
15
+ "types": []
16
+ },
17
+ "angularCompilerOptions": {
18
+ "compilationMode": "partial"
19
+ },
20
+ "exclude": ["**/*.spec.ts"]
21
+ }