ngx-t-forms-types 0.0.30 → 0.0.33
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/dist/interfaces/Form/formSubmissionHandleInterface.d.ts +6 -0
- package/dist/interfaces/FormBuilder/DefaultEelement.js +76 -0
- package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.d.ts +13 -0
- package/dist/interfaces/FormBuilder/FormInputKeys.d.ts +6 -0
- package/dist/interfaces/FormBuilder/FormInputKeys.js +6 -0
- package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +188 -3
- package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.d.ts +34 -0
- package/dist/interfaces/formInput/BasicFormInputInterface.d.ts +1 -0
- package/dist/interfaces/formInput/BasicFormInputInterface.js +1 -0
- package/dist/interfaces/formInput/IMscoaAccount.d.ts +19 -3
- package/dist/interfaces/formInput/ISelectInputInterface.d.ts +12 -0
- package/dist/interfaces/formInput/MultipleInterface.d.ts +10 -0
- package/dist/interfaces/formInput/WorkflowDocumentPicker.d.ts +2 -0
- package/dist/schemas/FormInputSchema.js +41 -2
- package/dist/schemas/MatOptionsSchema.js +7 -0
- package/dist/schemas/MscoaConfigSchema.js +1 -0
- package/dist/schemas/index.d.ts +2 -1
- package/dist/schemas/index.js +2 -1
- package/dist/skillet/authoring-rules.d.ts +41 -0
- package/dist/skillet/authoring-rules.js +61 -0
- package/dist/skillet/extra-members.d.ts +143 -0
- package/dist/skillet/extra-members.js +79 -0
- package/dist/skillet/form.d.ts +170 -0
- package/dist/skillet/form.js +139 -0
- package/dist/skillet/index.d.ts +43 -0
- package/dist/skillet/index.js +46 -0
- package/dist/skillet/input-members.d.ts +375 -0
- package/dist/skillet/input-members.js +186 -0
- package/dist/skillet/internal/coupling.d.ts +63 -0
- package/dist/skillet/internal/coupling.js +69 -0
- package/dist/skillet/internal/editor-guidance.d.ts +64 -0
- package/dist/skillet/internal/editor-guidance.js +291 -0
- package/dist/skillet/members/calculated-field.d.ts +155 -0
- package/dist/skillet/members/calculated-field.js +105 -0
- package/dist/skillet/members/conditional.d.ts +69 -0
- package/dist/skillet/members/conditional.js +16 -0
- package/dist/skillet/members/document-picker.d.ts +182 -0
- package/dist/skillet/members/document-picker.js +111 -0
- package/dist/skillet/members/mat-options.d.ts +187 -0
- package/dist/skillet/members/mat-options.js +92 -0
- package/dist/skillet/members/mscoa.d.ts +182 -0
- package/dist/skillet/members/mscoa.js +129 -0
- package/dist/skillet/members/pagination.d.ts +59 -0
- package/dist/skillet/members/pagination.js +16 -0
- package/dist/skillet/members/table.d.ts +178 -0
- package/dist/skillet/members/table.js +105 -0
- package/dist/skillet/members/validators.d.ts +197 -0
- package/dist/skillet/members/validators.js +74 -0
- package/dist/skillet/members/value.d.ts +154 -0
- package/dist/skillet/members/value.js +97 -0
- package/dist/skillet/shared-types.d.ts +57 -0
- package/dist/skillet/shared-types.js +69 -0
- package/dist/skillet/tests/house-rules.spec.d.ts +1 -0
- package/dist/skillet/tests/house-rules.spec.js +162 -0
- package/dist/skillet/tests/skillet-coupling.spec.d.ts +1 -0
- package/dist/skillet/tests/skillet-coupling.spec.js +191 -0
- package/dist/skillet/tests/variant-assembly.spec.d.ts +1 -0
- package/dist/skillet/tests/variant-assembly.spec.js +643 -0
- package/dist/skillet/variants.d.ts +138 -0
- package/dist/skillet/variants.js +536 -0
- package/dist/skillet/workflow-context.d.ts +95 -0
- package/dist/skillet/workflow-context.js +128 -0
- package/package.json +78 -60
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { s } from '@hashbrownai/core';
|
|
2
|
+
import { ElementTypes } from '../interfaces/formInput/index.js';
|
|
3
|
+
import { describeAuthoringRules } from './authoring-rules.js';
|
|
4
|
+
import { optional } from './internal/coupling.js';
|
|
5
|
+
import { CALCULATED_FIELD_DRAFT_COMPLETION } from './members/calculated-field.js';
|
|
6
|
+
import { CONDITIONAL_DRAFT_COMPLETION } from './members/conditional.js';
|
|
7
|
+
import { WORKFLOW_PICKER_DRAFT_COMPLETION } from './members/document-picker.js';
|
|
8
|
+
import { MAT_OPTIONS_DRAFT_COMPLETION, } from './members/mat-options.js';
|
|
9
|
+
import { MSCOA_DRAFT_COMPLETION } from './members/mscoa.js';
|
|
10
|
+
import { PAGINATION_DRAFT_COMPLETION } from './members/pagination.js';
|
|
11
|
+
import { TABLE_DRAFT_COMPLETION } from './members/table.js';
|
|
12
|
+
import { VALIDATOR_DRAFT_COMPLETION } from './members/validators.js';
|
|
13
|
+
import { CALCULATE_LIST_DRAFT_COMPLETION } from './members/value.js';
|
|
14
|
+
import { createColumnSchema } from './variants.js';
|
|
15
|
+
import { describeWorkflowStep, } from './workflow-context.js';
|
|
16
|
+
function submissionHandleSchema(endpoints, canSubmitEndpoints) {
|
|
17
|
+
const endpointNode = endpoints.length
|
|
18
|
+
? s.enumeration(`Which configured endpoint the completed form is submitted to. Choose by meaning: ${endpoints
|
|
19
|
+
.map((e) => `${e.id} (${e.name})`)
|
|
20
|
+
.join('; ')}.`, endpoints.map((e) => e.id))
|
|
21
|
+
: s.string('Leave this list empty. No submission endpoints were offered, so one cannot be chosen and must not be invented.');
|
|
22
|
+
const submissionAPI = s.array(endpoints.length
|
|
23
|
+
? 'The endpoint the form submits to. Choose exactly one.'
|
|
24
|
+
: 'Leave empty — the application supplies the submission endpoint.', endpointNode, endpoints.length ? { minItems: 1, maxItems: 1 } : { maxItems: 0 });
|
|
25
|
+
// `innerComponentShowSubmitButton` is deliberately absent: it is deprecated,
|
|
26
|
+
// and a deprecated property left in a generation schema comes back on every
|
|
27
|
+
// form the model writes.
|
|
28
|
+
const submissionMessage = optional(s.string("Message shown to the user after a successful submission. One sentence, past tense, saying what happened and what happens next: 'Your requisition has been submitted and sent to your line manager for approval'."));
|
|
29
|
+
const description = 'How the completed form is submitted.';
|
|
30
|
+
// Two whole object nodes rather than one with a conditionally spread key:
|
|
31
|
+
// an optional key in a Skillet shape infers as `unknown`, which would leave
|
|
32
|
+
// the assertion at the foot of this file passing while proving nothing.
|
|
33
|
+
return canSubmitEndpoints.length
|
|
34
|
+
? s.object(description, {
|
|
35
|
+
submissionAPI,
|
|
36
|
+
canSubmitAPI: s.array('An optional check run before the form is submitted: the endpoint is called with the form data and must approve before the submission proceeds. Leave this empty unless the form genuinely needs a gate — most do not. Choose at most one.', s.enumeration(`Which configured endpoint decides whether the form may be submitted. Choose by meaning: ${canSubmitEndpoints
|
|
37
|
+
.map((e) => `${e.id} (${e.name})`)
|
|
38
|
+
.join('; ')}.`, canSubmitEndpoints.map((e) => e.id)), { maxItems: 1 }),
|
|
39
|
+
submissionMessage,
|
|
40
|
+
})
|
|
41
|
+
: s.object(description, {
|
|
42
|
+
submissionAPI,
|
|
43
|
+
submissionMessage,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Builds the form-draft schema.
|
|
48
|
+
*
|
|
49
|
+
* @param options which elements and data sources to offer, which endpoints the
|
|
50
|
+
* form may submit to and which may gate that submission, and whether to
|
|
51
|
+
* stream.
|
|
52
|
+
*/
|
|
53
|
+
export function createFormDraftSchema(options = {}) {
|
|
54
|
+
const column = createColumnSchema(options);
|
|
55
|
+
const array = options.streaming ? s.streaming.array : s.array;
|
|
56
|
+
const object = options.streaming ? s.streaming.object : s.object;
|
|
57
|
+
// The guide's grouping rule names section titles, so it is only stated when
|
|
58
|
+
// that element is actually on offer — a sentence pointing a model at an
|
|
59
|
+
// element it cannot choose is an invitation to invent one.
|
|
60
|
+
const offersHeadings = (options.elements ?? Object.values(ElementTypes)).includes(ElementTypes.SectionTitle);
|
|
61
|
+
const slide = object('A page of the form: one topic, with five to seven fields, an item list counting as one. Over eight, split it. Its label becomes a section heading when the transaction is read back.', {
|
|
62
|
+
label: s.string("The heading for this page: a short statement of what it holds, in sentence case — 'Requester details', 'Items required' — never a question, a verb, or a number such as 'Section 3'."),
|
|
63
|
+
columns: array([
|
|
64
|
+
'The fields on this page, in the order they are shown: identifiers and choices first, free text, uploads, calculations and signatures last.',
|
|
65
|
+
offersHeadings
|
|
66
|
+
? 'Start each group of three to five related fields with a sectionTitle whose hintLabel carries the guidance for the group.'
|
|
67
|
+
: null,
|
|
68
|
+
'Fields that belong together share one row by sharing out the 12 grid columns between them, and a field revealed by a condition sits immediately after the field that reveals it.',
|
|
69
|
+
]
|
|
70
|
+
.filter((part) => part !== null)
|
|
71
|
+
.join(' '), column, { minItems: 1 }),
|
|
72
|
+
});
|
|
73
|
+
// The root is emitted exactly once, so it is where the form-wide rules go;
|
|
74
|
+
// see `authoring-rules.ts` for why they are not on the members themselves.
|
|
75
|
+
const formDescription = [
|
|
76
|
+
'A complete dynamic form. Group related fields onto slides rather than one long page; a form of fewer than about seven fields fits on one slide. Make the system do everything it can: prefill what it knows, calculate what it can derive, and let the user pick rather than type.',
|
|
77
|
+
describeAuthoringRules(),
|
|
78
|
+
options.step ? describeWorkflowStep(options.step) : null,
|
|
79
|
+
]
|
|
80
|
+
.filter((part) => part !== null)
|
|
81
|
+
.join(' ');
|
|
82
|
+
return object(formDescription, {
|
|
83
|
+
formTitle: s.string('The title of the form, in sentence case. Name what the form is for.'),
|
|
84
|
+
slides: array('The pages of the form, in order.', slide, { minItems: 1 }),
|
|
85
|
+
submissionHandle: submissionHandleSchema(options.submissionEndpoints ?? [], options.canSubmitEndpoints ?? []),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Members of a generated draft the application must supply before the form is
|
|
90
|
+
* valid. Listed so the expansion step has something to check itself against.
|
|
91
|
+
*
|
|
92
|
+
* The per-member lists are pulled in rather than restated, so a module that
|
|
93
|
+
* takes on a new obligation adds it here by existing. Each entry is prefixed
|
|
94
|
+
* with the column path it hangs off, since the modules describe their own
|
|
95
|
+
* shape and do not know where in a form they sit.
|
|
96
|
+
*
|
|
97
|
+
* A module's own entries must therefore start at the MEMBER it owns —
|
|
98
|
+
* `validators[].id`, not `id` — because everything before that is added here
|
|
99
|
+
* and everything after is the module's to state. A list that skips its member
|
|
100
|
+
* name yields a path with a hole in it, which is worse than no list: it reads
|
|
101
|
+
* as authoritative and points nowhere.
|
|
102
|
+
*
|
|
103
|
+
* Three entries are not from any module and are worth reading twice:
|
|
104
|
+
*
|
|
105
|
+
* - `isCalculatedField` is derived, not authored — see `calculatedFieldSplit`
|
|
106
|
+
* in `variants.ts`. It is required by the interface on EVERY column, so
|
|
107
|
+
* expansion must set it on plain columns too, not only calculated ones.
|
|
108
|
+
* - `onlySetTempErrorOnTouch` is required by the interface but optional in the
|
|
109
|
+
* schema (offered on every value-capturing element through the always-shown
|
|
110
|
+
* editor rows), so a model may leave it null. Expansion then sets it, and the
|
|
111
|
+
* guide's house rule says what to: true, so errors appear only after the
|
|
112
|
+
* user leaves a field. The builder's own element templates default it to
|
|
113
|
+
* false; the guide is explicit that this is the wrong default for nearly
|
|
114
|
+
* every field.
|
|
115
|
+
* - the nulls. Skillet has no optional, so every unset member arrives as an
|
|
116
|
+
* explicit `null`, and Joi rejects `null` for a typed optional key. Stripping
|
|
117
|
+
* them is not tidying; a draft that keeps them fails validation.
|
|
118
|
+
*/
|
|
119
|
+
export const DRAFT_COMPLETION_REQUIRED = [
|
|
120
|
+
'slides[].sectionId',
|
|
121
|
+
'slides[].columns[].id',
|
|
122
|
+
'slides[].columns[].sectionId',
|
|
123
|
+
'slides[].columns[].isCalculatedField (derived: calculatedFieldRules != null)',
|
|
124
|
+
'slides[].columns[].onlySetTempErrorOnTouch (required by the interface and offered as optional; when the model leaves it null the application sets true)',
|
|
125
|
+
'submissionHandle.submissionAPI[] (endpoint id expanded to its configuration)',
|
|
126
|
+
'submissionHandle.canSubmitAPI[] (endpoint id expanded to its configuration; the key is present only when canSubmitEndpoints were offered, and an empty array is dropped)',
|
|
127
|
+
...[
|
|
128
|
+
...CALCULATED_FIELD_DRAFT_COMPLETION,
|
|
129
|
+
...VALIDATOR_DRAFT_COMPLETION,
|
|
130
|
+
...CONDITIONAL_DRAFT_COMPLETION,
|
|
131
|
+
...PAGINATION_DRAFT_COMPLETION,
|
|
132
|
+
...MSCOA_DRAFT_COMPLETION,
|
|
133
|
+
...WORKFLOW_PICKER_DRAFT_COMPLETION,
|
|
134
|
+
...MAT_OPTIONS_DRAFT_COMPLETION,
|
|
135
|
+
...CALCULATE_LIST_DRAFT_COMPLETION,
|
|
136
|
+
...TABLE_DRAFT_COMPLETION,
|
|
137
|
+
].map((path) => `slides[].columns[].${path}`),
|
|
138
|
+
'every member emitted as null is stripped before validation',
|
|
139
|
+
];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skillet schemas for LLM-driven form authoring.
|
|
3
|
+
*
|
|
4
|
+
* Published as the `ngx-t-forms-types/skillet` subpath, NOT from the package
|
|
5
|
+
* root, because it is the only part of these typings that needs
|
|
6
|
+
* `@hashbrownai/core`. That dependency is an optional peer: consumers who never
|
|
7
|
+
* generate forms — the Node API, existing Angular apps — resolve the root entry
|
|
8
|
+
* and never load it.
|
|
9
|
+
*
|
|
10
|
+
* ## What this is for
|
|
11
|
+
*
|
|
12
|
+
* These schemas describe form structure to a model so it can author one. They
|
|
13
|
+
* are a GENERATION contract, not a validation contract. The Joi schemas under
|
|
14
|
+
* `src/schemas` remain the source of truth: a generated form is validated with
|
|
15
|
+
* `validateForm()` exactly like a hand-built one, and failures are fed back to
|
|
16
|
+
* the model as a repair turn. Where the two disagree, Joi wins.
|
|
17
|
+
*
|
|
18
|
+
* ## How drift is prevented
|
|
19
|
+
*
|
|
20
|
+
* Enum-backed nodes read their entries from the live enums at evaluation, so
|
|
21
|
+
* they cannot fall behind. Everything else is checked at compile time: see the
|
|
22
|
+
* assertions at the foot of `input-members.ts`, which fail the build — by
|
|
23
|
+
* name — when a key is added to `AllFormInputPrimaryKeys`, when a member is
|
|
24
|
+
* left unclassified, or when a node starts producing a value its interface
|
|
25
|
+
* cannot hold.
|
|
26
|
+
*/
|
|
27
|
+
export { enumValues, exhaustive, matches, optional, type AssertNever, } from './internal/coupling.js';
|
|
28
|
+
export * from './shared-types.js';
|
|
29
|
+
export * from './input-members.js';
|
|
30
|
+
export * from './extra-members.js';
|
|
31
|
+
export * from './members/mat-options.js';
|
|
32
|
+
export * from './members/calculated-field.js';
|
|
33
|
+
export * from './members/validators.js';
|
|
34
|
+
export * from './members/conditional.js';
|
|
35
|
+
export * from './members/document-picker.js';
|
|
36
|
+
export * from './members/mscoa.js';
|
|
37
|
+
export * from './members/pagination.js';
|
|
38
|
+
export * from './members/table.js';
|
|
39
|
+
export * from './members/value.js';
|
|
40
|
+
export * from './variants.js';
|
|
41
|
+
export * from './form.js';
|
|
42
|
+
export * from './workflow-context.js';
|
|
43
|
+
export * from './authoring-rules.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skillet schemas for LLM-driven form authoring.
|
|
3
|
+
*
|
|
4
|
+
* Published as the `ngx-t-forms-types/skillet` subpath, NOT from the package
|
|
5
|
+
* root, because it is the only part of these typings that needs
|
|
6
|
+
* `@hashbrownai/core`. That dependency is an optional peer: consumers who never
|
|
7
|
+
* generate forms — the Node API, existing Angular apps — resolve the root entry
|
|
8
|
+
* and never load it.
|
|
9
|
+
*
|
|
10
|
+
* ## What this is for
|
|
11
|
+
*
|
|
12
|
+
* These schemas describe form structure to a model so it can author one. They
|
|
13
|
+
* are a GENERATION contract, not a validation contract. The Joi schemas under
|
|
14
|
+
* `src/schemas` remain the source of truth: a generated form is validated with
|
|
15
|
+
* `validateForm()` exactly like a hand-built one, and failures are fed back to
|
|
16
|
+
* the model as a repair turn. Where the two disagree, Joi wins.
|
|
17
|
+
*
|
|
18
|
+
* ## How drift is prevented
|
|
19
|
+
*
|
|
20
|
+
* Enum-backed nodes read their entries from the live enums at evaluation, so
|
|
21
|
+
* they cannot fall behind. Everything else is checked at compile time: see the
|
|
22
|
+
* assertions at the foot of `input-members.ts`, which fail the build — by
|
|
23
|
+
* name — when a key is added to `AllFormInputPrimaryKeys`, when a member is
|
|
24
|
+
* left unclassified, or when a node starts producing a value its interface
|
|
25
|
+
* cannot hold.
|
|
26
|
+
*/
|
|
27
|
+
export { enumValues, exhaustive, matches, optional, } from './internal/coupling.js';
|
|
28
|
+
export * from './shared-types.js';
|
|
29
|
+
export * from './input-members.js';
|
|
30
|
+
export * from './extra-members.js';
|
|
31
|
+
// Per-member modules. Each owns one nested configuration object, states why it
|
|
32
|
+
// produces a draft where it does, and lists what the application must supply
|
|
33
|
+
// before that draft is valid.
|
|
34
|
+
export * from './members/mat-options.js';
|
|
35
|
+
export * from './members/calculated-field.js';
|
|
36
|
+
export * from './members/validators.js';
|
|
37
|
+
export * from './members/conditional.js';
|
|
38
|
+
export * from './members/document-picker.js';
|
|
39
|
+
export * from './members/mscoa.js';
|
|
40
|
+
export * from './members/pagination.js';
|
|
41
|
+
export * from './members/table.js';
|
|
42
|
+
export * from './members/value.js';
|
|
43
|
+
export * from './variants.js';
|
|
44
|
+
export * from './form.js';
|
|
45
|
+
export * from './workflow-context.js';
|
|
46
|
+
export * from './authoring-rules.js';
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { s } from '@hashbrownai/core';
|
|
2
|
+
import type { FormColumnInputs } from '../interfaces/Form/index.js';
|
|
3
|
+
import { AllFormInputPrimaryKeys } from '../interfaces/FormBuilder/FormInputKeys.js';
|
|
4
|
+
import { type MatOptionsDraft } from './members/mat-options.js';
|
|
5
|
+
import { type CalculatedFieldRulesDraft } from './members/calculated-field.js';
|
|
6
|
+
import { type ValidatorEntryDraft } from './members/validators.js';
|
|
7
|
+
import { type ConditionalRuleDraft } from './members/conditional.js';
|
|
8
|
+
import { type MscoaConfigDraft } from './members/mscoa.js';
|
|
9
|
+
import { type PaginationSelectionConfigDraft } from './members/pagination.js';
|
|
10
|
+
import { type CalculateListFunctionsDraft } from './members/value.js';
|
|
11
|
+
import { AssertNever } from './internal/coupling.js';
|
|
12
|
+
/**
|
|
13
|
+
* One Skillet node per member a form input can carry.
|
|
14
|
+
*
|
|
15
|
+
* This registry is the single place a property's LLM-facing shape is defined.
|
|
16
|
+
* Per-element variants are assembled by PICKING from it — they never redeclare
|
|
17
|
+
* a node — so a property means the same thing everywhere it appears.
|
|
18
|
+
*
|
|
19
|
+
* ## Nodes are unwrapped
|
|
20
|
+
*
|
|
21
|
+
* Every node here describes the value as it looks WHEN PRESENT. Optionality is
|
|
22
|
+
* not encoded, because it is not a property of the member — it is a property of
|
|
23
|
+
* the member *within an element*. `colSize` is required on an input and absent
|
|
24
|
+
* on a section title. Variant assembly consults
|
|
25
|
+
* `DefaultInputConfig[element].requiredProperties` and wraps the optional ones
|
|
26
|
+
* with `optional()` at that point.
|
|
27
|
+
*
|
|
28
|
+
* ## Descriptions are composed, not written twice
|
|
29
|
+
*
|
|
30
|
+
* Each authored description is passed through `describe()`, which layers on the
|
|
31
|
+
* hint and the applicability rules the form-builder's own editor config already
|
|
32
|
+
* carries for that property. See `internal/editor-guidance.ts` for what is
|
|
33
|
+
* drawn from there and what was inspected and deliberately rejected.
|
|
34
|
+
*
|
|
35
|
+
* ## The five categories are exhaustive
|
|
36
|
+
*
|
|
37
|
+
* Every `AllFormInputPrimaryKeys` member belongs to exactly one of
|
|
38
|
+
* {@link inputMemberSchemas}, {@link draftMemberSchemas},
|
|
39
|
+
* {@link PENDING_INPUT_MEMBERS}, {@link SYSTEM_OWNED_INPUT_MEMBERS}, or
|
|
40
|
+
* {@link DEPRECATED_INPUT_MEMBERS}. The assertions at the foot of this file
|
|
41
|
+
* prove it, so a key added to the enum breaks the build until it is
|
|
42
|
+
* classified. Nothing can be silently forgotten.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* The type a member is required to produce, read off the real interface.
|
|
46
|
+
*
|
|
47
|
+
* Keys the interfaces do not declare resolve to `unknown`, which imposes no
|
|
48
|
+
* constraint — see {@link UnbackedInputMember} for why that is a finding rather
|
|
49
|
+
* than a feature.
|
|
50
|
+
*/
|
|
51
|
+
type MemberValue<K extends AllFormInputPrimaryKeys> = K extends keyof FormColumnInputs ? NonNullable<FormColumnInputs[K]> : unknown;
|
|
52
|
+
/**
|
|
53
|
+
* Members a model must never author: identifiers the builder assigns and
|
|
54
|
+
* runtime state the form owns while it is open. These are excluded from
|
|
55
|
+
* generation schemas entirely and stitched in afterwards.
|
|
56
|
+
*/
|
|
57
|
+
export declare const SYSTEM_OWNED_INPUT_MEMBERS: readonly [AllFormInputPrimaryKeys.Id, AllFormInputPrimaryKeys.SectionId, AllFormInputPrimaryKeys.SystemDefault, AllFormInputPrimaryKeys.Status, AllFormInputPrimaryKeys.ValueUpdatedAt, AllFormInputPrimaryKeys.TemporaryHint, AllFormInputPrimaryKeys.FormIsOpen, AllFormInputPrimaryKeys.MultipleInputInEditId, AllFormInputPrimaryKeys.CanReload];
|
|
58
|
+
/**
|
|
59
|
+
* Members kept only so stored forms keep deserialising. They are excluded from
|
|
60
|
+
* generation entirely: a model must never author a property the codebase has
|
|
61
|
+
* already moved on from, and leaving one in the schema would see it reappear on
|
|
62
|
+
* every newly generated input.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEPRECATED_INPUT_MEMBERS: readonly [AllFormInputPrimaryKeys.IServeInputWithRequisitionItems];
|
|
65
|
+
/**
|
|
66
|
+
* Members whose shape is a nested configuration object deserving its own
|
|
67
|
+
* module. Listed rather than stubbed: a placeholder node would compile and then
|
|
68
|
+
* quietly feed the model a wrong shape, which is worse than an absent one.
|
|
69
|
+
*/
|
|
70
|
+
export declare const PENDING_INPUT_MEMBERS: readonly [AllFormInputPrimaryKeys.AdjudicationReviewFeedbackTemplate];
|
|
71
|
+
/**
|
|
72
|
+
* Members whose node cannot be built until assembly, because its shape depends
|
|
73
|
+
* on something only the caller knows.
|
|
74
|
+
*
|
|
75
|
+
* These differ from {@link DRAFT_INPUT_MEMBERS} in that there is no sensible
|
|
76
|
+
* default node to publish at all:
|
|
77
|
+
*
|
|
78
|
+
* - `workflowPickerConfig` needs the workflows available in the caller's
|
|
79
|
+
* context. With none, the member is not offered — the same reasoning that
|
|
80
|
+
* withholds the `api` source in `members/mat-options.ts`, and for the same
|
|
81
|
+
* reason: a fabricated `workflowId` produces a picker that looks right and
|
|
82
|
+
* points at nothing.
|
|
83
|
+
* - `formInputs` is the contents of a repeatable list, which is itself a list
|
|
84
|
+
* of columns. It can only be built once the remaining nesting depth is known,
|
|
85
|
+
* because Skillet has no way to express a recursive schema and the recursion
|
|
86
|
+
* has to be unrolled to a fixed depth instead.
|
|
87
|
+
*
|
|
88
|
+
* `variants.ts` resolves both while it walks an element's properties.
|
|
89
|
+
*/
|
|
90
|
+
export declare const ASSEMBLED_INPUT_MEMBERS: readonly [AllFormInputPrimaryKeys.WorkflowPickerConfig, AllFormInputPrimaryKeys.FormInputs];
|
|
91
|
+
/**
|
|
92
|
+
* Members whose schema produces an AUTHORING DRAFT rather than the stored
|
|
93
|
+
* shape, because some part of the stored shape is not knowable from a prompt.
|
|
94
|
+
*
|
|
95
|
+
* `matOptions` is the first of these: an api source is stored as a full
|
|
96
|
+
* endpoint configuration — `_id`, `httpEndPoint`, `httpMethod`, headers — and a
|
|
97
|
+
* model asked for that invents a URL. So the draft carries the id of an
|
|
98
|
+
* endpoint the caller supplied, and the application expands it before the form
|
|
99
|
+
* is validated.
|
|
100
|
+
*
|
|
101
|
+
* These are checked against their declared draft type rather than against the
|
|
102
|
+
* interface member, so the compiler still holds them to something. What it
|
|
103
|
+
* cannot check is the expansion itself; that contract lives with the caller.
|
|
104
|
+
*/
|
|
105
|
+
export declare const DRAFT_INPUT_MEMBERS: readonly [AllFormInputPrimaryKeys.MatOptions, AllFormInputPrimaryKeys.CalculatedFieldRules, AllFormInputPrimaryKeys.Validators, AllFormInputPrimaryKeys.ConditionalInputConfig, AllFormInputPrimaryKeys.MscoaConfig, AllFormInputPrimaryKeys.PaginationSelectionConfig, AllFormInputPrimaryKeys.CalculateListFunctions];
|
|
106
|
+
type SystemOwnedKey = (typeof SYSTEM_OWNED_INPUT_MEMBERS)[number];
|
|
107
|
+
type DeprecatedKey = (typeof DEPRECATED_INPUT_MEMBERS)[number];
|
|
108
|
+
type PendingKey = (typeof PENDING_INPUT_MEMBERS)[number];
|
|
109
|
+
type DraftKey = (typeof DRAFT_INPUT_MEMBERS)[number];
|
|
110
|
+
type AssembledKey = (typeof ASSEMBLED_INPUT_MEMBERS)[number];
|
|
111
|
+
/**
|
|
112
|
+
* The draft each drafted member is held to.
|
|
113
|
+
*
|
|
114
|
+
* Every one of these exists because the stored shape carries an identifier the
|
|
115
|
+
* builder assigns — an input's `id`, a rule's `id`, a segment's row key. A
|
|
116
|
+
* model authoring a form that does not exist yet cannot know any of them, so it
|
|
117
|
+
* binds by `formControlName` and the application resolves the pair. Each
|
|
118
|
+
* module states its own version of this; the list is here so the compiler
|
|
119
|
+
* checks them all in one place.
|
|
120
|
+
*/
|
|
121
|
+
interface MemberDrafts {
|
|
122
|
+
[AllFormInputPrimaryKeys.MatOptions]: MatOptionsDraft;
|
|
123
|
+
[AllFormInputPrimaryKeys.CalculatedFieldRules]: CalculatedFieldRulesDraft;
|
|
124
|
+
[AllFormInputPrimaryKeys.Validators]: ValidatorEntryDraft[];
|
|
125
|
+
[AllFormInputPrimaryKeys.ConditionalInputConfig]: ConditionalRuleDraft[];
|
|
126
|
+
[AllFormInputPrimaryKeys.MscoaConfig]: MscoaConfigDraft;
|
|
127
|
+
[AllFormInputPrimaryKeys.PaginationSelectionConfig]: PaginationSelectionConfigDraft;
|
|
128
|
+
[AllFormInputPrimaryKeys.CalculateListFunctions]: CalculateListFunctionsDraft;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Members whose model output must be expanded before it satisfies the
|
|
132
|
+
* interfaces. Kept apart from {@link inputMemberSchemas} so that consuming code
|
|
133
|
+
* cannot treat a draft as a finished value by accident.
|
|
134
|
+
*/
|
|
135
|
+
export declare const draftMemberSchemas: {
|
|
136
|
+
matOptions: s.ObjectType<{
|
|
137
|
+
optionType: import("@hashbrownai/core/src/schema/base").SchemaForUnion<"user" | null>;
|
|
138
|
+
options: s.ArrayType<s.ObjectType<{
|
|
139
|
+
label: s.StringType;
|
|
140
|
+
value: s.StringType;
|
|
141
|
+
}>>;
|
|
142
|
+
fetch: s.ObjectType<{
|
|
143
|
+
value: import("@hashbrownai/core/src/schema/base").SchemaForUnion<{
|
|
144
|
+
source: import("..").DataSources.Local;
|
|
145
|
+
inputSourceId: string;
|
|
146
|
+
allowManualValueEntry: boolean;
|
|
147
|
+
} | {
|
|
148
|
+
source: import("..").DataSources.CustomOptions;
|
|
149
|
+
} | {
|
|
150
|
+
source: import("..").DataSources.Api;
|
|
151
|
+
endpointId: string;
|
|
152
|
+
allowManualValueEntry: boolean;
|
|
153
|
+
} | {
|
|
154
|
+
source: import("..").DataSources.MongoDb;
|
|
155
|
+
workflowId: string;
|
|
156
|
+
} | null>;
|
|
157
|
+
options: import("@hashbrownai/core/src/schema/base").SchemaForUnion<{
|
|
158
|
+
source: import("..").DataSources.Local;
|
|
159
|
+
inputSourceId: string;
|
|
160
|
+
allowManualValueEntry: boolean;
|
|
161
|
+
} | {
|
|
162
|
+
source: import("..").DataSources.CustomOptions;
|
|
163
|
+
} | {
|
|
164
|
+
source: import("..").DataSources.Api;
|
|
165
|
+
endpointId: string;
|
|
166
|
+
allowManualValueEntry: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
source: import("..").DataSources.MongoDb;
|
|
169
|
+
workflowId: string;
|
|
170
|
+
} | null>;
|
|
171
|
+
}>;
|
|
172
|
+
}>;
|
|
173
|
+
calculatedFieldRules: s.ObjectType<{
|
|
174
|
+
formula: s.StringType;
|
|
175
|
+
variables: s.ArrayType<import("@hashbrownai/core/src/schema/base").SchemaForUnion<{
|
|
176
|
+
bindingType: "field";
|
|
177
|
+
variable: string;
|
|
178
|
+
label: string;
|
|
179
|
+
formControlName: string;
|
|
180
|
+
} | {
|
|
181
|
+
bindingType: "listAggregate";
|
|
182
|
+
variable: string;
|
|
183
|
+
label: string;
|
|
184
|
+
formControlName: string;
|
|
185
|
+
parentInputFormControl: string;
|
|
186
|
+
function: import("..").CalculationFunctions;
|
|
187
|
+
applyFunctionToCol: string;
|
|
188
|
+
applyFunctionToLabel: string | null;
|
|
189
|
+
filterValuesByCol: string | null;
|
|
190
|
+
filterValuesByThisColLabel: string | null;
|
|
191
|
+
tableCell: boolean | null;
|
|
192
|
+
}>>;
|
|
193
|
+
decimalPlaces: import("@hashbrownai/core/src/schema/base").SchemaForUnion<number | null>;
|
|
194
|
+
roundingMode: import("@hashbrownai/core/src/schema/base").SchemaForUnion<"FLOOR" | "CEIL" | "ROUND" | null>;
|
|
195
|
+
getFormulaFromAFormInput: import("@hashbrownai/core/src/schema/base").SchemaForUnion<boolean | null>;
|
|
196
|
+
formControlWithFormula: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | null>;
|
|
197
|
+
}>;
|
|
198
|
+
validators: s.ArrayType<import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | {
|
|
199
|
+
message: string;
|
|
200
|
+
expression: string;
|
|
201
|
+
canOverride: boolean;
|
|
202
|
+
inputsObservedForChanges: {
|
|
203
|
+
formControlName: string;
|
|
204
|
+
variable: string;
|
|
205
|
+
parentInputFormControl: string | null;
|
|
206
|
+
function: import("..").CalculationFunctions | null;
|
|
207
|
+
}[];
|
|
208
|
+
}>> | s.ArrayType<s.ObjectType<{
|
|
209
|
+
message: s.StringType;
|
|
210
|
+
expression: s.StringType;
|
|
211
|
+
canOverride: s.BooleanType;
|
|
212
|
+
inputsObservedForChanges: s.ArrayType<s.ObjectType<{
|
|
213
|
+
formControlName: s.StringType;
|
|
214
|
+
variable: s.StringType;
|
|
215
|
+
parentInputFormControl: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | null>;
|
|
216
|
+
function: import("@hashbrownai/core/src/schema/base").SchemaForUnion<import("..").CalculationFunctions | null>;
|
|
217
|
+
}>>;
|
|
218
|
+
}>>;
|
|
219
|
+
conditionalInputConfig: s.ArrayType<s.ObjectType<{
|
|
220
|
+
expression: s.StringType;
|
|
221
|
+
inputsObservedForChanges: s.ArrayType<s.ObjectType<{
|
|
222
|
+
formControlName: s.StringType;
|
|
223
|
+
variable: s.StringType;
|
|
224
|
+
parentInputFormControl: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | null>;
|
|
225
|
+
function: import("@hashbrownai/core/src/schema/base").SchemaForUnion<import("..").CalculationFunctions | null>;
|
|
226
|
+
}>>;
|
|
227
|
+
}>>;
|
|
228
|
+
mscoaConfig: s.ObjectType<{
|
|
229
|
+
accountingBasis: import("@hashbrownai/core/src/schema/base").SchemaForUnion<import("..").AccountingBasis | null>;
|
|
230
|
+
segments: s.ArrayType<s.ObjectType<{
|
|
231
|
+
segment: s.StringType;
|
|
232
|
+
customSegment: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | null>;
|
|
233
|
+
label: s.StringType;
|
|
234
|
+
readOnly: s.BooleanType;
|
|
235
|
+
singleSelect: s.BooleanType;
|
|
236
|
+
additionalAccounts: s.ArrayType<s.StringType>;
|
|
237
|
+
inheritValueFromAccrual: import("@hashbrownai/core/src/schema/base").SchemaForUnion<boolean | null>;
|
|
238
|
+
vatSelectonActive: import("@hashbrownai/core/src/schema/base").SchemaForUnion<boolean | null>;
|
|
239
|
+
segmentExtension: s.BooleanType;
|
|
240
|
+
}>>;
|
|
241
|
+
cashSegments: import("@hashbrownai/core/src/schema/base").SchemaForUnion<{
|
|
242
|
+
segment: string;
|
|
243
|
+
customSegment: string | null;
|
|
244
|
+
label: string;
|
|
245
|
+
readOnly: boolean;
|
|
246
|
+
singleSelect: boolean;
|
|
247
|
+
additionalAccounts: string[];
|
|
248
|
+
inheritValueFromAccrual: boolean | null;
|
|
249
|
+
vatSelectonActive: boolean | null;
|
|
250
|
+
segmentExtension: boolean;
|
|
251
|
+
}[] | null>;
|
|
252
|
+
accountValueLabel: s.EnumType<string[]>;
|
|
253
|
+
showAllSegments: s.BooleanType;
|
|
254
|
+
extensionAccountsForSegments: s.ArrayType<s.StringType>;
|
|
255
|
+
dualCashExclusion: import("@hashbrownai/core/src/schema/base").SchemaForUnion<{
|
|
256
|
+
rules: {
|
|
257
|
+
pattern: string;
|
|
258
|
+
flags: string | null;
|
|
259
|
+
matchField: string | null;
|
|
260
|
+
segment: string | null;
|
|
261
|
+
description: string | null;
|
|
262
|
+
}[] | null;
|
|
263
|
+
matchMode: "any" | "all" | null;
|
|
264
|
+
} | null>;
|
|
265
|
+
}>;
|
|
266
|
+
paginationSelectionConfig: s.ObjectType<{
|
|
267
|
+
useLocalPagination: import("@hashbrownai/core/src/schema/base").SchemaForUnion<boolean | null>;
|
|
268
|
+
columns: s.ArrayType<s.ObjectType<{
|
|
269
|
+
key: s.StringType;
|
|
270
|
+
label: s.StringType;
|
|
271
|
+
}>>;
|
|
272
|
+
}>;
|
|
273
|
+
calculateListFunctions: s.ArrayType<s.ObjectType<{
|
|
274
|
+
formControlName: s.StringType;
|
|
275
|
+
func: s.EnumType<import("..").CalculationFunctions[]>;
|
|
276
|
+
}>>;
|
|
277
|
+
};
|
|
278
|
+
/** Every key this registry is obliged to cover. */
|
|
279
|
+
export type ModelledKey = Exclude<AllFormInputPrimaryKeys, SystemOwnedKey | PendingKey | DeprecatedKey | DraftKey | AssembledKey>;
|
|
280
|
+
export declare const inputMemberSchemas: {
|
|
281
|
+
element: s.EnumType<import("..").ElementTypes[]>;
|
|
282
|
+
label: s.StringType;
|
|
283
|
+
formControlName: s.StringType;
|
|
284
|
+
colSize: s.IntegerType;
|
|
285
|
+
appearance: s.EnumType<["fill", "outline"]>;
|
|
286
|
+
dataType: s.EnumType<import("..").InputDataTypes[]>;
|
|
287
|
+
type: s.EnumType<import("..").InputTypes[]>;
|
|
288
|
+
viewType: s.EnumType<import("../interfaces/formInput/BasicFormInputInterface.js").InputViewTypes.ViewOnly[]>;
|
|
289
|
+
required: s.BooleanType;
|
|
290
|
+
readonly: s.BooleanType;
|
|
291
|
+
showAsLabel: s.BooleanType;
|
|
292
|
+
onlySetTempErrorOnTouch: s.BooleanType;
|
|
293
|
+
isCalculatedField: s.BooleanType;
|
|
294
|
+
hintLabel: s.StringType;
|
|
295
|
+
tourContent: s.StringType;
|
|
296
|
+
spellcheck: s.BooleanType;
|
|
297
|
+
autocapitalize: s.EnumType<import("..").AutocapitalizeOptions[]>;
|
|
298
|
+
rows: s.IntegerType;
|
|
299
|
+
wrap: s.EnumType<["hard", "soft"]>;
|
|
300
|
+
richTextEditorLibrary: s.EnumType<import("..").RichTextEditorType[]>;
|
|
301
|
+
min: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | number>;
|
|
302
|
+
max: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | number>;
|
|
303
|
+
minLength: s.IntegerType;
|
|
304
|
+
maxLength: s.IntegerType;
|
|
305
|
+
optionSelectType: s.EnumType<import("..").OptionSelectTypes[]>;
|
|
306
|
+
allowMultipleSelection: s.BooleanType;
|
|
307
|
+
singleSelect: s.BooleanType;
|
|
308
|
+
groupBy: s.ArrayType<s.StringType>;
|
|
309
|
+
labelPosition: s.EnumType<import("../interfaces/formInput/ToggleInputInterface.js").LabelPosition[]>;
|
|
310
|
+
trueLabel: s.StringType;
|
|
311
|
+
falseLabel: s.StringType;
|
|
312
|
+
startDateControl: s.StringType;
|
|
313
|
+
endDateControl: s.StringType;
|
|
314
|
+
fileType: s.EnumType<import("..").InputFileType[]>;
|
|
315
|
+
accept: s.StringType;
|
|
316
|
+
handleLabel: s.StringType;
|
|
317
|
+
pipe: s.ObjectType<{
|
|
318
|
+
pipeType: s.EnumType<import("..").InputPipeTypes[]>;
|
|
319
|
+
param: s.StringType;
|
|
320
|
+
}>;
|
|
321
|
+
linkedSegmentId: s.StringType;
|
|
322
|
+
adjudicationStep: s.EnumType<import("..").AdjudicationSteps[]>;
|
|
323
|
+
adjudicationPointTypes: s.ArrayType<s.StringType>;
|
|
324
|
+
workflowFormForScoreSheet: s.StringType;
|
|
325
|
+
value: import("@hashbrownai/core/src/schema/base").SchemaForUnion<string | number | boolean>;
|
|
326
|
+
script: s.ObjectType<{
|
|
327
|
+
onChange: s.StringType;
|
|
328
|
+
}>;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Every key is classified. Adding a member to `AllFormInputPrimaryKeys` fails
|
|
332
|
+
* here until it is modelled, deferred, or declared system-owned.
|
|
333
|
+
*/
|
|
334
|
+
export type _EveryKeyClassified = AssertNever<Exclude<AllFormInputPrimaryKeys, ModelledKey | PendingKey | SystemOwnedKey | DeprecatedKey | DraftKey | AssembledKey>>;
|
|
335
|
+
/**
|
|
336
|
+
* No key may be claimed by two categories at once.
|
|
337
|
+
*
|
|
338
|
+
* Written as each category against the union of those after it rather than as
|
|
339
|
+
* every pair spelled out: the pairwise form needed ten lines for five
|
|
340
|
+
* categories and would need fifteen for six, which is the kind of list that
|
|
341
|
+
* quietly loses an entry when the next category is added.
|
|
342
|
+
*/
|
|
343
|
+
export type _CategoriesDisjoint = AssertNever<(ModelledKey & (PendingKey | SystemOwnedKey | DeprecatedKey | DraftKey | AssembledKey)) | (PendingKey & (SystemOwnedKey | DeprecatedKey | DraftKey | AssembledKey)) | (SystemOwnedKey & (DeprecatedKey | DraftKey | AssembledKey)) | (DeprecatedKey & (DraftKey | AssembledKey)) | (DraftKey & AssembledKey)>;
|
|
344
|
+
/**
|
|
345
|
+
* Every drafted node produces the draft it declares. The expansion from draft
|
|
346
|
+
* to stored shape is the caller's, but the draft itself stays checked.
|
|
347
|
+
*/
|
|
348
|
+
export type _NoDraftDrift = AssertNever<{
|
|
349
|
+
[K in DraftKey]: [s.Infer<(typeof draftMemberSchemas)[K]>] extends [
|
|
350
|
+
MemberDrafts[K]
|
|
351
|
+
] ? never : K;
|
|
352
|
+
}[DraftKey]>;
|
|
353
|
+
/**
|
|
354
|
+
* Every modelled node still produces a value its interface member can hold.
|
|
355
|
+
* Retyping a member in the interfaces surfaces here, by name, as a constraint
|
|
356
|
+
* violation on the offending key.
|
|
357
|
+
*
|
|
358
|
+
* Narrowing is permitted by design — several nodes deliberately refuse value
|
|
359
|
+
* shapes the interface tolerates but a model should never invent.
|
|
360
|
+
*/
|
|
361
|
+
export type _NoValueDrift = AssertNever<{
|
|
362
|
+
[K in ModelledKey]: [s.Infer<(typeof inputMemberSchemas)[K]>] extends [
|
|
363
|
+
MemberValue<K>
|
|
364
|
+
] ? never : K;
|
|
365
|
+
}[ModelledKey]>;
|
|
366
|
+
/**
|
|
367
|
+
* Keys the enum declares but no interface in this package backs, so
|
|
368
|
+
* {@link MemberValue} cannot constrain them and their nodes go unverified.
|
|
369
|
+
* Exported deliberately: this is pre-existing drift the schemas inherit, not
|
|
370
|
+
* something they introduce.
|
|
371
|
+
*/
|
|
372
|
+
export type UnbackedInputMember = Exclude<AllFormInputPrimaryKeys, keyof FormColumnInputs>;
|
|
373
|
+
/** Runtime access to the full key list, derived from the enum. */
|
|
374
|
+
export declare const ALL_INPUT_MEMBER_KEYS: AllFormInputPrimaryKeys[];
|
|
375
|
+
export {};
|