@epistola.app/valtimo-plugin 0.4.5 → 0.5.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.
@@ -20,12 +20,15 @@ export declare class GenerateDocumentConfigurationComponent implements FunctionC
20
20
  context$?: Observable<[ManagementContext, CaseManagementParams]>;
21
21
  valid: EventEmitter<boolean>;
22
22
  configuration: EventEmitter<GenerateDocumentConfig>;
23
+ catalogs$: BehaviorSubject<AsyncResource<SelectItem[]>>;
23
24
  templates$: BehaviorSubject<AsyncResource<SelectItem[]>>;
24
25
  variants$: BehaviorSubject<AsyncResource<SelectItem[]>>;
25
26
  environments$: BehaviorSubject<AsyncResource<SelectItem[]>>;
26
27
  templateFields$: BehaviorSubject<AsyncResource<TemplateField[]>>;
27
28
  dataMapping$: BehaviorSubject<Record<string, any>>;
28
29
  outputFormatOptions: SelectItem[];
30
+ readonly selectedCatalogId$: BehaviorSubject<string>;
31
+ /** Composite ID: "catalogId/templateId" */
29
32
  readonly selectedTemplateId$: BehaviorSubject<string>;
30
33
  readonly selectedVariantId$: BehaviorSubject<string>;
31
34
  variantSelectionMode: VariantSelectionMode;
@@ -48,6 +51,8 @@ export declare class GenerateDocumentConfigurationComponent implements FunctionC
48
51
  private readonly formValue$;
49
52
  private readonly valid$;
50
53
  private pluginConfigurationId$;
54
+ /** Resolves once with the prefill config (or empty config if none). */
55
+ private prefill$;
51
56
  constructor(epistolaPluginService: EpistolaPluginService, processLinkStateService: ProcessLinkStateService, cdr: ChangeDetectorRef);
52
57
  ngOnInit(): void;
53
58
  ngOnDestroy(): void;
@@ -75,14 +80,25 @@ export declare class GenerateDocumentConfigurationComponent implements FunctionC
75
80
  }): void;
76
81
  private revalidate;
77
82
  private formatAttributes;
83
+ /**
84
+ * Creates a shared observable that resolves once with the prefill config
85
+ * (or null if no prefill is provided). This is used to seed the cascade
86
+ * with initial selection values before any loading starts.
87
+ */
88
+ private resolvePrefill$;
78
89
  private initContext;
79
- private initPrefill;
80
90
  private initPluginConfiguration;
81
- private initTemplatesLoading;
82
- private initEnvironmentsLoading;
83
- private initAttributesLoading;
84
- private initVariantsLoading;
85
- private initTemplateFieldsLoading;
91
+ /**
92
+ * Sets up the entire reactive cascade:
93
+ *
94
+ * pluginConfigurationId$ → catalogs (+ environments independently)
95
+ * prefill + catalogs loaded → seed selectedCatalogId$
96
+ * selectedCatalogId$ → templates (+ attributes)
97
+ * prefill + templates loaded → seed selectedTemplateId$
98
+ * selectedTemplateId$ → variants + templateFields
99
+ * prefill + templateFields loaded → seed dataMapping
100
+ */
101
+ private initCascade;
86
102
  private loadProcessVariables;
87
103
  private handleValid;
88
104
  private openSaveSubscription;
@@ -29,6 +29,7 @@ export interface VariantAttributeEntry {
29
29
  * - By attributes: set variantAttributes with key-value pairs (values can be value resolver expressions)
30
30
  */
31
31
  export interface GenerateDocumentConfig {
32
+ catalogId: string;
32
33
  templateId: string;
33
34
  variantId?: string;
34
35
  variantAttributes?: VariantAttributeEntry[];
@@ -5,6 +5,8 @@ export interface TemplateInfo {
5
5
  id: string;
6
6
  name: string;
7
7
  description?: string;
8
+ catalogId?: string;
9
+ catalogName?: string;
8
10
  }
9
11
  /**
10
12
  * Detailed information about an Epistola template including its fields.
@@ -68,3 +70,11 @@ export interface AttributeDefinition {
68
70
  key: string;
69
71
  description?: string;
70
72
  }
73
+ /**
74
+ * Information about an Epistola catalog.
75
+ */
76
+ export interface CatalogInfo {
77
+ id: string;
78
+ name: string;
79
+ type: string;
80
+ }
@@ -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, EnvironmentInfo, PreviewSource, TemplateDetails, TemplateInfo, ValidationResult, VariantInfo } from '../models';
4
+ import { AttributeDefinition, CatalogInfo, EnvironmentInfo, PreviewSource, TemplateDetails, TemplateInfo, ValidationResult, VariantInfo } from '../models';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Service for interacting with Epistola plugin API endpoints.
@@ -14,17 +14,21 @@ export declare class EpistolaPluginService {
14
14
  private readonly apiEndpoint;
15
15
  constructor(http: HttpClient, configService: ConfigService);
16
16
  /**
17
- * Get all available templates for a plugin configuration.
17
+ * Get all available catalogs for a plugin configuration.
18
18
  */
19
- getTemplates(pluginConfigurationId: string): Observable<TemplateInfo[]>;
19
+ getCatalogs(pluginConfigurationId: string): Observable<CatalogInfo[]>;
20
+ /**
21
+ * Get all available templates for a plugin configuration and catalog.
22
+ */
23
+ getTemplates(pluginConfigurationId: string, catalogId?: string): Observable<TemplateInfo[]>;
20
24
  /**
21
25
  * Get template details including its fields.
22
26
  */
23
- getTemplateDetails(pluginConfigurationId: string, templateId: string): Observable<TemplateDetails>;
27
+ getTemplateDetails(pluginConfigurationId: string, templateId: string, catalogId: string): Observable<TemplateDetails>;
24
28
  /**
25
- * Get all attribute definitions for a plugin configuration's tenant.
29
+ * Get all attribute definitions for a plugin configuration's tenant and catalog.
26
30
  */
27
- getAttributes(pluginConfigurationId: string): Observable<AttributeDefinition[]>;
31
+ getAttributes(pluginConfigurationId: string, catalogId: string): Observable<AttributeDefinition[]>;
28
32
  /**
29
33
  * Get all available environments for a plugin configuration.
30
34
  */
@@ -32,7 +36,7 @@ export declare class EpistolaPluginService {
32
36
  /**
33
37
  * Get all variants for a specific template.
34
38
  */
35
- getVariants(pluginConfigurationId: string, templateId: string): Observable<VariantInfo[]>;
39
+ getVariants(pluginConfigurationId: string, templateId: string, catalogId: string): Observable<VariantInfo[]>;
36
40
  /**
37
41
  * Discover process variable names for a given process definition.
38
42
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epistola.app/valtimo-plugin",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
4
4
  "description": "Epistola document generation plugin for Valtimo",
5
5
  "license": "EUPL-1.2",
6
6
  "repository": {