ngx-t-workflow-typings 3.0.1 → 3.1.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.
@@ -22,6 +22,21 @@ export interface SimilarityResult {
22
22
  view: boolean;
23
23
  relation: 'ancestor' | 'descendant' | 'sibling' | 'similar';
24
24
  }
25
+ /**
26
+ * Document-level lifecycle state, written by the check-in / check-out flow.
27
+ *
28
+ * Distinct from {@link DocumentWorkflowStep.status}, which is a per-step
29
+ * `WorkflowStepStatus` on `processTree[]`. This one describes the document itself.
30
+ *
31
+ * Members are additive only — never remove one, since existing documents carry the
32
+ * value and Mongoose validates the whole document on `.save()`.
33
+ */
34
+ export declare enum WorkFlowDocumentStatus {
35
+ /** Live document. Set on the original when a checked-out copy is checked back in. */
36
+ Active = "active",
37
+ /** Superseded check-out copy, retained for history. Set together with `archive: true`. */
38
+ Archived = "archived"
39
+ }
25
40
  /**
26
41
  * The STORED fields of a workflow document (the `FormVal` collection), excluding
27
42
  * everything Mongoose adds at runtime (`_id`, `createdAt`, `updatedAt`).
@@ -59,6 +74,12 @@ export interface leanWorkFlowDocumentInterface {
59
74
  date: Date;
60
75
  };
61
76
  checkedOutDocId?: string;
77
+ /**
78
+ * Document lifecycle state. Optional: only documents that have been through the
79
+ * check-in / check-out flow carry it, so every document written before that
80
+ * feature — and every ordinary transaction — has no `status` at all.
81
+ */
82
+ status?: WorkFlowDocumentStatus;
62
83
  latestVersion: number;
63
84
  versions: Array<{
64
85
  versionNumber: number;
@@ -4,3 +4,19 @@ export var RecentlyViewedStatus;
4
4
  RecentlyViewedStatus["Complete"] = "complete";
5
5
  RecentlyViewedStatus["Action"] = "action";
6
6
  })(RecentlyViewedStatus || (RecentlyViewedStatus = {}));
7
+ /**
8
+ * Document-level lifecycle state, written by the check-in / check-out flow.
9
+ *
10
+ * Distinct from {@link DocumentWorkflowStep.status}, which is a per-step
11
+ * `WorkflowStepStatus` on `processTree[]`. This one describes the document itself.
12
+ *
13
+ * Members are additive only — never remove one, since existing documents carry the
14
+ * value and Mongoose validates the whole document on `.save()`.
15
+ */
16
+ export var WorkFlowDocumentStatus;
17
+ (function (WorkFlowDocumentStatus) {
18
+ /** Live document. Set on the original when a checked-out copy is checked back in. */
19
+ WorkFlowDocumentStatus["Active"] = "active";
20
+ /** Superseded check-out copy, retained for history. Set together with `archive: true`. */
21
+ WorkFlowDocumentStatus["Archived"] = "archived";
22
+ })(WorkFlowDocumentStatus || (WorkFlowDocumentStatus = {}));
@@ -1,4 +1,4 @@
1
1
  export type { RecentlyViewedParams, SimilarityResult, leanWorkFlowDocumentInterface, WorkFlowDocumentInterface, IRecentlyViewed, IRecentlyViewedCookie, } from './WorkFlowDocument.interface.js';
2
- export { RecentlyViewedStatus } from './WorkFlowDocument.interface.js';
2
+ export { RecentlyViewedStatus, WorkFlowDocumentStatus } from './WorkFlowDocument.interface.js';
3
3
  /** @deprecated Use the {@link RecentlyViewedStatus} enum. */
4
4
  export type { RecentlyViewedStatusType } from './WorkFlowDocument.interface.js';
@@ -1 +1 @@
1
- export { RecentlyViewedStatus } from './WorkFlowDocument.interface.js';
1
+ export { RecentlyViewedStatus, WorkFlowDocumentStatus } from './WorkFlowDocument.interface.js';
@@ -650,12 +650,13 @@ export const STEP_REFERENCE_RULES = {
650
650
  label: 'Post title field',
651
651
  targetKind: ReferenceTargetKind.FormControlInMicroFlowForm,
652
652
  severity: StepRequirementSeverity.Warning,
653
- message: "Names a control that is not in the micro-flow's initiate form — the form this step actually renders. WARNING only: no read site exists in the audited repositories (the portal front end is outside them), and the editor offers the workflow-wide union rather than that form, so a mismatch may be intentional.",
653
+ message: "Names a control that is not in the micro-flow's initiate form — the form this step actually renders. WARNING only: no read site is known in any of the repositories searched, and the editor offers the workflow-wide union rather than that form, so a mismatch may be intentional.",
654
654
  evidence: [
655
655
  'W/shared/functions/hydrateStep.ts:99-108 (a public-portal node\'s form IS the micro-flow initiate form; the step has no `formId` of its own)',
656
656
  'W/component/workflow-diagram/WorkflowStepDefault.ts:102-114 (`formId` is in neither array for this type)',
657
657
  'W/component/workflow-diagram/processStepEditorConfig.ts:278-285 (picker scope is the workflow-wide union — the divergence)',
658
- 'T/Workflow/WorkflowProcessTree.schema.ts:46 (persisted; no reader in the four audited repositories)',
658
+ 'T/Workflow/WorkflowProcessTree.schema.ts:46 (persisted)',
659
+ "SEARCH NOW EXHAUSTIVE (2026-08), correcting the previous wording: the earlier grading said 'no read site in the AUDITED repositories' and named the public portal front end as the gap. That gap is closed — `iserve-portal`, `cartalist-portalApp` and the portal BACKEND (`S/services/portal/PortalService.ts`, `S/controllers/portal.ts`) contain zero reads of `publicPortalConfig`. RETAINED DELIBERATELY nonetheless, unlike the sibling `controlName` field which was retired in the same pass: the owner's call was to keep this one. The warning grading is therefore what it always was — a hint, never a block — and the 'may be intentional' clause still governs.",
659
660
  ],
660
661
  requires: [ReferenceCatalog.Workflows, ReferenceCatalog.Forms],
661
662
  requiresExternalCatalog: true,
@@ -698,22 +699,6 @@ export const STEP_REFERENCE_RULES = {
698
699
  requires: [ReferenceCatalog.WorkflowInputs],
699
700
  requiresExternalCatalog: true,
700
701
  },
701
- {
702
- id: 'publicPortal.controlName',
703
- stepType: WorkflowStepTypeEnum.PublicPortal,
704
- field: 'controlName',
705
- label: 'Step control name',
706
- targetKind: ReferenceTargetKind.FormControlInMicroFlowForm,
707
- severity: StepRequirementSeverity.Warning,
708
- message: "Names a control that is not in the micro-flow's initiate form. WARNING only: no public-portal code path in the audited repositories dereferences it.",
709
- evidence: [
710
- 'W/component/workflow-diagram/WorkflowStepDefault.ts:103 (requiredProperties)',
711
- 'W/component/workflow-diagram/processStepEditorConfig.ts:35-42 (generic control-name Input — no picker, so no scope is enforced at authoring time)',
712
- 'W/shared/functions/hydrateStep.ts:99-108',
713
- ],
714
- requires: [ReferenceCatalog.Workflows, ReferenceCatalog.Forms],
715
- requiresExternalCatalog: true,
716
- },
717
702
  {
718
703
  id: 'publicPortal.publicPortalFunctionalScoreSheetStep',
719
704
  stepType: WorkflowStepTypeEnum.PublicPortal,
@@ -806,6 +791,19 @@ export const EXCLUDED_STEP_REFERENCES = [
806
791
  // `publicPortalFunctionalScoreSheetStep` target TYPE (scoreCreation), the
807
792
  // review `controlName` toggle rule, and the `postExpiryDateControlName` date
808
793
  // rule. They are no longer exclusions; see STEP_REFERENCE_RULES.
794
+ {
795
+ field: 'controlName',
796
+ stepType: WorkflowStepTypeEnum.PublicPortal,
797
+ reason: "THE FIELD NO LONGER EXISTS ON THIS TYPE. Retired 2026-08 together with its requirement entry: `WorkflowStepDefault.ts` no longer lists `controlName` in the public-portal `requiredProperties` or `properties`, so the editor offers no control to author it. A rule that can only fire on a value nothing can set and nothing can read is pure noise — and this one fired often, because the retired control was a free-text Input (no picker, no scope) while the rule resolved against the micro-flow's INITIATE form, three hops out. THE SEARCH IS NOW EXHAUSTIVE: the previous grading said 'no read site in the AUDITED repositories' and named the public portal front end as the gap. Both portal applications (`iserve-portal`, `cartalist-portalApp`) and the portal backend (`S/services/portal/PortalService.ts`, `S/controllers/portal.ts`) have since been searched and contain zero reads; `cartalist-portalApp` carries only a type declaration on its local `ProcessStep`. Every remaining reader in the estate is `stepType`-scoped to review or adjudication.",
798
+ evidence: [
799
+ 'E/services/workflow.ts:322-325 (the only routing dereference, guarded by `stepType === Review`)',
800
+ 'S/executiveDashboard/drilldown/predicates.ts:90-92 (`if (s.stepType === WorkflowStepTypeEnum.Review)` before the read)',
801
+ 'P/app-configs/ngx-t-forms-config.service.ts:561,580,598 (the adjudication reads)',
802
+ 'S/executiveDashboard/drilldown/getTransactionDrilldown.ts:57-61 (step-type-agnostic, but only widens a Mongo projection — no behaviour depends on it)',
803
+ 'W/component/workflow-diagram/WorkflowStepDefault.ts (public-portal `requiredProperties` / `properties` — `controlName` removed from both)',
804
+ "STEP_TYPE_REQUIREMENTS[publicPortal].integrityNotes (the matching removal note)",
805
+ ],
806
+ },
809
807
  {
810
808
  field: 'workflowFormForScoreSheet',
811
809
  stepType: WorkflowStepTypeEnum.Adjudication,
@@ -480,22 +480,6 @@ export const STEP_TYPE_REQUIREMENTS = {
480
480
  ],
481
481
  graphValidatorCode: 'DECISION_GATE_NO_OUTPUTS',
482
482
  },
483
- {
484
- field: 'controlName',
485
- label: 'Step control name',
486
- type: StepFieldValueType.String,
487
- severity: StepRequirementSeverity.Error,
488
- actionLabel: 'Step control name',
489
- hint: 'Set it in the "Step control name" field for the decision gate.',
490
- message: 'Give the decision gate a control name — it is required before the gate can be saved.',
491
- evidence: [
492
- 'PRODUCT OWNER POLICY (2026-07): the decision gate\'s step control name is required. This is a POLICY requirement, not an interpreter requirement — see the tension below.',
493
- 'W/component/workflow-diagram/WorkflowStepDefault.ts:149 (requiredProperties DOES list controlName — the descriptor agrees it is required).',
494
- 'TENSION — NO KNOWN READ SITE: a prior engine audit found the gate resolver dereferences `controlName` nowhere. `W/component/workflow-diagram/function/getNextWorkflowStepFromDecisionGate.ts:12-43` reads only systemStep, outputs, decisionsCondition and connections; `W/services/workflow/workflow.service.ts:70-71,137-139` delegates to that resolver with no `controlName` read. If requiring it ever produces authoring friction, that is because this is a POLICY requirement, not an interpreter one — no read site justifies it and the demotion evidence still stands.',
495
- 'W/component/workflow-diagram/processStepEditorConfig.ts:35-42 (generic control-name Input — the control that satisfies it).',
496
- ],
497
- divergesFromDescriptor: 'RESTORED to required (Error) per product owner policy (2026-07). A previous revision DEMOTED it to optional/warning on the AUDIT (c) finding that the decision-gate code path dereferences `controlName` nowhere — that finding still stands (see the NO KNOWN READ SITE note in evidence). The product owner requires it regardless; this is a policy requirement, honoured here, not an interpreter one. It re-aligns with `WorkflowStepDefault.ts:149`, which lists it in requiredProperties.',
498
- },
499
483
  ],
500
484
  conditional: [],
501
485
  optional: [],
@@ -513,7 +497,7 @@ export const STEP_TYPE_REQUIREMENTS = {
513
497
  graphValidatorCode: 'DECISION_GATE_NO_OUTPUTS',
514
498
  },
515
499
  integrityNotes: [
516
- "AUDIT (c) + PRODUCT OWNER POLICY (2026-07): `controlName` is in `WorkflowStepDefault.ts:149` requiredProperties but read by nothing in the decision path the gate resolver (`getNextWorkflowStepFromDecisionGate.ts:12-43`) and `workflow.service.ts:70-71,137-139` dereference it nowhere. A prior revision demoted it to optional/warning on that basis. The product owner now requires it, so it is a REQUIRED (Error) rule above. RECORD OF THE TENSION: this is a POLICY requirement, not an interpreter one. No read site is currently known; if requiring it ever produces authoring friction, the AUDIT (c) 'no reader' finding is the reason to revisit the policy, not the interpreter. The promotion rests solely on the owner's decision and its re-alignment with the descriptor.",
500
+ "REMOVED (2026-08), superseding the 2026-07 policy. `controlName` carries no rule here, and `WorkflowStepDefault.ts` no longer lists it in this type's `requiredProperties` or `properties`, so the editor does not offer it. HISTORY, because this field has been flipped twice: AUDIT (c) found no reader and demoted it; the product owner restored it as an explicit POLICY requirement in 2026-07, with the standing note that authoring friction would be the trigger to revisit. That friction arrived, and the owner's 2026-08 decision is to remove it rather than require a value nothing consumes. THE EVIDENCE IS NOW STRONGER THAN 'no reader found': the engine RETURNS EARLY for this step type — `E/services/workflow.ts:315-317` (`if (definitionOfLastStep?.stepType === 'decision') return { processStep: definitionOfLastStep }`) sits ABOVE the only `controlName` dereference in the routing path (`:322-325`, guarded by `stepType === Review` besides). So the field is not merely unread on this path, it is unreachable on it. The gate resolver (`getNextWorkflowStepFromDecisionGate.ts:12-43`) and `workflow.service.ts:70-71,137-139` confirm the client mirror. Every other reader in the estate is `stepType`-scoped to review or adjudication (`S/executiveDashboard/drilldown/predicates.ts:90-92`, `P/app-configs/ngx-t-forms-config.service.ts:561,580,598`). Persisted values are inert, not migrated.",
517
501
  "`members` is in `properties` (`WorkflowStepDefault.ts:151`) but the type is a system step, and `workflowDiagramActions.ts:216,289` force `members: []` on every save when `systemStep === true`. The entry is dead.",
518
502
  "Per-branch `decisionsCondition.expression` is NOT encoded as a field rule here: `getNextWorkflowStepFromDecisionGate.ts:25-27` skips an outlet without one, and the graph validator already reports it as `DECISION_GATE_MISSING_CONDITION` (`validateWorkflow.ts`, the per-output loop that pushes it when `!isNonEmptyString(expression)`). Owned by the graph validator, deliberately not duplicated. WORDING ALIGNMENT: that code emits 'has no condition set, so no document will ever be sent down it. Give it a condition or remove it.' — this type's `outputs` required-rule message and `sockets` message are worded to agree (every branch needs its own condition, or it never receives a document). The graph validator is upgrading `DECISION_GATE_MISSING_CONDITION` from warning to error; that severity change is owned there, not here.",
519
503
  ],
@@ -1059,19 +1043,6 @@ export const STEP_TYPE_REQUIREMENTS = {
1059
1043
  ],
1060
1044
  divergesFromDescriptor: 'PROMOTED to error (corrected). Previously `warning` because the only reader found took the key as a request parameter. `osproc-be` reads it directly off the step to schedule the post-expiry job, and its absence makes the portal step self-complete instantly. It agrees with `WorkflowStepDefault.ts:104` after all. NOTE the pool also changes: the engine resolves it against the MAIN document\'s form (`document.form`), not the micro-flow initiate form the node renders.',
1061
1045
  },
1062
- {
1063
- field: 'controlName',
1064
- label: 'Step control name',
1065
- type: StepFieldValueType.String,
1066
- severity: StepRequirementSeverity.Warning,
1067
- actionLabel: 'Step control name',
1068
- message: 'Optional for a public portal step — nothing in the systems checked here reads it, so you can leave it blank.',
1069
- evidence: [
1070
- 'W/component/workflow-diagram/WorkflowStepDefault.ts:103 (requiredProperties)',
1071
- 'W/component/workflow-diagram/processStepEditorConfig.ts:35-42 (generic control-name Input)',
1072
- ],
1073
- divergesFromDescriptor: 'DEMOTED to warning. AUDIT (c): required by the descriptor, dereferenced by nothing on the public-portal path.',
1074
- },
1075
1046
  ],
1076
1047
  conditional: [],
1077
1048
  optional: [
@@ -1109,7 +1080,8 @@ export const STEP_TYPE_REQUIREMENTS = {
1109
1080
  sockets: LINEAR_SOCKETS,
1110
1081
  integrityNotes: [
1111
1082
  "DESCRIPTOR/BADGE CONFLICT: `elementTemplate.systemStep` is `false` (`WorkflowStepDefault.ts:119`) while `members` and `formId` are in NEITHER `properties` nor `requiredProperties` (`:102-114`). `nodeValidator.ts:5-12` therefore permanently badges every public-portal node with 'Node is missing: user form, members' — two fields the type deliberately does not use. Either the template should be `systemStep: true` or `nodeValidator` should exempt this type; owned by the library, not fixed here. NOTE the engine DEPENDS on the empty `members`: `E/services/workflow.ts:812-813` reaches the post-expiry branch only because `members?.length > 0` is false. Making this type a system step would be safe, but giving a public-portal step members would silently disable its expiry scheduling.",
1112
- 'CORRECTED: three of the five `requiredProperties` were previously demoted to warnings for want of a reader. `postExpiryDateControlName` is now back at `error` — `osproc-be` reads it to schedule the post-expiry job (`E/services/workflow.ts:813-840`). `publicPortalConfig` and `controlName` remain at `warning`: re-checked against `osproc-be`, both still have ZERO occurrences anywhere in that repository, so the demotion holds for them.',
1083
+ 'CORRECTED: three of the five `requiredProperties` were previously demoted to warnings for want of a reader. `postExpiryDateControlName` is now back at `error` — `osproc-be` reads it to schedule the post-expiry job (`E/services/workflow.ts:813-840`). `publicPortalConfig` remains at `warning`: re-checked against `osproc-be`, it still has ZERO occurrences anywhere in that repository, so the demotion holds for it.',
1084
+ "REMOVED (2026-08): `controlName` no longer appears here at all, and `WorkflowStepDefault.ts` no longer lists it in this type's `requiredProperties` or `properties`, so the editor does not offer it. The earlier revisions could only DEMOTE it (required -> warning) because the search for a reader was bounded by four repositories and the public portal FRONT END was outside them — an unaudited consumer is a reason to keep a field, not to delete it. That gap is now closed: the two portal applications (`iserve-portal`, `cartalist-portalApp`) and the portal BACKEND (`S/services/portal/PortalService.ts`, `S/controllers/portal.ts`) were searched and contain ZERO reads of `step.controlName` — `cartalist-portalApp` carries only a type declaration on its local `ProcessStep` model. With every consumer accounted for, a field nothing reads is not a warning to be silenced, it is a field to be removed: it cannot be got wrong, so it cannot be flagged. Persisted values are left untouched by the schema (`controlName` is still a real field for `review` and `adjudication` steps) and are simply inert on this type. See also the matching `EXCLUDED_STEP_REFERENCES` entry, which retires the cross-reference rule for the same reason.",
1113
1085
  ],
1114
1086
  },
1115
1087
  /* ====================================================================== */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-t-workflow-typings",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Typings and interfaces for the ngx-t-workflows library.",
5
5
  "keywords": [
6
6
  "typings",