@uides/stepwise 1.1.0-rc.26 → 2.0.0-b15d5d44

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 (73) hide show
  1. package/.rush/temp/chunked-rush-logs/stepwise.build.chunks.jsonl +4 -8
  2. package/.rush/temp/package-deps_build.json +67 -67
  3. package/.rush/temp/shrinkwrap-deps.json +2 -2
  4. package/package.json +6 -6
  5. package/rush-logs/stepwise.build.log +4 -8
  6. package/src/schemas/__tests__/step.spec.ts +2 -4
  7. package/src/schemas/action.ts +132 -131
  8. package/src/schemas/application.ts +7 -8
  9. package/src/schemas/attributes.ts +1 -1
  10. package/src/schemas/common.ts +15 -82
  11. package/src/schemas/document.ts +53 -49
  12. package/src/schemas/edupass-healthstate.ts +47 -44
  13. package/src/schemas/field/afm/index.ts +11 -12
  14. package/src/schemas/field/amka/index.ts +10 -9
  15. package/src/schemas/field/attachment/index.ts +21 -20
  16. package/src/schemas/field/captcha/index.ts +8 -7
  17. package/src/schemas/field/choice/index.ts +20 -19
  18. package/src/schemas/field/common.spec.ts +7 -13
  19. package/src/schemas/field/common.ts +103 -85
  20. package/src/schemas/field/date/index.ts +24 -23
  21. package/src/schemas/field/doc_subtitle/index.ts +10 -9
  22. package/src/schemas/field/doc_title/index.ts +18 -17
  23. package/src/schemas/field/dynamically-filled-text/index.ts +26 -24
  24. package/src/schemas/field/email/index.ts +12 -11
  25. package/src/schemas/field/fillable-string/index.ts +18 -17
  26. package/src/schemas/field/five-block-date/index.ts +8 -7
  27. package/src/schemas/field/green-pass-qrcode/index.ts +14 -15
  28. package/src/schemas/field/hidden/index.ts +58 -64
  29. package/src/schemas/field/hierarchical-selector/index.ts +27 -25
  30. package/src/schemas/field/iban/index.ts +11 -10
  31. package/src/schemas/field/image/index.ts +19 -18
  32. package/src/schemas/field/index.spec.ts +17 -19
  33. package/src/schemas/field/index.ts +176 -85
  34. package/src/schemas/field/int/index.ts +11 -10
  35. package/src/schemas/field/lab-results/index.ts +9 -8
  36. package/src/schemas/field/landline_phone/index.ts +8 -7
  37. package/src/schemas/field/mobile_phone/index.ts +12 -11
  38. package/src/schemas/field/multiple-choice/index.ts +15 -14
  39. package/src/schemas/field/pdf-image/index.ts +14 -13
  40. package/src/schemas/field/postal_code/index.ts +9 -8
  41. package/src/schemas/field/qrcode/index.ts +18 -17
  42. package/src/schemas/field/quote/index.ts +18 -17
  43. package/src/schemas/field/radio-choice/index.ts +21 -15
  44. package/src/schemas/field/rate/index.ts +10 -9
  45. package/src/schemas/field/recipient/index.ts +11 -10
  46. package/src/schemas/field/redirect/index.ts +12 -11
  47. package/src/schemas/field/refcode/index.ts +25 -24
  48. package/src/schemas/field/string/index.ts +42 -41
  49. package/src/schemas/field/text/index.ts +23 -22
  50. package/src/schemas/field/three-block-date/index.ts +15 -14
  51. package/src/schemas/fieldset/component-params.ts +40 -37
  52. package/src/schemas/fieldset/display-components.ts +42 -49
  53. package/src/schemas/fieldset/enums.ts +12 -6
  54. package/src/schemas/fieldset/index.ts +9 -10
  55. package/src/schemas/layout.ts +43 -32
  56. package/src/schemas/outputs.ts +7 -6
  57. package/src/schemas/resource/enums.ts +6 -6
  58. package/src/schemas/resource/field.ts +10 -8
  59. package/src/schemas/resource/object-action.ts +21 -16
  60. package/src/schemas/resource/resource-action.ts +19 -17
  61. package/src/schemas/resource/resource.ts +19 -20
  62. package/src/schemas/step.ts +116 -115
  63. package/src/schemas/template/enums.ts +2 -2
  64. package/src/schemas/template/template-base.ts +15 -13
  65. package/src/schemas/template/template-source.ts +12 -13
  66. package/src/schemas/template/template.ts +12 -13
  67. package/src/schemas/validation-context/enums.ts +5 -5
  68. package/src/schemas/validation-context/validation-context.ts +45 -44
  69. package/src/utils/index.spec.ts +2 -0
  70. package/src/utils/index.ts +5 -3
  71. package/.rush/temp/chunked-rush-logs/stepwise.lint.chunks.jsonl +0 -2
  72. package/rush-logs/stepwise.lint.error.log +0 -1
  73. package/rush-logs/stepwise.lint.log +0 -2
@@ -1,8 +1,7 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- // const Dataset = nullish(
4
+ // const DatasetSchema = v.nullish(
6
5
  // v.picklist([
7
6
  // '/api/datasets/aako',
8
7
  // '/api/datasets/dimos-lixiarcheio-all',
@@ -17,39 +16,39 @@ import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
17
16
  // ])
18
17
  // );
19
18
 
20
- const HiddenDisplay = createFieldDisplay(
21
- object({
19
+ const HiddenDisplaySchema = createFieldDisplay(
20
+ v.strictObject({
22
21
  component: v.literal('hidden'),
23
- // choices: nullish(v.record(v.string())),
24
- // 'choices-order': nullish(v.string()),
25
- // 'component-params': nullish(
26
- // object({
27
- // bold: nullish(v.boolean()),
28
- // cell_valign: nullish(v.picklist(['BOTTOM', 'MIDDLE', 'TOP'])),
29
- // coordinates: nullish(v.array(v.nullable(v.number()))),
30
- // country: nullish(v.literal('gr')),
31
- // dependencies: nullish(v.record(v.string())),
32
- // 'dependencies-error-message': nullish(v.string()),
22
+ // choices: v.nullish(v.record(v.string())),
23
+ // 'choices-order': v.nullish(v.string()),
24
+ // 'component-params': v.nullish(
25
+ // v.strictObject({
26
+ // bold: v.nullish(v.boolean()),
27
+ // cell_valign: v.nullish(v.picklist(['BOTTOM', 'MIDDLE', 'TOP'])),
28
+ // coordinates: v.nullish(v.array(v.nullable(v.number()))),
29
+ // country: v.nullish(v.literal('gr')),
30
+ // dependencies: v.nullish(v.record(v.string())),
31
+ // 'dependencies-error-message': v.nullish(v.string()),
33
32
  // dataset: Dataset,
34
- // enforceUppercase: nullish(v.boolean()),
35
- // filetype: nullish(v.picklist(['pdf', 'pdf-for-mark'])),
36
- // 'file-max-size': nullish(v.number()),
37
- // fontSize: nullish(v.number()),
38
- // format: nullish(v.literal('plaintext')),
39
- // 'format-title': nullish(v.boolean()),
40
- // level: nullish(v.literal('Q')),
41
- // mode: nullish(v.picklist(['warning', 'info'])),
42
- // position: nullish(v.picklist(['left', 'right', 'center', 'justify'])),
43
- // size: nullish(v.number()),
44
- // textColor: nullish(v.string()),
45
- // 'later-pages': nullish(v.boolean()),
46
- // 'legacy-mode': nullish(v.boolean()),
33
+ // enforceUppercase: v.nullish(v.boolean()),
34
+ // filetype: v.nullish(v.picklist(['pdf', 'pdf-for-mark'])),
35
+ // 'file-max-size': v.nullish(v.number()),
36
+ // fontSize: v.nullish(v.number()),
37
+ // format: v.nullish(v.literal('plaintext')),
38
+ // 'format-title': v.nullish(v.boolean()),
39
+ // level: v.nullish(v.literal('Q')),
40
+ // mode: v.nullish(v.picklist(['warning', 'info'])),
41
+ // position: v.nullish(v.picklist(['left', 'right', 'center', 'justify'])),
42
+ // size: v.nullish(v.number()),
43
+ // textColor: v.nullish(v.string()),
44
+ // 'later-pages': v.nullish(v.boolean()),
45
+ // 'legacy-mode': v.nullish(v.boolean()),
47
46
  // })
48
47
  // ),
49
48
  })
50
49
  );
51
50
 
52
- // const HiddenDatatype = nullish(
51
+ // const HiddenDatatypeSchema = v.nullish(
53
52
  // v.picklist([
54
53
  // 'attachment',
55
54
  // 'entity_recipient',
@@ -59,40 +58,35 @@ const HiddenDisplay = createFieldDisplay(
59
58
  // ])
60
59
  // );
61
60
 
62
- const Hidden = object(
63
- {
64
- 'user-input-mode': v.picklist([
65
- 'noinput',
66
- 'optional',
67
- 'required',
68
- 'display',
69
- ]),
70
- display: HiddenDisplay,
71
- datatype: nullish(v.string()),
72
- sources: nullish(v.string()),
73
- 'value-constructor': nullish(v.string()),
74
- value: nullish(v.string()),
75
- attribute: nullish(v.string()),
76
- 'default-value': nullish(v.string()),
77
- 'dataset-source-fn': nullish(v.string()),
78
- 'is-display-field': nullish(v.boolean()),
79
- },
80
- [
81
- // v.custom((values) => {
82
- // const datatype = values.datatype;
83
- // const display = values.display;
84
- // if (!datatype) {
85
- // if (display.default?.el) {
86
- // const node = display.default.el;
87
- // if (node.component === 'hidden') {
88
- // return false;
89
- // }
90
- // }
91
- // }
92
- // return true;
93
- // }, "Component 'hidden' with datatype not set"),
94
- ]
95
- );
96
- export type HiddenType = v.BaseSchema<v.Output<typeof Hidden>>;
61
+ // [
62
+ // v.custom((values) => {
63
+ // const datatype = values.datatype;
64
+ // const display = values.display;
65
+ // if (!datatype) {
66
+ // if (display.default?.el) {
67
+ // const node = display.default.el;
68
+ // if (node.component === 'hidden') {
69
+ // return false;
70
+ // }
71
+ // }
72
+ // }
73
+ // return true;
74
+ // }, "Component 'hidden' with datatype not set"),
75
+ // ]
76
+ const HiddenSchema = v.strictObject({
77
+ 'user-input-mode': v.picklist(['noinput', 'optional', 'required', 'display']),
78
+ display: HiddenDisplaySchema,
79
+ datatype: v.nullish(v.string()),
80
+ sources: v.nullish(v.string()),
81
+ 'value-constructor': v.nullish(v.string()),
82
+ value: v.nullish(v.string()),
83
+ attribute: v.nullish(v.string()),
84
+ 'default-value': v.nullish(v.string()),
85
+ 'dataset-source-fn': v.nullish(v.string()),
86
+ 'is-display-field': v.nullish(v.boolean()),
87
+ });
88
+
89
+ export type HiddenType = v.InferOutput<typeof HiddenSchema>;
90
+ export type HiddenSchemaType = v.GenericSchema<HiddenType>;
97
91
 
98
- export default Hidden as HiddenType;
92
+ export default HiddenSchema as HiddenSchemaType;
@@ -1,22 +1,21 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const HierarchicalSelectorDisplay = createFieldDisplay(
6
- object({
4
+ const HierarchicalSelectorDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('hierarchical-selector'),
8
- 'component-params': nullish(
9
- object({
10
- dataset: nullish(v.string()),
11
- 'dataset-filter-field': nullish(v.string()),
12
- format: nullish(v.literal('plaintext')),
13
- initial_loading_levels: nullish(v.number()),
14
- multiplicity: nullish(v.number()),
15
- multiplicityLabels: nullish(
16
- object({
17
- addItem: nullish(v.string()),
18
- empty: nullish(v.string()),
19
- emptyValueDisplay: nullish(v.string()),
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ dataset: v.nullish(v.string()),
10
+ 'dataset-filter-field': v.nullish(v.string()),
11
+ format: v.nullish(v.literal('plaintext')),
12
+ initial_loading_levels: v.nullish(v.number()),
13
+ multiplicity: v.nullish(v.number()),
14
+ multiplicityLabels: v.nullish(
15
+ v.strictObject({
16
+ addItem: v.nullish(v.string()),
17
+ empty: v.nullish(v.string()),
18
+ emptyValueDisplay: v.nullish(v.string()),
20
19
  })
21
20
  ),
22
21
  })
@@ -24,23 +23,26 @@ const HierarchicalSelectorDisplay = createFieldDisplay(
24
23
  })
25
24
  );
26
25
 
27
- const HierarchicalSelector = object({
26
+ const HierarchicalSelectorSchema = v.strictObject({
28
27
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
29
- display: HierarchicalSelectorDisplay,
30
- attribute: nullish(v.string()),
31
- sources: nullish(v.literal('field:operator_syllogos_choice')),
32
- 'value-constructor': nullish(
28
+ display: HierarchicalSelectorDisplaySchema,
29
+ attribute: v.nullish(v.string()),
30
+ sources: v.nullish(v.literal('field:operator_syllogos_choice')),
31
+ 'value-constructor': v.nullish(
33
32
  v.literal(
34
33
  'dilosi.applications.pistopoiitiko_polyteknias.claims.common.prefill_syllogos_choice'
35
34
  )
36
35
  ),
37
- datatype: nullish(v.picklist(['entity_recipient', 'string'])),
38
- 'dataset-source-fn': nullish(
36
+ datatype: v.nullish(v.picklist(['entity_recipient', 'string'])),
37
+ 'dataset-source-fn': v.nullish(
39
38
  v.literal('dilosi.applications.foreis.claims.common.get_dimos_dataset')
40
39
  ),
41
40
  });
42
- export type HierarchicalSelectorType = v.BaseSchema<
43
- v.Output<typeof HierarchicalSelector>
41
+
42
+ export type HierarchicalSelectorType = v.InferOutput<
43
+ typeof HierarchicalSelectorSchema
44
44
  >;
45
+ export type HierarchicalSelectorSchemaType =
46
+ v.GenericSchema<HierarchicalSelectorType>;
45
47
 
46
- export default HierarchicalSelector as HierarchicalSelectorType;
48
+ export default HierarchicalSelectorSchema as HierarchicalSelectorSchemaType;
@@ -1,23 +1,24 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const IbanDisplay = createFieldDisplay(
6
- object({
4
+ const IbanDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('iban'),
8
- 'component-params': nullish(
9
- object({
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
10
9
  country: v.literal('gr'),
11
10
  })
12
11
  ),
13
12
  })
14
13
  );
15
14
 
16
- const Iban = object({
15
+ const IbanSchema = v.strictObject({
17
16
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
18
- display: IbanDisplay,
19
- 'default-value': nullish(v.string()),
17
+ display: IbanDisplaySchema,
18
+ 'default-value': v.nullish(v.string()),
20
19
  });
21
- export type IbanType = v.BaseSchema<v.Output<typeof Iban>>;
22
20
 
23
- export default Iban as IbanType;
21
+ export type IbanType = v.InferOutput<typeof IbanSchema>;
22
+ export type IbanSchemaType = v.GenericSchema<IbanType>;
23
+
24
+ export default IbanSchema as IbanSchemaType;
@@ -1,21 +1,20 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const ImageDisplay = createFieldDisplay(
6
- object({
4
+ const ImageDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('image'),
8
- 'component-params': nullish(
9
- object({
10
- attachment_retrieval: nullish(v.literal('content')),
11
- position: nullish(v.picklist(['left', 'right', 'center', 'justify'])),
12
- coordinates: nullish(v.array(v.nullable(v.number()))),
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ attachment_retrieval: v.nullish(v.literal('content')),
10
+ position: v.nullish(v.picklist(['left', 'right', 'center', 'justify'])),
11
+ coordinates: v.nullish(v.array(v.nullable(v.number()))),
13
12
  })
14
13
  ),
15
14
  })
16
15
  );
17
16
 
18
- const ImageAttribute = nullish(
17
+ const ImageAttributeSchema = v.nullish(
19
18
  v.picklist([
20
19
  'amea_card_crop_photo:cropped_amea_card_photo',
21
20
  'gov_wallet_academic_id_full_photo:photo',
@@ -25,24 +24,26 @@ const ImageAttribute = nullish(
25
24
  ])
26
25
  );
27
26
 
28
- const Image = object({
27
+ const ImageSchema = v.strictObject({
29
28
  'user-input-mode': v.picklist(['noinput', 'required']),
30
- display: ImageDisplay,
31
- datatype: nullish(v.picklist(['attachment', 'string'])),
32
- attribute: ImageAttribute,
33
- value: nullish(v.string()),
34
- 'value-constructor': nullish(
29
+ display: ImageDisplaySchema,
30
+ datatype: v.nullish(v.picklist(['attachment', 'string'])),
31
+ attribute: ImageAttributeSchema,
32
+ value: v.nullish(v.string()),
33
+ 'value-constructor': v.nullish(
35
34
  v.literal(
36
35
  'dilosi.applications.pistopoiitiko_spoudon.claims.branching.get_institution_logo_asset_path'
37
36
  )
38
37
  ),
39
- sources: nullish(
38
+ sources: v.nullish(
40
39
  v.picklist([
41
40
  'ref:gov_wallet_id:field:id_photo',
42
41
  'declaration:template_refname field:institution_choice field:locale',
43
42
  ])
44
43
  ),
45
44
  });
46
- export type ImageType = v.BaseSchema<v.Output<typeof Image>>;
47
45
 
48
- export default Image as ImageType;
46
+ export type ImageType = v.InferOutput<typeof ImageSchema>;
47
+ export type ImageSchemaType = v.GenericSchema<ImageType>;
48
+
49
+ export default ImageSchema as ImageSchemaType;
@@ -1,9 +1,7 @@
1
1
  import * as v from 'valibot';
2
- import Field from '@uides/stepwise/schemas/field';
2
+ import FieldSchema, { Field } from '@uides/stepwise/schemas/field';
3
3
 
4
- type FieldType = v.Output<typeof Field>;
5
-
6
- const afmField: FieldType = {
4
+ const afmField: Field = {
7
5
  'user-input-mode': 'noinput',
8
6
  display: {
9
7
  default: {
@@ -16,15 +14,15 @@ const afmField: FieldType = {
16
14
 
17
15
  describe('field schema', () => {
18
16
  it('should validate a simple field', () => {
19
- const result = v.safeParse(Field, afmField);
17
+ const result = v.safeParse(FieldSchema, afmField);
20
18
  expect(result.issues).toBeUndefined();
21
19
  });
22
20
  it('should validate that a field with a value cannot be editable', () => {
23
- const field: FieldType = {
21
+ const field: Field = {
24
22
  'user-input-mode': 'required',
25
23
  value: 'some-value',
26
24
  };
27
- const result = v.safeParse(Field, field);
25
+ const result = v.safeParse(FieldSchema, field);
28
26
  expect(result.issues).toBeDefined();
29
27
  expect(result.issues?.length).toBeGreaterThan(0);
30
28
  expect(result.issues?.[0].message).toBe(
@@ -33,7 +31,7 @@ describe('field schema', () => {
33
31
  });
34
32
  describe('display validation', () => {
35
33
  it('should fail, given default display mode that is incompatible with specific display mode', () => {
36
- const field: FieldType = {
34
+ const field: Field = {
37
35
  'user-input-mode': 'noinput',
38
36
  display: {
39
37
  default: {
@@ -51,11 +49,11 @@ describe('field schema', () => {
51
49
  },
52
50
  },
53
51
  };
54
- const result = v.safeParse(Field, field);
52
+ const result = v.safeParse(FieldSchema, field);
55
53
  expect(result.issues).toBeDefined();
56
54
  });
57
55
  it('should fail, given default display lang that is incompatible with specific display lang', () => {
58
- const field: FieldType = {
56
+ const field: Field = {
59
57
  'user-input-mode': 'noinput',
60
58
  display: {
61
59
  default: {
@@ -71,15 +69,15 @@ describe('field schema', () => {
71
69
  },
72
70
  },
73
71
  };
74
- const result = v.safeParse(Field, field);
72
+ const result = v.safeParse(FieldSchema, field);
75
73
  expect(result.issues).toBeDefined();
76
74
  });
77
75
  it('should fail, given empty display', () => {
78
- const field: FieldType = {
76
+ const field: Field = {
79
77
  'user-input-mode': 'noinput',
80
78
  display: {},
81
79
  };
82
- const result = v.safeParse(Field, field);
80
+ const result = v.safeParse(FieldSchema, field);
83
81
  expect(result?.issues).toBeDefined();
84
82
  expect(result?.issues?.length).toBeGreaterThan(0);
85
83
  expect(result?.issues?.[0].message).toBe(
@@ -87,11 +85,11 @@ describe('field schema', () => {
87
85
  );
88
86
  });
89
87
  it('should fail, given empty display mode', () => {
90
- const field: FieldType = {
88
+ const field: Field = {
91
89
  'user-input-mode': 'noinput',
92
90
  display: { default: {} },
93
91
  };
94
- const result = v.safeParse(Field, field);
92
+ const result = v.safeParse(FieldSchema, field);
95
93
  expect(result?.issues).toBeDefined();
96
94
  expect(result?.issues?.length).toBeGreaterThan(0);
97
95
  expect(result?.issues?.[0].message).toBe(
@@ -99,7 +97,7 @@ describe('field schema', () => {
99
97
  );
100
98
  });
101
99
  it('should pass, given default display mode that is compatible with specific display mode', () => {
102
- const field: FieldType = {
100
+ const field: Field = {
103
101
  'user-input-mode': 'noinput',
104
102
  display: {
105
103
  default: {
@@ -114,11 +112,11 @@ describe('field schema', () => {
114
112
  },
115
113
  },
116
114
  };
117
- const result = v.safeParse(Field, field);
115
+ const result = v.safeParse(FieldSchema, field);
118
116
  expect(result.issues).toBeUndefined();
119
117
  });
120
118
  it('should pass, given default display lang that is compatible with specific display lang', () => {
121
- const field: FieldType = {
119
+ const field: Field = {
122
120
  'user-input-mode': 'noinput',
123
121
  display: {
124
122
  default: {
@@ -131,7 +129,7 @@ describe('field schema', () => {
131
129
  },
132
130
  },
133
131
  };
134
- const result = v.safeParse(Field, field);
132
+ const result = v.safeParse(FieldSchema, field);
135
133
  expect(result.issues).toBeUndefined();
136
134
  });
137
135
  });