ngx-t-workflow-typings 3.2.2 → 3.2.3

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.
@@ -1,6 +1,7 @@
1
1
  import type { ElementTypes } from 'ngx-t-forms-types';
2
2
  import type { AdjudicationSteps } from 'ngx-t-forms-types';
3
3
  import type { InputDataTypes } from 'ngx-t-forms-types';
4
+ import type { InputTypes } from 'ngx-t-forms-types';
4
5
  import { WorkflowStepTypeEnum } from '../ProcessStep/WorkflowStepType.interface.js';
5
6
  import { AdjudicationType } from '../ProcessStep/ProcessStep.interface.js';
6
7
  import { type StepReferenceRule, type WorkflowReferenceRule } from './StepReferenceRules.interface.js';
@@ -26,6 +27,23 @@ export type DatePickerElementLiteralAgrees = AssertTrue<`${ElementTypes.DatePick
26
27
  export type DateRangePickerElementLiteralAgrees = AssertTrue<`${ElementTypes.DateRangePicker}` extends 'dateRangePicker' ? true : false>;
27
28
  /** `InputDataTypes.Date` — the date `dataType` fallback (PRODUCT SPEC #14). */
28
29
  export type DateDataTypeLiteralAgrees = AssertTrue<`${InputDataTypes.Date}` extends 'date' ? true : false>;
30
+ /**
31
+ * `ElementTypes.DateTimePicker` — the date+time editor
32
+ * (`F/.../t-form-input/elements/date-time-picker-input-element`, registered at
33
+ * `F/.../t-form-input/element-registry.ts:54-56`).
34
+ *
35
+ * DELIBERATELY UNGUARDED, unlike its siblings. The member was added upstream
36
+ * AFTER `ngx-t-forms-types@0.0.29`, which is this package's dependency floor and
37
+ * the copy its own build compiles against; a `${ElementTypes.DateTimePicker}`
38
+ * assertion would therefore fail to compile here rather than catch anything.
39
+ * Guard it the moment the floor moves past the release that carries it.
40
+ */
41
+ /** `InputTypes.Date` — a plain `input` rendered as a native date picker. */
42
+ export type DateInputTypeLiteralAgrees = AssertTrue<`${InputTypes.Date}` extends 'date' ? true : false>;
43
+ /** `InputTypes.DateTimeLocal` — a plain `input` rendered as a native date+time picker. */
44
+ export type DateTimeLocalInputTypeLiteralAgrees = AssertTrue<`${InputTypes.DateTimeLocal}` extends 'datetime-local' ? true : false>;
45
+ /** `InputTypes.Month` — a plain `input` whose `YYYY-MM` value `new Date()` still parses. */
46
+ export type MonthInputTypeLiteralAgrees = AssertTrue<`${InputTypes.Month}` extends 'month' ? true : false>;
29
47
  /**
30
48
  * Every cross-reference rule, per step type. Exhaustive over
31
49
  * `WorkflowStepTypeEnum` for the same reason `STEP_TYPE_REQUIREMENTS` is: a new
@@ -6,8 +6,16 @@ import { ReferenceCatalog, ReferenceTargetKind, } from './StepReferenceRules.int
6
6
  const WORKFLOW_ADJUDICATION_ELEMENT = 'workflowAdjudication';
7
7
  const TOGGLE_ELEMENT = 'toggle';
8
8
  const DATE_PICKER_ELEMENT = 'datePicker';
9
+ const DATE_TIME_PICKER_ELEMENT = 'dateTimePicker';
9
10
  const DATE_RANGE_PICKER_ELEMENT = 'dateRangePicker';
10
11
  const DATE_DATA_TYPE = 'date';
12
+ /* The native `<input type>` values whose stored string `new Date()` PARSES.
13
+ * `week` (`2026-W37`) and `time` (`10:30`) are excluded on purpose: those two
14
+ * really do yield an `Invalid Date`, which is the failure this rule exists to
15
+ * catch. `month` (`2026-09`) parses to the first of that month. */
16
+ const DATE_INPUT_TYPE = 'date';
17
+ const DATE_TIME_LOCAL_INPUT_TYPE = 'datetime-local';
18
+ const MONTH_INPUT_TYPE = 'month';
11
19
  /* -------------------------------------------------------------------------- */
12
20
  /* Shared rule fragments */
13
21
  /* -------------------------------------------------------------------------- */
@@ -667,12 +675,28 @@ export const STEP_REFERENCE_RULES = {
667
675
  // TYPED index so the date predicate below can inspect `element`/`dataType`.
668
676
  targetKind: ReferenceTargetKind.FormControlInWorkflowForm,
669
677
  // PRODUCT SPEC #14: it must be a DATE input — a date picker, a date-range
670
- // picker, or any input whose `dataType` is `date`.
678
+ // picker, the date+time editor, any input whose `dataType` is `date`, or a
679
+ // plain `input` carrying a native date `type`. THREE independent shapes,
680
+ // because the builder can author a date field three ways while the engine
681
+ // only ever does `new Date(document.form[key])`.
682
+ //
683
+ // The `type` leaf is what stopped this rule false-violating: the `input`
684
+ // template seeds `dataType: 'string'` (`FT/FormBuilder/DefaultEelement.ts:51-52`)
685
+ // and switching `type` to `date` / `datetime-local` does NOT restamp it, so
686
+ // a perfectly good native date control matched neither of the other two
687
+ // leaves and was reported as "not a date field".
671
688
  predicates: [
672
689
  {
673
690
  anyOf: [
674
- { targetField: 'element', in: [DATE_PICKER_ELEMENT, DATE_RANGE_PICKER_ELEMENT] },
691
+ {
692
+ targetField: 'element',
693
+ in: [DATE_PICKER_ELEMENT, DATE_TIME_PICKER_ELEMENT, DATE_RANGE_PICKER_ELEMENT],
694
+ },
675
695
  { targetField: 'dataType', equals: DATE_DATA_TYPE },
696
+ {
697
+ targetField: 'type',
698
+ in: [DATE_INPUT_TYPE, DATE_TIME_LOCAL_INPUT_TYPE, MONTH_INPUT_TYPE],
699
+ },
676
700
  ],
677
701
  message: 'the control it names is not a date field. The engine parses this value as a Date to schedule the post\'s expiry, so a non-date control reads as `Invalid Date`, the closing job is never queued, and the post never closes.',
678
702
  severity: StepRequirementSeverity.Error,
@@ -682,7 +706,9 @@ export const STEP_REFERENCE_RULES = {
682
706
  mismatchSeverity: StepRequirementSeverity.Error,
683
707
  message: 'This is what closes the public post. The engine reads the expiry date from `document.form[thisField]` and schedules the job that completes the step; an unresolvable control makes the date `undefined`, no job is scheduled, and — because a public-portal step has no members to hand it to either — the document PARKS on the step with no task and no expiry, indefinitely.',
684
708
  evidence: [
685
- 'PRODUCT SPEC #14: `postExpiryDateControlName` must be a date input (datePicker / dateRangePicker / `dataType === "date"`).',
709
+ 'PRODUCT SPEC #14: `postExpiryDateControlName` must be a date input — a `datePicker`, `dateTimePicker` or `dateRangePicker` element, OR `dataType === "date"`, OR a native `type` of `date` / `datetime-local` / `month`.',
710
+ 'FT/formInput/BasicFormInputInterface.ts:46-48,66-80 (the element and input-type enums the three leaves match; `dateTimePicker` and the native types are all authorable today) and F/.../t-form-input/element-registry.ts:48-56 (all three date editors are registered and rendered).',
711
+ 'FT/FormBuilder/DefaultEelement.ts:51-52,421-422,465-466,512-513 (WHY THE `type` LEAF IS NEEDED: the three picker templates seed `dataType: date`, but the plain `input` template seeds `dataType: string` and choosing a date `type` never restamps it — so an `<input type="date">` used to violate this rule).',
686
712
  'E/services/workflow.ts:813-817 (`const initDate = document.form[inititDateParam]; if (initDate) {`)',
687
713
  'E/services/workflow.ts:818-840 (the `workflow-task-expiry` job carrying `completeStep: true` — the only thing that closes the post)',
688
714
  'E/services/workflow.ts:812,842-850 (neither branch runs: no members means no job card, and a present-but-unresolvable field skips the `updateR` fall-through too)',
@@ -241,7 +241,8 @@ export type ReferenceContentPredicate =
241
241
  /**
242
242
  * The target's `targetField` must be one of a fixed set — the disjunctive
243
243
  * sibling of `equals`. Used where the spec lists alternatives, e.g. a date
244
- * input's `element` may be `datePicker` OR `dateRangePicker`.
244
+ * input's `element` may be `datePicker`, `dateTimePicker` OR
245
+ * `dateRangePicker`.
245
246
  */
246
247
  | (ReferencePredicateBase & {
247
248
  readonly targetField: string;
@@ -250,8 +251,9 @@ export type ReferenceContentPredicate =
250
251
  /**
251
252
  * At least ONE of the listed leaf comparisons must hold — a disjunction across
252
253
  * possibly-different `targetField`s. This is how "the input is a date control"
253
- * is expressed declaratively: `element ∈ {datePicker, dateRangePicker}` OR
254
- * `dataType === 'date'` (PRODUCT SPEC #14, `postExpiryDateControlName`).
254
+ * is expressed declaratively: `element ∈ {datePicker, dateTimePicker, dateRangePicker}` OR
255
+ * `dataType === 'date'` OR a native date `type` (PRODUCT SPEC #14,
256
+ * `postExpiryDateControlName`).
255
257
  */
256
258
  | (ReferencePredicateBase & {
257
259
  readonly anyOf: readonly ReferenceLeafPredicate[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-t-workflow-typings",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "Typings and interfaces for the ngx-t-workflows library.",
5
5
  "keywords": [
6
6
  "typings",
@@ -42,14 +42,14 @@
42
42
  "test": "echo \"Error: no test specified\" && exit 1"
43
43
  },
44
44
  "peerDependencies": {
45
- "ngx-t-forms-types": ">=0.0.29",
45
+ "ngx-t-forms-types": ">=0.0.33",
46
46
  "rxjs": ">=7.8.0"
47
47
  },
48
48
  "dependencies": {
49
49
  "joi": "^18.0.2"
50
50
  },
51
51
  "devDependencies": {
52
- "ngx-t-forms-types": "^0.0.29",
52
+ "ngx-t-forms-types": "^0.0.33",
53
53
  "rimraf": "^6.1.3",
54
54
  "typescript": "^5.9.3"
55
55
  }