@masterteam/workflow 0.0.35 → 0.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/workflow",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/workflow",
6
6
  "linkDirectory": false,
@@ -19,12 +19,12 @@
19
19
  "tailwindcss": "^4.2.2",
20
20
  "tailwindcss-primeui": "^0.6.1",
21
21
  "@ngxs/store": "^20.1.0",
22
- "@masterteam/icons": "^0.0.14",
23
22
  "@masterteam/forms": "^0.0.72",
23
+ "@masterteam/icons": "^0.0.14",
24
24
  "@masterteam/form-builder": "^0.0.25",
25
- "@masterteam/structure-builder": "^0.0.50",
26
- "@masterteam/components": "^0.0.158",
27
- "@masterteam/notification": "^0.0.20"
25
+ "@masterteam/notification": "^0.0.20",
26
+ "@masterteam/structure-builder": "^0.0.52",
27
+ "@masterteam/components": "^0.0.162"
28
28
  },
29
29
  "sideEffects": false,
30
30
  "exports": {
@@ -16,8 +16,12 @@ interface LoadingStateShape<L extends string = string> {
16
16
  errors: Partial<Record<L, string>>;
17
17
  }
18
18
 
19
- type WorkflowStepType = 'UserInput' | 'AppAction';
19
+ type WorkflowStepType = 'UserInput' | 'AppAction' | 'ApprovalCommit';
20
20
  type WorkflowAppActionFailureBehavior = 'Stop' | 'Continue' | string;
21
+ type WorkflowAppActionPhase = 'BeforeCommit' | 'Commit' | 'AfterCommit' | string;
22
+ type WorkflowAppActionRuntimeInputSource = 'Context' | 'InternalResolver' | string;
23
+ type WorkflowAppActionFieldUIControl = 'select' | 'text' | 'number' | 'toggle' | 'json' | string;
24
+ type WorkflowAppActionSystemKind = 'ApprovalCommit' | string;
21
25
  type WorkflowAppActionConfigPropertyType = 'string' | 'number' | 'boolean' | 'array' | 'object';
22
26
  interface WorkflowAppAction {
23
27
  appCode: string;
@@ -30,6 +34,42 @@ interface WorkflowAppAction {
30
34
  configSchemaJson?: string | null;
31
35
  requiredContextKeys?: string[];
32
36
  supportedScopes?: string[];
37
+ configFields?: WorkflowAppActionConfigField[];
38
+ runtimeInputs?: WorkflowAppActionRuntimeInput[];
39
+ outputs?: WorkflowAppActionOutput[];
40
+ supportedPhases?: WorkflowAppActionPhase[];
41
+ }
42
+ interface WorkflowAppActionConfigField {
43
+ key: string;
44
+ displayName: string;
45
+ description?: string | null;
46
+ type: WorkflowAppActionConfigPropertyType;
47
+ required: boolean;
48
+ uiControl?: WorkflowAppActionFieldUIControl | null;
49
+ optionsProviderKey?: string | null;
50
+ designerVisible: boolean;
51
+ enumValues?: Array<string | number | boolean>;
52
+ defaultValue?: unknown;
53
+ }
54
+ interface WorkflowAppActionRuntimeInput {
55
+ key: string;
56
+ source: WorkflowAppActionRuntimeInputSource;
57
+ contextKey?: string | null;
58
+ resolverKey?: string | null;
59
+ required: boolean;
60
+ designerVisible: boolean;
61
+ }
62
+ interface WorkflowAppActionOutput {
63
+ key: string;
64
+ type: string;
65
+ persistToWorkflowContext: boolean;
66
+ description?: string | null;
67
+ }
68
+ interface WorkflowAppActionOption {
69
+ value: string | number | boolean;
70
+ label: string | Record<string, string>;
71
+ disabled?: boolean;
72
+ metadata?: Record<string, string | number | boolean | null>;
33
73
  }
34
74
  interface WorkflowAppActionDescriptor {
35
75
  appCode: string;
@@ -39,6 +79,10 @@ interface WorkflowAppActionDescriptor {
39
79
  configSchemaJson?: string | null;
40
80
  requiredContextKeys?: string[];
41
81
  supportedScopes?: string[];
82
+ configFields?: WorkflowAppActionConfigField[];
83
+ runtimeInputs?: WorkflowAppActionRuntimeInput[];
84
+ outputs?: WorkflowAppActionOutput[];
85
+ supportedPhases?: WorkflowAppActionPhase[];
42
86
  }
43
87
  interface WorkflowAppActionConfigPropertySchema {
44
88
  key: string;
@@ -64,6 +108,9 @@ interface WorkflowStepSchema {
64
108
  targetValue?: string;
65
109
  appAction?: WorkflowAppAction | null;
66
110
  loading?: boolean;
111
+ systemKind?: WorkflowAppActionSystemKind | null;
112
+ isSystem?: boolean;
113
+ isLocked?: boolean;
67
114
  }
68
115
  interface WorkflowConnection {
69
116
  id: number;
@@ -165,6 +212,9 @@ interface StepSchema {
165
212
  hasNotification: boolean;
166
213
  hasForm?: boolean;
167
214
  appAction?: WorkflowAppAction | null;
215
+ systemKind?: WorkflowAppActionSystemKind | null;
216
+ isSystem?: boolean;
217
+ isLocked?: boolean;
168
218
  }
169
219
  interface StepPropertyPayload {
170
220
  PropertyId: number;
@@ -196,6 +246,9 @@ interface StepResponse {
196
246
  targetValue?: string;
197
247
  properties: any[];
198
248
  appAction?: WorkflowAppAction | null;
249
+ systemKind?: WorkflowAppActionSystemKind | null;
250
+ isSystem?: boolean;
251
+ isLocked?: boolean;
199
252
  }
200
253
  interface ConnectionPayload {
201
254
  sourceStepId: number | string;
@@ -221,7 +274,19 @@ interface PublishResponse {
221
274
  isValid: boolean;
222
275
  isPublished: boolean;
223
276
  }
224
- type WorkflowLoadingName = 'getWorkflows' | 'getWorkflow' | 'getFormulaProperties' | 'getGroups' | 'getRolesForModule' | 'getAppActions' | 'getAppActionDetail' | 'getStep' | 'validateFlow' | 'createStep' | 'updateStep' | 'createConnection' | 'updateConnection' | 'publishWorkflow' | 'deleteStep' | 'deleteConnection';
277
+ type WorkflowLoadingName = 'getWorkflows' | 'getWorkflow' | 'getFormulaProperties' | 'getGroups' | 'getRolesForModule' | 'getAppActions' | 'getAppActionDetail' | 'getAppActionOptions' | 'getStep' | 'validateFlow' | 'createStep' | 'updateStep' | 'createConnection' | 'updateConnection' | 'publishWorkflow' | 'deleteStep' | 'deleteConnection';
278
+ /**
279
+ * Cached option list keyed by `${actionKey}::${fieldKey}::${paramHash}`.
280
+ * `paramHash` is a deterministic stringification of the query params used
281
+ * (requestSchemaId, levelId, moduleId, ...). Empty params hash is "_".
282
+ */
283
+ type WorkflowAppActionOptionsCacheKey = string;
284
+ interface WorkflowAppActionOptionsCacheEntry {
285
+ options: WorkflowAppActionOption[];
286
+ errorCode?: string | null;
287
+ errorMessage?: string | null;
288
+ loadedAt: number;
289
+ }
225
290
  interface WorkflowStateModel extends LoadingStateShape<WorkflowLoadingName> {
226
291
  workflowId: string | number | null;
227
292
  parentModuleType?: string | null;
@@ -236,6 +301,7 @@ interface WorkflowStateModel extends LoadingStateShape<WorkflowLoadingName> {
236
301
  roles: Array<RoleDefinition | RoleGroupDefinition>;
237
302
  appActionDescriptors: WorkflowAppActionDescriptor[];
238
303
  selectedAppActionDescriptor: WorkflowAppActionDescriptor | null;
304
+ appActionOptionsCache: Record<WorkflowAppActionOptionsCacheKey, WorkflowAppActionOptionsCacheEntry>;
239
305
  selectedStep: StepSchema | null;
240
306
  isFlowValid: boolean | null;
241
307
  }
@@ -274,6 +340,13 @@ declare class GetAppActionDetail {
274
340
  static readonly type = "[Workflow] Get App Action Detail";
275
341
  constructor(actionKey: string);
276
342
  }
343
+ declare class GetAppActionOptions {
344
+ readonly actionKey: string;
345
+ readonly fieldKey: string;
346
+ readonly params?: Record<string, string | number | boolean | null | undefined> | undefined;
347
+ static readonly type = "[Workflow] Get App Action Options";
348
+ constructor(actionKey: string, fieldKey: string, params?: Record<string, string | number | boolean | null | undefined> | undefined);
349
+ }
277
350
  declare class GetStep {
278
351
  readonly stepId: string | number;
279
352
  static readonly type = "[Workflow] Get Step";
@@ -333,6 +406,7 @@ declare class WorkflowFacade {
333
406
  readonly roles: _angular_core.Signal<(RoleDefinition | RoleGroupDefinition)[]>;
334
407
  readonly appActionDescriptors: _angular_core.Signal<WorkflowAppActionDescriptor[]>;
335
408
  readonly selectedAppActionDescriptor: _angular_core.Signal<WorkflowAppActionDescriptor | null>;
409
+ readonly appActionOptionsCache: _angular_core.Signal<Record<string, WorkflowAppActionOptionsCacheEntry>>;
336
410
  readonly selectedStep: _angular_core.Signal<StepSchema | null>;
337
411
  readonly isFlowValid: _angular_core.Signal<boolean | null>;
338
412
  readonly steps: _angular_core.Signal<WorkflowStepSchema[]>;
@@ -348,6 +422,13 @@ declare class WorkflowFacade {
348
422
  loadRolesForModule(): Observable<unknown>;
349
423
  loadAppActions(): Observable<unknown>;
350
424
  loadAppActionDetail(actionKey: string): Observable<unknown>;
425
+ loadAppActionOptions(actionKey: string, fieldKey: string, params?: Record<string, string | number | boolean | null | undefined>): Observable<unknown>;
426
+ /**
427
+ * Synchronous lookup helper: returns the cached options entry for a given
428
+ * (actionKey, fieldKey, params) combination, or `undefined` if the request
429
+ * has not been issued yet. Pair with `loadAppActionOptions` to fetch.
430
+ */
431
+ getCachedAppActionOptions(actionKey: string, fieldKey: string, params?: Record<string, string | number | boolean | null | undefined>): WorkflowAppActionOptionsCacheEntry | undefined;
351
432
  loadStep(stepId: string | number): Observable<unknown>;
352
433
  validateFlow(): Observable<unknown>;
353
434
  createStep(payload: StepPayload): Observable<unknown>;
@@ -388,6 +469,7 @@ declare class WorkflowState {
388
469
  static roles(state: WorkflowStateModel): Array<RoleDefinition | RoleGroupDefinition>;
389
470
  static appActionDescriptors(state: WorkflowStateModel): WorkflowAppActionDescriptor[];
390
471
  static selectedAppActionDescriptor(state: WorkflowStateModel): WorkflowAppActionDescriptor | null;
472
+ static appActionOptionsCache(state: WorkflowStateModel): Record<string, WorkflowAppActionOptionsCacheEntry>;
391
473
  static selectedStep(state: WorkflowStateModel): StepSchema | null;
392
474
  static isFlowValid(state: WorkflowStateModel): boolean | null;
393
475
  static stepsSchema(state: WorkflowStateModel): WorkflowStepSchema[];
@@ -402,6 +484,7 @@ declare class WorkflowState {
402
484
  getRolesForModule(ctx: StateContext<WorkflowStateModel>, _action: GetRolesForModule): rxjs.Observable<never[] | Response<unknown[]>>;
403
485
  getAppActions(ctx: StateContext<WorkflowStateModel>, _action: GetAppActions): rxjs.Observable<WorkflowAppActionDescriptor[]> | rxjs.Observable<never[] | Response<unknown>>;
404
486
  getAppActionDetail(ctx: StateContext<WorkflowStateModel>, action: GetAppActionDetail): rxjs.Observable<WorkflowAppActionDescriptor> | rxjs.Observable<Response<unknown> | null>;
487
+ getAppActionOptions(ctx: StateContext<WorkflowStateModel>, action: GetAppActionOptions): rxjs.Observable<WorkflowAppActionOption[] | Response<unknown>>;
405
488
  getStep(ctx: StateContext<WorkflowStateModel>, action: GetStep): rxjs.Observable<Response<StepSchema> | null>;
406
489
  validateFlow(ctx: StateContext<WorkflowStateModel>, _action: ValidateFlow): rxjs.Observable<Response<boolean> | null>;
407
490
  createStep(ctx: StateContext<WorkflowStateModel>, action: CreateStep): rxjs.Observable<Response<StepResponse> | null>;
@@ -414,22 +497,34 @@ declare class WorkflowState {
414
497
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<WorkflowState, never>;
415
498
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<WorkflowState>;
416
499
  }
500
+ /**
501
+ * Build a deterministic cache key for an options request:
502
+ * `{actionKey}::{fieldKey}::{paramHash}`. The param hash is a sorted
503
+ * `key=value&...` string of non-empty params, or `_` if none.
504
+ */
505
+ declare function buildAppActionOptionsCacheKey(actionKey: string, fieldKey: string, params?: Record<string, string | number | boolean | null | undefined>): string;
417
506
 
418
- type WorkflowAppActionConfigFieldKind = 'text' | 'number' | 'toggle' | 'select' | 'json';
419
- interface WorkflowAppActionConfigField {
507
+ type WorkflowAppActionConfigEditorFieldKind = 'text' | 'number' | 'toggle' | 'select' | 'json';
508
+ interface WorkflowAppActionConfigEditorField {
420
509
  key: string;
421
510
  title: string;
422
511
  description?: string | null;
423
512
  type: WorkflowAppActionConfigPropertyType;
424
- kind: WorkflowAppActionConfigFieldKind;
513
+ kind: WorkflowAppActionConfigEditorFieldKind;
425
514
  required: boolean;
426
515
  enumValues?: Array<string | number | boolean>;
427
516
  jsonValueType?: 'array' | 'object';
517
+ /**
518
+ * When set, the select dropdown is populated dynamically by calling
519
+ * `GET /api/workflow-app-actions/actions/{actionKey}/options/{fieldKey}`
520
+ * via `WorkflowFacade.loadAppActionOptions` rather than from `enumValues`.
521
+ */
522
+ optionsProviderKey?: string | null;
428
523
  }
429
524
  interface WorkflowAppActionConfigEditorDefinition {
430
525
  mode: 'schema' | 'raw';
431
526
  schema: WorkflowAppActionConfigSchema | null;
432
- fields: WorkflowAppActionConfigField[];
527
+ fields: WorkflowAppActionConfigEditorField[];
433
528
  errors: string[];
434
529
  }
435
530
 
@@ -444,6 +539,8 @@ declare class WorkflowBuilder {
444
539
  private lastAppActionDescriptorSignature;
445
540
  readonly mainTab: _angular_core.WritableSignal<"workflow" | "notification">;
446
541
  readonly selectedTab: _angular_core.WritableSignal<"tab1" | "tab2" | "tab3">;
542
+ readonly resolvedAutomaticallyOpen: _angular_core.WritableSignal<boolean>;
543
+ readonly outputsOpen: _angular_core.WritableSignal<boolean>;
447
544
  readonly isPublished: _angular_core.WritableSignal<boolean>;
448
545
  readonly isEditingInitialNode: _angular_core.WritableSignal<boolean>;
449
546
  readonly isCreatingStep: _angular_core.WritableSignal<boolean>;
@@ -471,6 +568,7 @@ declare class WorkflowBuilder {
471
568
  readonly loadingAppActions: _angular_core.Signal<boolean>;
472
569
  readonly loadingAppActionDetail: _angular_core.Signal<boolean>;
473
570
  readonly appActionListError: _angular_core.Signal<string | null>;
571
+ readonly publishError: _angular_core.Signal<string | null>;
474
572
  readonly appActionDetailError: _angular_core.Signal<string | null>;
475
573
  readonly selectedWorkflowId: _angular_core.Signal<number | undefined>;
476
574
  readonly connectionFormulaSchemaId: _angular_core.Signal<number | undefined>;
@@ -505,6 +603,23 @@ declare class WorkflowBuilder {
505
603
  label: string;
506
604
  value: string;
507
605
  }[]>;
606
+ /**
607
+ * Modal-config providers — these are functions because Angular's input
608
+ * binding doesn't re-evaluate inside a synchronous emit→read sequence,
609
+ * so reading `currentStepType()` from a `computed` would still see the
610
+ * stale value at the moment structure-builder reads the input. Passing
611
+ * functions lets structure-builder call them at dialog-open time with
612
+ * the node data, where we read `node.type` directly.
613
+ */
614
+ readonly editorDrawerStyleClass: (node: {
615
+ type?: string;
616
+ } | null) => "!w-[42rem] !absolute !shadow-none" | "!w-[25rem] !absolute !shadow-none";
617
+ readonly editorAddHeader: (node: {
618
+ type?: string;
619
+ } | null) => string;
620
+ readonly editorUpdateHeader: (node: {
621
+ type?: string;
622
+ } | null) => string;
508
623
  readonly tabsList: _angular_core.Signal<{
509
624
  label: string;
510
625
  value: string;
@@ -550,8 +665,8 @@ declare class WorkflowBuilder {
550
665
  variant: string;
551
666
  size: string;
552
667
  tooltip: string;
668
+ condition: (node: WorkflowStepSchema) => boolean;
553
669
  severity?: undefined;
554
- condition?: undefined;
555
670
  } | {
556
671
  key: string;
557
672
  icon: string;
@@ -583,6 +698,9 @@ declare class WorkflowBuilder {
583
698
  targetValue?: string;
584
699
  appAction?: _masterteam_workflow.WorkflowAppAction | null;
585
700
  loading?: boolean;
701
+ systemKind?: _masterteam_workflow.WorkflowAppActionSystemKind | null;
702
+ isSystem?: boolean;
703
+ isLocked?: boolean;
586
704
  }[]>;
587
705
  readonly connections: _angular_core.Signal<{
588
706
  from: number;
@@ -607,11 +725,51 @@ declare class WorkflowBuilder {
607
725
  getStepCardTitle(step: WorkflowStepSchema): string;
608
726
  getStepTypeLabel(type: WorkflowStepType): string;
609
727
  getAppActionConfigControl(key: string): FormControl;
610
- getAppActionEnumOptions(field: WorkflowAppActionConfigField): {
728
+ getAppActionEnumOptions(field: WorkflowAppActionConfigEditorField): {
611
729
  label: string;
612
730
  value: string | number | boolean;
613
731
  }[];
732
+ /**
733
+ * Lookup the cached dynamic options for a given config field. Returns
734
+ * an empty array on backend error so the template can render an error
735
+ * state, or `undefined` when no fetch has been issued yet.
736
+ */
737
+ private getDynamicAppActionOptions;
738
+ hasAppActionOptionsError(fieldKey: string): string | null;
739
+ private buildAppActionOptionsParams;
740
+ /**
741
+ * Fire option-loading for every descriptor `select` field that uses
742
+ * an `optionsProviderKey`. Called whenever the editor is rebuilt or
743
+ * the active actionKey changes.
744
+ */
745
+ private loadDynamicAppActionOptions;
614
746
  getAppActionDescription(): string | null;
747
+ /** Runtime inputs are non-editable (resolved at runtime); the editor
748
+ * shows them as read-only "Resolved automatically" hints. */
749
+ getAppActionRuntimeInputs(): _masterteam_workflow.WorkflowAppActionRuntimeInput[];
750
+ /** Outputs are read-only informational hints. */
751
+ getAppActionOutputs(): _masterteam_workflow.WorkflowAppActionOutput[];
752
+ /** Phases the action supports (e.g. ['AfterCommit']). Drives the
753
+ * placement warning when the step is placed before the commit step. */
754
+ getAppActionSupportedPhases(): string[];
755
+ /**
756
+ * `true` when the current action is restricted to `AfterCommit` and
757
+ * therefore should be placed downstream of the `Commit Approved Form`
758
+ * step. Surfaces an inline guidance hint in the editor.
759
+ */
760
+ isAppActionAfterCommitOnly(): boolean;
761
+ /**
762
+ * `true` when an actionKey is set, descriptor lookup is not in flight,
763
+ * and we still have no resolvable descriptor — i.e. the backend returned
764
+ * `data: null` for the descriptor describe-one call. The saved config
765
+ * is preserved per the AppActions handoff §5.3.
766
+ */
767
+ isAppActionMissing(): boolean;
768
+ describeRuntimeInputSource(input: {
769
+ source: string;
770
+ contextKey?: string | null;
771
+ resolverKey?: string | null;
772
+ }): string;
615
773
  getAppActionDisplayName(): string;
616
774
  getAppActionKey(): string;
617
775
  getAppActionConfigMessages(): string[];
@@ -644,5 +802,5 @@ declare const REQUEST_CONTEXT: HttpContextToken<{
644
802
  useBaseUrl: boolean;
645
803
  }>;
646
804
 
647
- export { CreateConnection, CreateStep, DeleteConnection, DeleteStep, GetAppActionDetail, GetAppActions, GetFormulaProperties, GetGroups, GetRolesForModule, GetStep, GetWorkflow, GetWorkflows, PublishWorkflow, REQUEST_CONTEXT, SetModuleInfo, UpdateConnection, UpdateStep, ValidateFlow, WorkflowBuilder, WorkflowFacade, WorkflowState };
648
- export type { ConnectionPayload, ConnectionResponse, FormulaProperty, GroupDefinition, PublishPayload, PublishResponse, Response, RoleDefinition, RoleGroupDefinition, StepPayload, StepPropertyItem, StepPropertyPayload, StepResponse, StepSchema, WorkflowAppAction, WorkflowAppActionConfigPropertySchema, WorkflowAppActionConfigPropertyType, WorkflowAppActionConfigSchema, WorkflowAppActionDescriptor, WorkflowAppActionFailureBehavior, WorkflowConnection, WorkflowListItem, WorkflowLoadingName, WorkflowProperty, WorkflowPropertyConfig, WorkflowSchema, WorkflowStateModel, WorkflowStepSchema, WorkflowStepType };
805
+ export { CreateConnection, CreateStep, DeleteConnection, DeleteStep, GetAppActionDetail, GetAppActionOptions, GetAppActions, GetFormulaProperties, GetGroups, GetRolesForModule, GetStep, GetWorkflow, GetWorkflows, PublishWorkflow, REQUEST_CONTEXT, SetModuleInfo, UpdateConnection, UpdateStep, ValidateFlow, WorkflowBuilder, WorkflowFacade, WorkflowState, buildAppActionOptionsCacheKey };
806
+ export type { ConnectionPayload, ConnectionResponse, FormulaProperty, GroupDefinition, PublishPayload, PublishResponse, Response, RoleDefinition, RoleGroupDefinition, StepPayload, StepPropertyItem, StepPropertyPayload, StepResponse, StepSchema, WorkflowAppAction, WorkflowAppActionConfigField, WorkflowAppActionConfigPropertySchema, WorkflowAppActionConfigPropertyType, WorkflowAppActionConfigSchema, WorkflowAppActionDescriptor, WorkflowAppActionFailureBehavior, WorkflowAppActionFieldUIControl, WorkflowAppActionOption, WorkflowAppActionOptionsCacheEntry, WorkflowAppActionOptionsCacheKey, WorkflowAppActionOutput, WorkflowAppActionPhase, WorkflowAppActionRuntimeInput, WorkflowAppActionRuntimeInputSource, WorkflowAppActionSystemKind, WorkflowConnection, WorkflowListItem, WorkflowLoadingName, WorkflowProperty, WorkflowPropertyConfig, WorkflowSchema, WorkflowStateModel, WorkflowStepSchema, WorkflowStepType };