ngx-t-forms-types 0.0.30 → 0.0.34

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.
Files changed (68) hide show
  1. package/dist/interfaces/Form/formSubmissionHandleInterface.d.ts +6 -0
  2. package/dist/interfaces/FormBuilder/DefaultEelement.js +76 -0
  3. package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.d.ts +13 -0
  4. package/dist/interfaces/FormBuilder/FormInputKeys.d.ts +6 -0
  5. package/dist/interfaces/FormBuilder/FormInputKeys.js +6 -0
  6. package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +188 -3
  7. package/dist/interfaces/Import/ImportIdentity.d.ts +32 -0
  8. package/dist/interfaces/Import/ImportIdentity.js +1 -0
  9. package/dist/interfaces/Import/ImportProgress.d.ts +12 -1
  10. package/dist/interfaces/Import/ImportRowState.d.ts +52 -1
  11. package/dist/interfaces/Import/index.d.ts +2 -1
  12. package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.d.ts +34 -0
  13. package/dist/interfaces/formInput/BasicFormInputInterface.d.ts +1 -0
  14. package/dist/interfaces/formInput/BasicFormInputInterface.js +1 -0
  15. package/dist/interfaces/formInput/IMscoaAccount.d.ts +19 -3
  16. package/dist/interfaces/formInput/ISelectInputInterface.d.ts +12 -0
  17. package/dist/interfaces/formInput/MultipleInterface.d.ts +10 -0
  18. package/dist/interfaces/formInput/WorkflowDocumentPicker.d.ts +2 -0
  19. package/dist/schemas/FormInputSchema.js +41 -2
  20. package/dist/schemas/MatOptionsSchema.js +7 -0
  21. package/dist/schemas/MscoaConfigSchema.js +1 -0
  22. package/dist/schemas/index.d.ts +2 -1
  23. package/dist/schemas/index.js +2 -1
  24. package/dist/skillet/authoring-rules.d.ts +41 -0
  25. package/dist/skillet/authoring-rules.js +61 -0
  26. package/dist/skillet/extra-members.d.ts +143 -0
  27. package/dist/skillet/extra-members.js +79 -0
  28. package/dist/skillet/form.d.ts +170 -0
  29. package/dist/skillet/form.js +139 -0
  30. package/dist/skillet/index.d.ts +43 -0
  31. package/dist/skillet/index.js +46 -0
  32. package/dist/skillet/input-members.d.ts +375 -0
  33. package/dist/skillet/input-members.js +186 -0
  34. package/dist/skillet/internal/coupling.d.ts +63 -0
  35. package/dist/skillet/internal/coupling.js +69 -0
  36. package/dist/skillet/internal/editor-guidance.d.ts +64 -0
  37. package/dist/skillet/internal/editor-guidance.js +291 -0
  38. package/dist/skillet/members/calculated-field.d.ts +155 -0
  39. package/dist/skillet/members/calculated-field.js +105 -0
  40. package/dist/skillet/members/conditional.d.ts +69 -0
  41. package/dist/skillet/members/conditional.js +16 -0
  42. package/dist/skillet/members/document-picker.d.ts +182 -0
  43. package/dist/skillet/members/document-picker.js +111 -0
  44. package/dist/skillet/members/mat-options.d.ts +187 -0
  45. package/dist/skillet/members/mat-options.js +92 -0
  46. package/dist/skillet/members/mscoa.d.ts +182 -0
  47. package/dist/skillet/members/mscoa.js +129 -0
  48. package/dist/skillet/members/pagination.d.ts +59 -0
  49. package/dist/skillet/members/pagination.js +16 -0
  50. package/dist/skillet/members/table.d.ts +178 -0
  51. package/dist/skillet/members/table.js +105 -0
  52. package/dist/skillet/members/validators.d.ts +197 -0
  53. package/dist/skillet/members/validators.js +74 -0
  54. package/dist/skillet/members/value.d.ts +154 -0
  55. package/dist/skillet/members/value.js +97 -0
  56. package/dist/skillet/shared-types.d.ts +57 -0
  57. package/dist/skillet/shared-types.js +69 -0
  58. package/dist/skillet/tests/house-rules.spec.d.ts +1 -0
  59. package/dist/skillet/tests/house-rules.spec.js +162 -0
  60. package/dist/skillet/tests/skillet-coupling.spec.d.ts +1 -0
  61. package/dist/skillet/tests/skillet-coupling.spec.js +191 -0
  62. package/dist/skillet/tests/variant-assembly.spec.d.ts +1 -0
  63. package/dist/skillet/tests/variant-assembly.spec.js +643 -0
  64. package/dist/skillet/variants.d.ts +138 -0
  65. package/dist/skillet/variants.js +536 -0
  66. package/dist/skillet/workflow-context.d.ts +95 -0
  67. package/dist/skillet/workflow-context.js +128 -0
  68. package/package.json +78 -60
@@ -0,0 +1,191 @@
1
+ import { s } from '@hashbrownai/core';
2
+ import { AllFormInputPrimaryKeys, FormInputKeys, SpecialElementKeys, } from '../../interfaces/FormBuilder/FormInputKeys.js';
3
+ import { DRAFT_COMPLETION_REQUIRED } from '../form.js';
4
+ import { ElementTypes } from '../../interfaces/formInput/index.js';
5
+ import { DataSources } from '../../interfaces/formInput/APIDataFetchingConfigurationInterface.js';
6
+ import { ASSEMBLED_INPUT_MEMBERS, DEPRECATED_INPUT_MEMBERS, DRAFT_INPUT_MEMBERS, draftMemberSchemas, PENDING_INPUT_MEMBERS, SYSTEM_OWNED_INPUT_MEMBERS, inputMemberSchemas, } from '../input-members.js';
7
+ import { ALWAYS_SHOWN_MEMBERS, SECONDARY_GUIDED_PATHS, UNREADABLE_EXPRESSIONS, describeIn, } from '../internal/editor-guidance.js';
8
+ import { createMatOptionsSchema } from '../members/mat-options.js';
9
+ import { createWorkflowPickerSchema } from '../members/document-picker.js';
10
+ import { createValidatorsSchema } from '../members/validators.js';
11
+ import { elementTypeSchema } from '../shared-types.js';
12
+ /**
13
+ * Covers the invariants the compiler cannot reach.
14
+ *
15
+ * The type-level assertions in `input-members.ts` already prove that every key
16
+ * is classified and that no node produces a value its interface cannot hold —
17
+ * those fail the build, so they need no test. What is left is everything that
18
+ * depends on runtime values: whether the derivation actually found the guidance
19
+ * it was pointed at, and whether the enum-derived nodes really carry the
20
+ * members their enums declare.
21
+ */
22
+ describe('skillet coupling', () => {
23
+ it('reads every applicability expression in the editor config', () => {
24
+ // The expression grammar is closed today — `key === value` joined by `||`.
25
+ // Reaching for `&&` or `!==` in ElementEditConfig would leave the rule
26
+ // unparsed and silently drop that guidance from the schema, so the failure
27
+ // has to surface somewhere. It surfaces here.
28
+ expect(UNREADABLE_EXPRESSIONS).toEqual([]);
29
+ });
30
+ it('classifies every key exactly once', () => {
31
+ const categories = [
32
+ Object.keys(inputMemberSchemas),
33
+ [...PENDING_INPUT_MEMBERS],
34
+ [...SYSTEM_OWNED_INPUT_MEMBERS],
35
+ [...DEPRECATED_INPUT_MEMBERS],
36
+ [...DRAFT_INPUT_MEMBERS],
37
+ [...ASSEMBLED_INPUT_MEMBERS],
38
+ ].flat();
39
+ const enumKeys = Object.values(AllFormInputPrimaryKeys);
40
+ expect(categories.length).toBe(enumKeys.length);
41
+ expect(new Set(categories).size).toBe(categories.length);
42
+ expect([...categories].sort()).toEqual([...enumKeys].sort());
43
+ });
44
+ it('gives every modelled member a description', () => {
45
+ const undescribed = Object.entries(inputMemberSchemas)
46
+ .filter(([, node]) => {
47
+ const description = s.getDescription(node);
48
+ // Union nodes carry their descriptions on the branches rather than the
49
+ // node itself, so an empty description there is expected.
50
+ return description !== undefined && description.trim() === '';
51
+ })
52
+ .map(([key]) => key);
53
+ expect(undescribed).toEqual([]);
54
+ });
55
+ it('derives element options from the live enum, not a copied list', () => {
56
+ const json = s.toJsonSchema(elementTypeSchema);
57
+ const entries = json.properties.__wrappedPrimitive.enum;
58
+ expect([...entries].sort()).toEqual([...Object.values(ElementTypes)].sort());
59
+ // Members commented out of `ElementTypes` must not reappear. A hand-copied
60
+ // list is exactly how they would.
61
+ expect(entries).not.toContain('qrCodeScanner');
62
+ expect(entries).not.toContain('matrixTable');
63
+ });
64
+ it('excludes deprecated and system-owned members from generation', () => {
65
+ const modelled = Object.keys(inputMemberSchemas);
66
+ for (const key of DEPRECATED_INPUT_MEMBERS) {
67
+ expect(modelled).not.toContain(key);
68
+ }
69
+ for (const key of SYSTEM_OWNED_INPUT_MEMBERS) {
70
+ expect(modelled).not.toContain(key);
71
+ }
72
+ });
73
+ it('never offers an api source unless endpoints were supplied', () => {
74
+ // The whole point of the factory. With no endpoint list there is nothing
75
+ // for a model to select, so the branch must not exist — otherwise it
76
+ // invents an `httpEndPoint`, and a form pointing at a URL that does not
77
+ // exist looks completely correct until someone opens it.
78
+ const json = JSON.stringify(s.toJsonSchema(draftMemberSchemas[AllFormInputPrimaryKeys.MatOptions]));
79
+ expect(json).not.toContain('httpEndPoint');
80
+ expect(json).not.toContain('endpointId');
81
+ expect(json).toContain(DataSources.Local);
82
+ expect(json).toContain(DataSources.CustomOptions);
83
+ });
84
+ it('offers an api source once endpoints are supplied', () => {
85
+ const json = JSON.stringify(s.toJsonSchema(createMatOptionsSchema({
86
+ apiEndpoints: [{ id: 'abc123', name: 'Departments' }],
87
+ })));
88
+ expect(json).toContain('endpointId');
89
+ // The model selects a known id; it is never asked to author a URL.
90
+ expect(json).toContain('abc123');
91
+ expect(json).not.toContain('httpEndPoint');
92
+ });
93
+ it('takes the colSize bounds from the editor range control', () => {
94
+ const json = s.toJsonSchema(inputMemberSchemas[AllFormInputPrimaryKeys.ColSize]);
95
+ const bounds = json.properties.__wrappedPrimitive;
96
+ expect(bounds.minimum).toBe(1);
97
+ expect(bounds.maximum).toBe(12);
98
+ });
99
+ it('reaches the guidance inside secondary editors', () => {
100
+ // Rows nested in a `secondaryElementEditorConfig` were invisible to the
101
+ // derivation until it was taught to walk into them, and nothing failed to
102
+ // say so — the hints simply were not there. Both editors that exist today
103
+ // must be found, or that silent loss is back.
104
+ expect([...SECONDARY_GUIDED_PATHS.keys()].sort()).toEqual([
105
+ 'mscoaConfig',
106
+ 'workflowPickerConfig.presetFilters',
107
+ ]);
108
+ const filterPaths = SECONDARY_GUIDED_PATHS.get('workflowPickerConfig.presetFilters');
109
+ expect(filterPaths).toContain('valueSource');
110
+ expect(filterPaths).toContain('fromInputId');
111
+ });
112
+ it('derives the rows the settings panel shows on every element', () => {
113
+ // A `Default` row is rendered for every element and listed in no
114
+ // element's `properties`, so the members it edits were invisible to
115
+ // assembly. The derivation must find the ungated ones and leave the
116
+ // gated ones — `min` needs a numeric type, the rules need the flag — to
117
+ // the structural handling they already have.
118
+ expect(ALWAYS_SHOWN_MEMBERS).toContain(AllFormInputPrimaryKeys.Readonly);
119
+ expect(ALWAYS_SHOWN_MEMBERS).toContain(AllFormInputPrimaryKeys.OnlySetTempErrorOnTouch);
120
+ expect(ALWAYS_SHOWN_MEMBERS).toContain(AllFormInputPrimaryKeys.TourContent);
121
+ expect(ALWAYS_SHOWN_MEMBERS).toContain(AllFormInputPrimaryKeys.HintLabel);
122
+ expect(ALWAYS_SHOWN_MEMBERS).not.toContain(AllFormInputPrimaryKeys.Min);
123
+ expect(ALWAYS_SHOWN_MEMBERS).not.toContain(AllFormInputPrimaryKeys.IsCalculatedField);
124
+ expect(ALWAYS_SHOWN_MEMBERS).not.toContain(AllFormInputPrimaryKeys.CalculatedFieldRules);
125
+ // A nested binding belongs to the object that owns it, not to the column.
126
+ expect(ALWAYS_SHOWN_MEMBERS).not.toContain(AllFormInputPrimaryKeys.Script);
127
+ });
128
+ it('reads a negated applicability test as an exclusion', () => {
129
+ // `valueSource !== input` used to be rejected outright. Reading it as a
130
+ // POSITIVE rule would be worse than dropping it, so the polarity is what
131
+ // this pins down.
132
+ const fixed = describeIn('Base.', ['workflowPickerConfig', 'presetFilters'], 'value');
133
+ expect(fixed).toContain('valueSource is not input');
134
+ expect(fixed).not.toContain('valueSource is input.');
135
+ const bound = describeIn('Base.', ['workflowPickerConfig', 'presetFilters'], 'fromInputId');
136
+ expect(bound).toContain('valueSource is input');
137
+ });
138
+ it('keeps a secondary editor from leaking onto its opening path', () => {
139
+ // The mSCOA composite editor opens at `mscoaConfig` but edits dual-cash
140
+ // exclusion RULES, so prefixing its rows with the opening path would file
141
+ // `pattern` under `mscoaConfig.pattern` — a path nothing has. Guidance for
142
+ // it must be reachable through the nested lookup and nowhere else.
143
+ expect(SECONDARY_GUIDED_PATHS.get('mscoaConfig')).toContain('pattern');
144
+ expect(describeIn('Base.', ['mscoaConfig'], 'pattern')).not.toBe('Base.');
145
+ });
146
+ it('offers a validator as either a known name or a rule written inline', () => {
147
+ // The member is `Array<FormControlCustomValidatorsInterface | string>` and
148
+ // Joi mirrors it with `alternatives().try(string, object)`. Collapsing that
149
+ // to one branch is the failure this guards: only the object, and every
150
+ // built-in has to be rewritten by hand; only the string, and no
151
+ // form-specific rule can be expressed at all.
152
+ // The named branch exists only over names the caller supplied — with none,
153
+ // the item is the inline rule alone; see the house-rules spec.
154
+ // A schema whose root is not an object comes back wrapped, the same way
155
+ // the colSize bounds above are read.
156
+ const json = s.toJsonSchema(createValidatorsSchema({ namedValidators: [{ name: 'email' }] }));
157
+ const branches = json.properties.__wrappedPrimitive.items.anyOf.map((branch) => branch.type);
158
+ expect(branches).toContain('string');
159
+ expect(branches).toContain('object');
160
+ });
161
+ it('states every completion path against a member that exists', () => {
162
+ // `DRAFT_COMPLETION_REQUIRED` prefixes each module's entries with the column
163
+ // path they hang off, so a module has to start its own entries at the member
164
+ // it owns. `calculated-field` began at `variables[].id` instead of
165
+ // `calculatedFieldRules.variables[].id`, and the aggregate came out as
166
+ // `slides[].columns[].variables[].id` — a confident-looking path to nowhere,
167
+ // which is worse than an absent one for whoever writes the expansion.
168
+ const COLUMN = 'slides[].columns[].';
169
+ const known = new Set([
170
+ ...Object.values(AllFormInputPrimaryKeys),
171
+ ...Object.values(FormInputKeys),
172
+ ...Object.values(SpecialElementKeys),
173
+ ]);
174
+ const bad = DRAFT_COMPLETION_REQUIRED.filter((path) => path.startsWith(COLUMN))
175
+ .map((path) => path.slice(COLUMN.length).split(/[.[\s]/)[0])
176
+ .filter((member) => !known.has(member));
177
+ expect([...new Set(bad)]).toEqual([]);
178
+ });
179
+ it('never offers a document picker unless workflows were supplied', () => {
180
+ // Same reasoning as the api source above: `workflowId` is required, and a
181
+ // fabricated one produces a picker that looks right and resolves to
182
+ // nothing.
183
+ expect(createWorkflowPickerSchema()).toBeNull();
184
+ expect(createWorkflowPickerSchema({ workflows: [] })).toBeNull();
185
+ const offered = createWorkflowPickerSchema({
186
+ workflows: [{ id: 'wf-1', name: 'Purchase requisition' }],
187
+ });
188
+ expect(offered).not.toBeNull();
189
+ expect(JSON.stringify(s.toJsonSchema(offered))).toContain('wf-1');
190
+ });
191
+ });
@@ -0,0 +1 @@
1
+ export {};