@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.
- package/.rush/temp/chunked-rush-logs/stepwise.build.chunks.jsonl +4 -8
- package/.rush/temp/package-deps_build.json +67 -67
- package/.rush/temp/shrinkwrap-deps.json +2 -2
- package/package.json +6 -6
- package/rush-logs/stepwise.build.log +4 -8
- package/src/schemas/__tests__/step.spec.ts +2 -4
- package/src/schemas/action.ts +132 -131
- package/src/schemas/application.ts +7 -8
- package/src/schemas/attributes.ts +1 -1
- package/src/schemas/common.ts +15 -82
- package/src/schemas/document.ts +53 -49
- package/src/schemas/edupass-healthstate.ts +47 -44
- package/src/schemas/field/afm/index.ts +11 -12
- package/src/schemas/field/amka/index.ts +10 -9
- package/src/schemas/field/attachment/index.ts +21 -20
- package/src/schemas/field/captcha/index.ts +8 -7
- package/src/schemas/field/choice/index.ts +20 -19
- package/src/schemas/field/common.spec.ts +7 -13
- package/src/schemas/field/common.ts +103 -85
- package/src/schemas/field/date/index.ts +24 -23
- package/src/schemas/field/doc_subtitle/index.ts +10 -9
- package/src/schemas/field/doc_title/index.ts +18 -17
- package/src/schemas/field/dynamically-filled-text/index.ts +26 -24
- package/src/schemas/field/email/index.ts +12 -11
- package/src/schemas/field/fillable-string/index.ts +18 -17
- package/src/schemas/field/five-block-date/index.ts +8 -7
- package/src/schemas/field/green-pass-qrcode/index.ts +14 -15
- package/src/schemas/field/hidden/index.ts +58 -64
- package/src/schemas/field/hierarchical-selector/index.ts +27 -25
- package/src/schemas/field/iban/index.ts +11 -10
- package/src/schemas/field/image/index.ts +19 -18
- package/src/schemas/field/index.spec.ts +17 -19
- package/src/schemas/field/index.ts +176 -85
- package/src/schemas/field/int/index.ts +11 -10
- package/src/schemas/field/lab-results/index.ts +9 -8
- package/src/schemas/field/landline_phone/index.ts +8 -7
- package/src/schemas/field/mobile_phone/index.ts +12 -11
- package/src/schemas/field/multiple-choice/index.ts +15 -14
- package/src/schemas/field/pdf-image/index.ts +14 -13
- package/src/schemas/field/postal_code/index.ts +9 -8
- package/src/schemas/field/qrcode/index.ts +18 -17
- package/src/schemas/field/quote/index.ts +18 -17
- package/src/schemas/field/radio-choice/index.ts +21 -15
- package/src/schemas/field/rate/index.ts +10 -9
- package/src/schemas/field/recipient/index.ts +11 -10
- package/src/schemas/field/redirect/index.ts +12 -11
- package/src/schemas/field/refcode/index.ts +25 -24
- package/src/schemas/field/string/index.ts +42 -41
- package/src/schemas/field/text/index.ts +23 -22
- package/src/schemas/field/three-block-date/index.ts +15 -14
- package/src/schemas/fieldset/component-params.ts +40 -37
- package/src/schemas/fieldset/display-components.ts +42 -49
- package/src/schemas/fieldset/enums.ts +12 -6
- package/src/schemas/fieldset/index.ts +9 -10
- package/src/schemas/layout.ts +43 -32
- package/src/schemas/outputs.ts +7 -6
- package/src/schemas/resource/enums.ts +6 -6
- package/src/schemas/resource/field.ts +10 -8
- package/src/schemas/resource/object-action.ts +21 -16
- package/src/schemas/resource/resource-action.ts +19 -17
- package/src/schemas/resource/resource.ts +19 -20
- package/src/schemas/step.ts +116 -115
- package/src/schemas/template/enums.ts +2 -2
- package/src/schemas/template/template-base.ts +15 -13
- package/src/schemas/template/template-source.ts +12 -13
- package/src/schemas/template/template.ts +12 -13
- package/src/schemas/validation-context/enums.ts +5 -5
- package/src/schemas/validation-context/validation-context.ts +45 -44
- package/src/utils/index.spec.ts +2 -0
- package/src/utils/index.ts +5 -3
- package/.rush/temp/chunked-rush-logs/stepwise.lint.chunks.jsonl +0 -2
- package/rush-logs/stepwise.lint.error.log +0 -1
- package/rush-logs/stepwise.lint.log +0 -2
|
@@ -1,70 +1,63 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
nullish,
|
|
6
|
-
object,
|
|
3
|
+
ComponentLayoutSchema,
|
|
4
|
+
DisplayLangSchema,
|
|
7
5
|
} from '@uides/stepwise/schemas/common';
|
|
8
6
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
OtherComponentParamsSchema,
|
|
8
|
+
TableComponentParamsSchema,
|
|
11
9
|
} from '@uides/stepwise/schemas/fieldset/component-params';
|
|
12
10
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
PdfOtherComponentSchema,
|
|
12
|
+
PdfTableBasedComponentSchema,
|
|
13
|
+
WebComponentSchema,
|
|
16
14
|
} from '@uides/stepwise/schemas/fieldset/enums';
|
|
17
15
|
|
|
18
|
-
export const
|
|
16
|
+
export const FieldsetWebDisplaySchema = v.strictObject({
|
|
19
17
|
/** The explanatory title of the fieldset */
|
|
20
|
-
title: nullish(v.string()),
|
|
21
|
-
component:
|
|
22
|
-
'component-params': nullish(
|
|
23
|
-
layout: nullish(
|
|
18
|
+
title: v.nullish(v.string()),
|
|
19
|
+
component: WebComponentSchema,
|
|
20
|
+
'component-params': v.nullish(TableComponentParamsSchema),
|
|
21
|
+
layout: v.nullish(ComponentLayoutSchema),
|
|
24
22
|
});
|
|
25
|
-
export type FieldsetWebDisplay = v.
|
|
23
|
+
export type FieldsetWebDisplay = v.InferOutput<typeof FieldsetWebDisplaySchema>;
|
|
26
24
|
|
|
27
|
-
export const
|
|
25
|
+
export const FieldsetPdfDisplayTableSchema = v.strictObject({
|
|
28
26
|
/** The explanatory title of the fieldset */
|
|
29
|
-
title: nullish(v.string()),
|
|
30
|
-
component:
|
|
31
|
-
'component-params': nullish(
|
|
27
|
+
title: v.nullish(v.string()),
|
|
28
|
+
component: PdfTableBasedComponentSchema,
|
|
29
|
+
'component-params': v.nullish(TableComponentParamsSchema),
|
|
32
30
|
});
|
|
33
|
-
export type FieldsetPdfDisplayTable = v.
|
|
31
|
+
export type FieldsetPdfDisplayTable = v.InferOutput<
|
|
32
|
+
typeof FieldsetPdfDisplayTableSchema
|
|
33
|
+
>;
|
|
34
34
|
|
|
35
|
-
export const
|
|
35
|
+
export const FieldsetPdfDisplayOtherSchema = v.strictObject({
|
|
36
36
|
/** The explanatory title of the fieldset */
|
|
37
|
-
title: nullish(v.string()),
|
|
38
|
-
component:
|
|
39
|
-
'component-params': nullish(
|
|
37
|
+
title: v.nullish(v.string()),
|
|
38
|
+
component: PdfOtherComponentSchema,
|
|
39
|
+
'component-params': v.nullish(OtherComponentParamsSchema),
|
|
40
40
|
});
|
|
41
|
-
export type FieldsetPdfDisplayOther = v.
|
|
41
|
+
export type FieldsetPdfDisplayOther = v.InferOutput<
|
|
42
|
+
typeof FieldsetPdfDisplayOtherSchema
|
|
43
|
+
>;
|
|
42
44
|
|
|
43
|
-
export const
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
export const FieldsetPdfDisplaySchema = v.variant('component', [
|
|
46
|
+
FieldsetPdfDisplayTableSchema,
|
|
47
|
+
FieldsetPdfDisplayOtherSchema,
|
|
46
48
|
]);
|
|
47
|
-
export type FieldsetPdfDisplay = v.
|
|
49
|
+
export type FieldsetPdfDisplay = v.InferOutput<typeof FieldsetPdfDisplaySchema>;
|
|
48
50
|
|
|
49
|
-
export const
|
|
50
|
-
v.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
v.
|
|
55
|
-
),
|
|
56
|
-
v.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
v.unknown()
|
|
61
|
-
),
|
|
62
|
-
v.object(
|
|
63
|
-
{
|
|
64
|
-
pdf: v.record(DisplayLang, FieldsetPdfDisplay),
|
|
65
|
-
},
|
|
66
|
-
v.unknown()
|
|
67
|
-
),
|
|
51
|
+
export const FieldsetDisplaySchema = v.union([
|
|
52
|
+
v.looseObject({
|
|
53
|
+
default: v.record(DisplayLangSchema, FieldsetWebDisplaySchema),
|
|
54
|
+
}),
|
|
55
|
+
v.looseObject({
|
|
56
|
+
web: v.record(DisplayLangSchema, FieldsetWebDisplaySchema),
|
|
57
|
+
}),
|
|
58
|
+
v.looseObject({
|
|
59
|
+
pdf: v.record(DisplayLangSchema, FieldsetPdfDisplaySchema),
|
|
60
|
+
}),
|
|
68
61
|
]);
|
|
69
62
|
|
|
70
|
-
export type FieldsetDisplay = v.
|
|
63
|
+
export type FieldsetDisplay = v.InferOutput<typeof FieldsetDisplaySchema>;
|
|
@@ -7,8 +7,8 @@ import * as v from 'valibot';
|
|
|
7
7
|
* @value 'hidden' Hidden.
|
|
8
8
|
* @value 'form' Form.
|
|
9
9
|
*/
|
|
10
|
-
export const
|
|
11
|
-
export type WebComponent = v.
|
|
10
|
+
export const WebComponentSchema = v.picklist(['values-list', 'hidden', 'form']);
|
|
11
|
+
export type WebComponent = v.InferOutput<typeof WebComponentSchema>;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Pdf table-based component type.
|
|
@@ -21,7 +21,7 @@ export type WebComponent = v.Output<typeof WebComponent>;
|
|
|
21
21
|
* @value 'hidden' Hidden.
|
|
22
22
|
* @value 'custom' Custom.
|
|
23
23
|
*/
|
|
24
|
-
export const
|
|
24
|
+
export const PdfTableBasedComponentSchema = v.picklist([
|
|
25
25
|
'values-list',
|
|
26
26
|
'table',
|
|
27
27
|
'one-liner-table',
|
|
@@ -30,7 +30,9 @@ export const PdfTableBasedComponent = v.picklist([
|
|
|
30
30
|
'hidden',
|
|
31
31
|
'custom',
|
|
32
32
|
]);
|
|
33
|
-
export type PdfTableBasedComponent = v.
|
|
33
|
+
export type PdfTableBasedComponent = v.InferOutput<
|
|
34
|
+
typeof PdfTableBasedComponentSchema
|
|
35
|
+
>;
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Pdf component type.
|
|
@@ -39,5 +41,9 @@ export type PdfTableBasedComponent = v.Output<typeof PdfTableBasedComponent>;
|
|
|
39
41
|
* @value 'common' Common.
|
|
40
42
|
* @value 'plain-text' Plain text. Ideal for displaying fields with values that are large texts. It helps in displaying the text across multiple pages.
|
|
41
43
|
*/
|
|
42
|
-
export const
|
|
43
|
-
|
|
44
|
+
export const PdfOtherComponentSchema = v.picklist([
|
|
45
|
+
'header',
|
|
46
|
+
'common',
|
|
47
|
+
'plain-text',
|
|
48
|
+
]);
|
|
49
|
+
export type PdfOtherComponent = v.InferOutput<typeof PdfOtherComponentSchema>;
|
|
@@ -3,8 +3,7 @@ export * from '@uides/stepwise/schemas/fieldset/component-params';
|
|
|
3
3
|
export * from '@uides/stepwise/schemas/fieldset/display-components';
|
|
4
4
|
|
|
5
5
|
import * as v from 'valibot';
|
|
6
|
-
import {
|
|
7
|
-
import { FieldsetDisplay } from '@uides/stepwise/schemas/fieldset/display-components';
|
|
6
|
+
import { FieldsetDisplaySchema } from '@uides/stepwise/schemas/fieldset/display-components';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* A set of fields
|
|
@@ -12,15 +11,15 @@ import { FieldsetDisplay } from '@uides/stepwise/schemas/fieldset/display-compon
|
|
|
12
11
|
* In order to show fields in the UI, they must be grouped in a fieldset. This may be done,
|
|
13
12
|
* by adding the field names in the `field-order` property of the fieldset.
|
|
14
13
|
*/
|
|
15
|
-
export const
|
|
16
|
-
'field-order': nullish(v.string()), // TODO: Not optional in backend schema but optional in some templates
|
|
17
|
-
display: nullish(
|
|
14
|
+
export const FieldsetSchema = v.strictObject({
|
|
15
|
+
'field-order': v.nullish(v.string()), // TODO: Not optional in backend schema but optional in some templates
|
|
16
|
+
display: v.nullish(FieldsetDisplaySchema),
|
|
18
17
|
});
|
|
19
|
-
export type Fieldset = v.
|
|
18
|
+
export type Fieldset = v.InferOutput<typeof FieldsetSchema>;
|
|
20
19
|
export default Fieldset;
|
|
21
20
|
|
|
22
21
|
export type Fieldsets = Record<string, Fieldset>;
|
|
23
|
-
export const FieldsetsSchema = v.record(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
>;
|
|
22
|
+
export const FieldsetsSchema = v.record(
|
|
23
|
+
v.string(),
|
|
24
|
+
FieldsetSchema
|
|
25
|
+
) as v.GenericSchema<Fieldsets, Fieldsets>;
|
package/src/schemas/layout.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
nullish,
|
|
6
|
-
object,
|
|
3
|
+
DisplayLangSchema,
|
|
4
|
+
DisplayModeSchema,
|
|
7
5
|
} from '@uides/stepwise/schemas/common';
|
|
8
6
|
|
|
9
7
|
/**
|
|
@@ -18,7 +16,7 @@ import {
|
|
|
18
16
|
* @value 'nav-link' Navigation link.
|
|
19
17
|
* @value 'nav-info' Navigation info.
|
|
20
18
|
*/
|
|
21
|
-
export const
|
|
19
|
+
export const NavActionComponentSchema = v.picklist([
|
|
22
20
|
'back-button',
|
|
23
21
|
'entity-name',
|
|
24
22
|
'button-link',
|
|
@@ -28,45 +26,58 @@ export const NavActionComponent = v.picklist([
|
|
|
28
26
|
'nav-link',
|
|
29
27
|
'nav-info',
|
|
30
28
|
]);
|
|
31
|
-
export type NavActionComponent = v.
|
|
29
|
+
export type NavActionComponent = v.InferOutput<typeof NavActionComponentSchema>;
|
|
32
30
|
|
|
33
|
-
export const
|
|
34
|
-
label: nullish(v.string()),
|
|
35
|
-
component:
|
|
36
|
-
'component-params': nullish(v.record(v.any())),
|
|
31
|
+
export const NavActionDisplaySchema = v.strictObject({
|
|
32
|
+
label: v.nullish(v.string()),
|
|
33
|
+
component: NavActionComponentSchema,
|
|
34
|
+
'component-params': v.nullish(v.record(v.string(), v.any())),
|
|
37
35
|
});
|
|
38
|
-
export type NavActionDisplay = v.
|
|
36
|
+
export type NavActionDisplay = v.InferOutput<typeof NavActionDisplaySchema>;
|
|
39
37
|
|
|
40
|
-
export const
|
|
41
|
-
display: nullish(
|
|
42
|
-
v.record(
|
|
38
|
+
export const NavActionSchema = v.strictObject({
|
|
39
|
+
display: v.nullish(
|
|
40
|
+
v.record(
|
|
41
|
+
DisplayModeSchema,
|
|
42
|
+
v.record(DisplayLangSchema, NavActionDisplaySchema)
|
|
43
|
+
)
|
|
43
44
|
),
|
|
44
45
|
});
|
|
45
|
-
export type NavAction = v.
|
|
46
|
+
export type NavAction = v.InferOutput<typeof NavActionSchema>;
|
|
46
47
|
|
|
47
|
-
export const
|
|
48
|
-
expanded: nullish(v.boolean()),
|
|
49
|
-
'match-paths': nullish(v.array(v.string())),
|
|
48
|
+
export const NavActionGroupParamsSchema = v.strictObject({
|
|
49
|
+
expanded: v.nullish(v.boolean()),
|
|
50
|
+
'match-paths': v.nullish(v.array(v.string())),
|
|
50
51
|
});
|
|
51
|
-
export type NavActionGroupParams = v.
|
|
52
|
+
export type NavActionGroupParams = v.InferOutput<
|
|
53
|
+
typeof NavActionGroupParamsSchema
|
|
54
|
+
>;
|
|
52
55
|
|
|
53
|
-
export const
|
|
54
|
-
label: nullish(v.string()),
|
|
55
|
-
component:
|
|
56
|
-
'component-params': nullish(
|
|
56
|
+
export const NavActionGroupDisplaySchema = v.strictObject({
|
|
57
|
+
label: v.nullish(v.string()),
|
|
58
|
+
component: NavActionComponentSchema,
|
|
59
|
+
'component-params': v.nullish(NavActionGroupParamsSchema),
|
|
57
60
|
});
|
|
58
|
-
export type NavActionGroupDisplay = v.
|
|
61
|
+
export type NavActionGroupDisplay = v.InferOutput<
|
|
62
|
+
typeof NavActionGroupDisplaySchema
|
|
63
|
+
>;
|
|
59
64
|
|
|
60
|
-
export const
|
|
61
|
-
items: v.record(
|
|
65
|
+
export const NavActionGroupSchema = v.strictObject({
|
|
66
|
+
items: v.record(v.string(), NavActionSchema),
|
|
62
67
|
'item-order': v.string(),
|
|
63
|
-
display: v.record(
|
|
68
|
+
display: v.record(
|
|
69
|
+
DisplayModeSchema,
|
|
70
|
+
v.record(DisplayLangSchema, NavActionGroupDisplaySchema)
|
|
71
|
+
),
|
|
64
72
|
});
|
|
65
|
-
export type NavActionGroup = v.
|
|
73
|
+
export type NavActionGroup = v.InferOutput<typeof NavActionGroupSchema>;
|
|
66
74
|
|
|
67
|
-
export const
|
|
75
|
+
export const LayoutSchema = v.strictObject({
|
|
68
76
|
'nav-action-order': v.string(),
|
|
69
|
-
'nav-actions': v.record(
|
|
70
|
-
|
|
77
|
+
'nav-actions': v.record(
|
|
78
|
+
v.string(),
|
|
79
|
+
v.union([NavActionSchema, NavActionGroupSchema])
|
|
80
|
+
),
|
|
81
|
+
'landing-url': v.nullish(v.string()),
|
|
71
82
|
});
|
|
72
|
-
export type Layout = v.
|
|
83
|
+
export type Layout = v.InferOutput<typeof LayoutSchema>;
|
package/src/schemas/outputs.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import {
|
|
3
|
-
import { DocumentData } from '@uides/stepwise/schemas/document';
|
|
2
|
+
import { DocumentDataSchema } from '@uides/stepwise/schemas/document';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* As defined in outputs/entry_schema.py
|
|
7
6
|
*/
|
|
8
|
-
export const
|
|
7
|
+
export const EntrySchema = v.strictObject({
|
|
9
8
|
id: v.string(),
|
|
10
9
|
gate_id: v.string(),
|
|
11
|
-
document:
|
|
12
|
-
'document-refs':
|
|
10
|
+
document: DocumentDataSchema,
|
|
11
|
+
'document-refs': v.nullish(
|
|
12
|
+
v.record(v.string(), v.record(v.string(), v.any()))
|
|
13
|
+
),
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* As defined in outputs/permission_schema.py
|
|
17
18
|
*/
|
|
18
|
-
export const
|
|
19
|
+
export const PermissionSchema = v.strictObject({
|
|
19
20
|
gate_display_name: v.string(),
|
|
20
21
|
gate_id: v.string(),
|
|
21
22
|
afm: v.string(),
|
|
@@ -11,7 +11,7 @@ import * as v from 'valibot';
|
|
|
11
11
|
* @value `diff` Diff.
|
|
12
12
|
* @value `link` Link.
|
|
13
13
|
*/
|
|
14
|
-
export const
|
|
14
|
+
export const ResourceFieldComponentSchema = v.picklist([
|
|
15
15
|
'string',
|
|
16
16
|
'boolean',
|
|
17
17
|
'int',
|
|
@@ -28,7 +28,7 @@ export const ResourceFieldComponent = v.picklist([
|
|
|
28
28
|
* @value `menu-action` Menu action.
|
|
29
29
|
* @value `menu-action-show-details` Menu action showing details.
|
|
30
30
|
*/
|
|
31
|
-
export const
|
|
31
|
+
export const ObjectActionComponentSchema = v.picklist([
|
|
32
32
|
'button',
|
|
33
33
|
'menu-action',
|
|
34
34
|
'menu-action-show-details',
|
|
@@ -45,7 +45,7 @@ export const ObjectActionComponent = v.picklist([
|
|
|
45
45
|
* @value `show-details` Show details.
|
|
46
46
|
* @value `show-message` Show message.
|
|
47
47
|
*/
|
|
48
|
-
export const
|
|
48
|
+
export const ObjectActionHandlerSchema = v.picklist([
|
|
49
49
|
'download',
|
|
50
50
|
'redirect',
|
|
51
51
|
'new-tab',
|
|
@@ -62,7 +62,7 @@ export const ObjectActionHandler = v.picklist([
|
|
|
62
62
|
* @value `auto` Auto.
|
|
63
63
|
* @value `inline-form` Inline form.
|
|
64
64
|
*/
|
|
65
|
-
export const
|
|
65
|
+
export const ResourceActionComponentSchema = v.picklist([
|
|
66
66
|
'button',
|
|
67
67
|
'auto',
|
|
68
68
|
'inline-form',
|
|
@@ -77,7 +77,7 @@ export const ResourceActionComponent = v.picklist([
|
|
|
77
77
|
* @value `show-message` Show message.
|
|
78
78
|
* @value `show-modal` Show modal.
|
|
79
79
|
*/
|
|
80
|
-
export const
|
|
80
|
+
export const ResourceActionHandlerSchema = v.picklist([
|
|
81
81
|
'download',
|
|
82
82
|
'load-data',
|
|
83
83
|
'refresh-data',
|
|
@@ -91,4 +91,4 @@ export const ResourceActionHandler = v.picklist([
|
|
|
91
91
|
* @value `node` Node.
|
|
92
92
|
* @value `tree` Tree.
|
|
93
93
|
*/
|
|
94
|
-
export const
|
|
94
|
+
export const AccessPolicySchema = v.picklist(['node', 'tree']);
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import {
|
|
3
|
-
import { ResourceFieldComponent } from '@uides/stepwise/schemas/resource/enums';
|
|
2
|
+
import { ResourceFieldComponentSchema } from '@uides/stepwise/schemas/resource/enums';
|
|
4
3
|
|
|
5
|
-
export const
|
|
4
|
+
export const ResourceFieldDisplaySchema = v.strictObject({
|
|
6
5
|
title: v.string(),
|
|
7
|
-
component:
|
|
8
|
-
choices: nullish(v.record(v.any())),
|
|
9
|
-
'choices-order': nullish(v.string()),
|
|
6
|
+
component: ResourceFieldComponentSchema,
|
|
7
|
+
choices: v.nullish(v.record(v.string(), v.any())),
|
|
8
|
+
'choices-order': v.nullish(v.string()),
|
|
10
9
|
});
|
|
11
10
|
|
|
12
|
-
export const
|
|
13
|
-
display: v.record(
|
|
11
|
+
export const ResourceFieldSchema = v.strictObject({
|
|
12
|
+
display: v.record(
|
|
13
|
+
v.string(),
|
|
14
|
+
v.record(v.string(), ResourceFieldDisplaySchema)
|
|
15
|
+
),
|
|
14
16
|
});
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { object, nullish } from '@uides/stepwise/schemas/common';
|
|
3
2
|
import { FieldsSchema } from '@uides/stepwise/schemas/field';
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
ObjectActionComponentSchema,
|
|
5
|
+
ObjectActionHandlerSchema,
|
|
7
6
|
} from '@uides/stepwise/schemas/resource/enums';
|
|
8
7
|
|
|
9
|
-
export const
|
|
8
|
+
export const ObjectActionDisplaySchema = v.strictObject({
|
|
10
9
|
title: v.string(),
|
|
11
|
-
component:
|
|
12
|
-
'component-params': v.record(v.string()),
|
|
13
|
-
handler: nullish(
|
|
10
|
+
component: ObjectActionComponentSchema,
|
|
11
|
+
'component-params': v.record(v.string(), v.string()),
|
|
12
|
+
handler: v.nullish(ObjectActionHandlerSchema),
|
|
14
13
|
});
|
|
15
14
|
|
|
16
|
-
export const
|
|
17
|
-
display: v.record(
|
|
18
|
-
|
|
15
|
+
export const ObjectActionSchema = v.strictObject({
|
|
16
|
+
display: v.record(
|
|
17
|
+
v.string(),
|
|
18
|
+
v.record(v.string(), ObjectActionDisplaySchema)
|
|
19
|
+
),
|
|
20
|
+
arguments: v.nullish(FieldsSchema),
|
|
19
21
|
'argument-order': v.string(),
|
|
20
|
-
confirm: nullish(v.boolean()),
|
|
22
|
+
confirm: v.nullish(v.boolean()),
|
|
21
23
|
});
|
|
22
24
|
|
|
23
|
-
export const
|
|
24
|
-
title: nullish(v.string()),
|
|
25
|
+
export const ObjectActionConfigDisplaySchema = v.strictObject({
|
|
26
|
+
title: v.nullish(v.string()),
|
|
25
27
|
component: v.literal('menu'),
|
|
26
|
-
icon: nullish(v.string()),
|
|
28
|
+
icon: v.nullish(v.string()),
|
|
27
29
|
});
|
|
28
30
|
|
|
29
|
-
export const
|
|
30
|
-
display: v.record(
|
|
31
|
+
export const ObjectActionConfigSchema = v.strictObject({
|
|
32
|
+
display: v.record(
|
|
33
|
+
v.string(),
|
|
34
|
+
v.record(v.string(), ObjectActionConfigDisplaySchema)
|
|
35
|
+
),
|
|
31
36
|
});
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { object, nullish } from '@uides/stepwise/schemas/common';
|
|
3
2
|
import { FieldsSchema } from '@uides/stepwise/schemas/field';
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
ResourceActionComponentSchema,
|
|
5
|
+
ResourceActionHandlerSchema,
|
|
7
6
|
} from '@uides/stepwise/schemas/resource/enums';
|
|
8
7
|
|
|
9
|
-
export const
|
|
10
|
-
type: nullish(v.picklist(['offset', 'index-value'])),
|
|
8
|
+
export const ResourceActionPaginationSchema = v.strictObject({
|
|
9
|
+
type: v.nullish(v.picklist(['offset', 'index-value'])),
|
|
11
10
|
limit: v.array(v.number()),
|
|
12
|
-
'limit-default': nullish(v.number()),
|
|
13
|
-
count: nullish(v.picklist(['on', 'off', 'estimate'])),
|
|
11
|
+
'limit-default': v.nullish(v.number()),
|
|
12
|
+
count: v.nullish(v.picklist(['on', 'off', 'estimate'])),
|
|
14
13
|
});
|
|
15
14
|
|
|
16
|
-
export const
|
|
17
|
-
title: nullish(v.string()),
|
|
18
|
-
component:
|
|
19
|
-
'component-params': nullish(v.record(v.string())),
|
|
20
|
-
handler:
|
|
21
|
-
pagination: nullish(
|
|
15
|
+
export const ResourceActionDisplaySchema = v.strictObject({
|
|
16
|
+
title: v.nullish(v.string()),
|
|
17
|
+
component: ResourceActionComponentSchema,
|
|
18
|
+
'component-params': v.nullish(v.record(v.string(), v.string())),
|
|
19
|
+
handler: ResourceActionHandlerSchema,
|
|
20
|
+
pagination: v.nullish(ResourceActionPaginationSchema),
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
export const
|
|
25
|
-
display: v.record(
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export const ResourceActionSchema = v.strictObject({
|
|
24
|
+
display: v.record(
|
|
25
|
+
v.string(),
|
|
26
|
+
v.record(v.string(), ResourceActionDisplaySchema)
|
|
27
|
+
),
|
|
28
|
+
arguments: v.nullish(FieldsSchema),
|
|
29
|
+
'argument-order': v.nullish(v.string()),
|
|
28
30
|
});
|
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ResourceField } from '@uides/stepwise/schemas/resource/field';
|
|
2
|
+
import { AccessPolicySchema } from '@uides/stepwise/schemas/resource/enums';
|
|
3
|
+
import { ResourceFieldSchema } from '@uides/stepwise/schemas/resource/field';
|
|
5
4
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
ObjectActionSchema,
|
|
6
|
+
ObjectActionConfigSchema,
|
|
8
7
|
} from '@uides/stepwise/schemas/resource/object-action';
|
|
9
|
-
import {
|
|
8
|
+
import { ResourceActionSchema } from '@uides/stepwise/schemas/resource/resource-action';
|
|
10
9
|
|
|
11
|
-
export const
|
|
10
|
+
export const ResourceDisplaySchema = v.strictObject({
|
|
12
11
|
title: v.string(),
|
|
13
12
|
});
|
|
14
13
|
|
|
15
|
-
export const
|
|
16
|
-
fields: v.record(
|
|
14
|
+
export const ResourceInfoSchema = v.strictObject({
|
|
15
|
+
fields: v.record(v.string(), ResourceFieldSchema),
|
|
17
16
|
'field-order': v.string(),
|
|
18
|
-
'object-actions': v.record(
|
|
19
|
-
'object-actions-config':
|
|
20
|
-
'object-action-component': nullish(v.string()),
|
|
17
|
+
'object-actions': v.record(v.string(), ObjectActionSchema),
|
|
18
|
+
'object-actions-config': ObjectActionConfigSchema,
|
|
19
|
+
'object-action-component': v.nullish(v.string()),
|
|
21
20
|
'object-action-order': v.string(),
|
|
22
|
-
'resource-actions': v.record(
|
|
21
|
+
'resource-actions': v.record(v.string(), ResourceActionSchema),
|
|
23
22
|
'resource-action-order': v.string(),
|
|
24
|
-
'object-id': nullish(v.string()),
|
|
25
|
-
display: v.record(v.record(
|
|
23
|
+
'object-id': v.nullish(v.string()),
|
|
24
|
+
display: v.record(v.string(), v.record(v.string(), ResourceDisplaySchema)),
|
|
26
25
|
});
|
|
27
26
|
|
|
28
|
-
export const
|
|
27
|
+
export const ResourceSchema = v.strictObject({
|
|
29
28
|
/** Unique identifier of the resource */
|
|
30
29
|
refname: v.string(),
|
|
31
30
|
/** String, display name of resource */
|
|
32
31
|
display_name: v.string(),
|
|
33
32
|
entity_codename: v.string(),
|
|
34
|
-
access_policy:
|
|
33
|
+
access_policy: AccessPolicySchema,
|
|
35
34
|
permission_role: v.string(),
|
|
36
35
|
/**
|
|
37
36
|
* Namespace spec of resource
|
|
38
37
|
*
|
|
39
38
|
* @see {@link Template.steps_spec} for a similar concept
|
|
40
39
|
*/
|
|
41
|
-
info:
|
|
40
|
+
info: ResourceInfoSchema,
|
|
42
41
|
/**
|
|
43
42
|
* Resource actions
|
|
44
43
|
*
|
|
45
44
|
* Optional, only if resource has actions. The key is the action name,
|
|
46
45
|
* the value is the path of the corresponding handler.
|
|
47
46
|
*/
|
|
48
|
-
action_handlers: nullish(v.record(v.string())),
|
|
47
|
+
action_handlers: v.nullish(v.record(v.string(), v.string())),
|
|
49
48
|
/**
|
|
50
49
|
*
|
|
51
50
|
*/
|
|
52
|
-
allowed_actions_on_object: nullish(v.string()),
|
|
51
|
+
allowed_actions_on_object: v.nullish(v.string()),
|
|
53
52
|
});
|