@panneau/protocol 5.0.0-alpha.3 → 5.0.0-alpha.31
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/addresses.d.ts +23 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +52 -0
- package/dist/addresses.js.map +1 -0
- package/dist/compound.d.ts +20 -0
- package/dist/compound.d.ts.map +1 -0
- package/dist/compound.js +27 -0
- package/dist/compound.js.map +1 -0
- package/dist/conditions.d.ts +1 -1
- package/dist/conformance/index.d.ts +6 -0
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +801 -11
- package/dist/conformance/index.js.map +1 -1
- package/dist/constants.d.ts +108 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +181 -3
- package/dist/constants.js.map +1 -1
- package/dist/context.d.ts +15 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +34 -0
- package/dist/context.js.map +1 -0
- package/dist/currencies.d.ts +22 -0
- package/dist/currencies.d.ts.map +1 -0
- package/dist/currencies.js +231 -0
- package/dist/currencies.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -8
- package/dist/libraries.d.ts +33 -0
- package/dist/libraries.d.ts.map +1 -0
- package/dist/libraries.js +59 -0
- package/dist/libraries.js.map +1 -0
- package/dist/links.d.ts +38 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +65 -0
- package/dist/links.js.map +1 -0
- package/dist/lint.d.ts +4 -3
- package/dist/lint.d.ts.map +1 -1
- package/dist/lint.js +168 -7
- package/dist/lint.js.map +1 -1
- package/dist/mock/auth.d.ts +71 -0
- package/dist/mock/auth.d.ts.map +1 -0
- package/dist/mock/auth.js +346 -0
- package/dist/mock/auth.js.map +1 -0
- package/dist/mock/example.d.ts +3 -2
- package/dist/mock/example.d.ts.map +1 -1
- package/dist/mock/example.js +241 -144
- package/dist/mock/example.js.map +1 -1
- package/dist/mock/index.d.ts +79 -7
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +603 -38
- package/dist/mock/index.js.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +392 -144
- package/dist/openapi.js.map +1 -1
- package/dist/problem.d.ts +1 -1
- package/dist/query.d.ts +18 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +34 -8
- package/dist/query.js.map +1 -1
- package/dist/resourceTypes.d.ts +39 -0
- package/dist/resourceTypes.d.ts.map +1 -0
- package/dist/resourceTypes.js +34 -0
- package/dist/resourceTypes.js.map +1 -0
- package/dist/rules.d.ts +18 -5
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +233 -15
- package/dist/rules.js.map +1 -1
- package/dist/runtime/index.d.ts +20 -10
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +13 -3
- package/dist/schemas/action.d.ts +118 -10
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/action.js +20 -3
- package/dist/schemas/action.js.map +1 -1
- package/dist/schemas/api.d.ts +334 -42
- package/dist/schemas/api.d.ts.map +1 -1
- package/dist/schemas/api.js +194 -34
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/boot.d.ts +25 -1
- package/dist/schemas/boot.d.ts.map +1 -1
- package/dist/schemas/boot.js +2 -1
- package/dist/schemas/boot.js.map +1 -1
- package/dist/schemas/common.d.ts +1 -0
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +2 -1
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/definition.d.ts +341 -28
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/definition.js +65 -19
- package/dist/schemas/definition.js.map +1 -1
- package/dist/schemas/field.d.ts +357 -2
- package/dist/schemas/field.d.ts.map +1 -1
- package/dist/schemas/field.js +160 -20
- package/dist/schemas/field.js.map +1 -1
- package/dist/schemas/index.d.ts +1429 -80
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +60 -10
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/jsonRules.d.ts +83 -0
- package/dist/schemas/jsonRules.d.ts.map +1 -0
- package/dist/schemas/jsonRules.js +46 -0
- package/dist/schemas/jsonRules.js.map +1 -0
- package/dist/schemas/layout.d.ts +2 -1
- package/dist/schemas/layout.d.ts.map +1 -1
- package/dist/schemas/layout.js +2 -1
- package/dist/schemas/layout.js.map +1 -1
- package/dist/schemas/list.d.ts +23 -2
- package/dist/schemas/list.d.ts.map +1 -1
- package/dist/schemas/list.js +15 -6
- package/dist/schemas/list.js.map +1 -1
- package/dist/schemas/resource.d.ts +263 -17
- package/dist/schemas/resource.d.ts.map +1 -1
- package/dist/schemas/resource.js +19 -4
- package/dist/schemas/resource.js.map +1 -1
- package/dist/schemas/theme.d.ts +4 -0
- package/dist/schemas/theme.d.ts.map +1 -1
- package/dist/schemas/theme.js +1 -0
- package/dist/schemas/theme.js.map +1 -1
- package/dist/schemas/widget.d.ts +109 -0
- package/dist/schemas/widget.d.ts.map +1 -0
- package/dist/schemas/widget.js +74 -0
- package/dist/schemas/widget.js.map +1 -0
- package/dist/search.d.ts +51 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +53 -0
- package/dist/search.js.map +1 -0
- package/dist/themes.d.ts +1 -1
- package/dist/transforms.d.ts +17 -0
- package/dist/transforms.d.ts.map +1 -0
- package/dist/transforms.js +34 -0
- package/dist/transforms.js.map +1 -0
- package/dist/validate.d.ts +5 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +36 -2
- package/dist/validate.js.map +1 -1
- package/dist/values.d.ts +5 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +16 -2
- package/dist/values.js.map +1 -1
- package/dist/widgets.d.ts +42 -0
- package/dist/widgets.d.ts.map +1 -0
- package/dist/widgets.js +130 -0
- package/dist/widgets.js.map +1 -0
- package/package.json +6 -3
- package/schema/boot.schema.json +713 -20
- package/schema/definition.schema.json +710 -20
- package/schema/openapi.json +5656 -2229
package/dist/schemas/action.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Field } from './field';
|
|
3
|
-
import { LayoutNode } from './layout';
|
|
2
|
+
import { Field } from './field.js';
|
|
3
|
+
import { LayoutNode } from './layout.js';
|
|
4
4
|
export declare const ActionScope: z.ZodEnum<{
|
|
5
5
|
resource: "resource";
|
|
6
6
|
item: "item";
|
|
@@ -20,12 +20,12 @@ export declare const ActionConfirm: z.ZodUnion<readonly [z.ZodBoolean, z.ZodObje
|
|
|
20
20
|
}, z.core.$loose>]>;
|
|
21
21
|
export declare const Action: z.ZodObject<{
|
|
22
22
|
id: z.ZodString;
|
|
23
|
-
label: z.ZodString
|
|
23
|
+
label: z.ZodOptional<z.ZodString>;
|
|
24
24
|
icon: z.ZodOptional<z.ZodString>;
|
|
25
25
|
kind: z.ZodDefault<z.ZodEnum<{
|
|
26
26
|
link: "link";
|
|
27
|
-
server: "server";
|
|
28
27
|
client: "client";
|
|
28
|
+
server: "server";
|
|
29
29
|
}>>;
|
|
30
30
|
scope: z.ZodArray<z.ZodEnum<{
|
|
31
31
|
resource: "resource";
|
|
@@ -54,11 +54,17 @@ export declare const Action: z.ZodObject<{
|
|
|
54
54
|
default: z.ZodOptional<z.ZodUnknown>;
|
|
55
55
|
localized: z.ZodOptional<z.ZodBoolean>;
|
|
56
56
|
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
abilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
57
58
|
createOnly: z.ZodOptional<z.ZodBoolean>;
|
|
58
59
|
updateOnly: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
notInForm: z.ZodOptional<z.ZodBoolean>;
|
|
59
61
|
rules: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
60
62
|
rule: z.ZodLiteral<"required">;
|
|
61
63
|
message: z.ZodOptional<z.ZodString>;
|
|
64
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
update: "update";
|
|
66
|
+
create: "create";
|
|
67
|
+
}>>;
|
|
62
68
|
}, z.core.$loose>, z.ZodObject<{
|
|
63
69
|
rule: z.ZodEnum<{
|
|
64
70
|
min: "min";
|
|
@@ -66,29 +72,82 @@ export declare const Action: z.ZodObject<{
|
|
|
66
72
|
}>;
|
|
67
73
|
value: z.ZodNumber;
|
|
68
74
|
message: z.ZodOptional<z.ZodString>;
|
|
75
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
update: "update";
|
|
77
|
+
create: "create";
|
|
78
|
+
}>>;
|
|
69
79
|
}, z.core.$loose>, z.ZodObject<{
|
|
70
80
|
rule: z.ZodLiteral<"pattern">;
|
|
71
81
|
value: z.ZodString;
|
|
72
82
|
flags: z.ZodOptional<z.ZodString>;
|
|
73
83
|
message: z.ZodOptional<z.ZodString>;
|
|
84
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
update: "update";
|
|
86
|
+
create: "create";
|
|
87
|
+
}>>;
|
|
74
88
|
}, z.core.$loose>, z.ZodObject<{
|
|
75
89
|
rule: z.ZodEnum<{
|
|
76
90
|
email: "email";
|
|
77
91
|
url: "url";
|
|
92
|
+
json: "json";
|
|
78
93
|
}>;
|
|
79
94
|
message: z.ZodOptional<z.ZodString>;
|
|
95
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
update: "update";
|
|
97
|
+
create: "create";
|
|
98
|
+
}>>;
|
|
99
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
100
|
+
rule: z.ZodLiteral<"tel">;
|
|
101
|
+
extension: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
message: z.ZodOptional<z.ZodString>;
|
|
103
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
update: "update";
|
|
105
|
+
create: "create";
|
|
106
|
+
}>>;
|
|
107
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
108
|
+
rule: z.ZodLiteral<"daterange">;
|
|
109
|
+
open: z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
start: "start";
|
|
111
|
+
end: "end";
|
|
112
|
+
both: "both";
|
|
113
|
+
}>>;
|
|
114
|
+
message: z.ZodOptional<z.ZodString>;
|
|
115
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
116
|
+
update: "update";
|
|
117
|
+
create: "create";
|
|
118
|
+
}>>;
|
|
119
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
120
|
+
rule: z.ZodLiteral<"money">;
|
|
121
|
+
currencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
122
|
+
message: z.ZodOptional<z.ZodString>;
|
|
123
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
124
|
+
update: "update";
|
|
125
|
+
create: "create";
|
|
126
|
+
}>>;
|
|
80
127
|
}, z.core.$loose>, z.ZodObject<{
|
|
81
128
|
rule: z.ZodLiteral<"in">;
|
|
82
129
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
83
130
|
message: z.ZodOptional<z.ZodString>;
|
|
131
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
update: "update";
|
|
133
|
+
create: "create";
|
|
134
|
+
}>>;
|
|
84
135
|
}, z.core.$loose>, z.ZodObject<{
|
|
85
136
|
rule: z.ZodLiteral<"accept">;
|
|
86
137
|
value: z.ZodArray<z.ZodString>;
|
|
87
138
|
message: z.ZodOptional<z.ZodString>;
|
|
139
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
140
|
+
update: "update";
|
|
141
|
+
create: "create";
|
|
142
|
+
}>>;
|
|
88
143
|
}, z.core.$loose>, z.ZodObject<{
|
|
89
144
|
rule: z.ZodLiteral<"maxSize">;
|
|
90
145
|
value: z.ZodNumber;
|
|
91
146
|
message: z.ZodOptional<z.ZodString>;
|
|
147
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
148
|
+
update: "update";
|
|
149
|
+
create: "create";
|
|
150
|
+
}>>;
|
|
92
151
|
}, z.core.$loose>, z.ZodObject<{
|
|
93
152
|
rule: z.ZodEnum<{
|
|
94
153
|
before: "before";
|
|
@@ -98,9 +157,46 @@ export declare const Action: z.ZodObject<{
|
|
|
98
157
|
field: z.ZodString;
|
|
99
158
|
}, z.core.$loose>]>;
|
|
100
159
|
message: z.ZodOptional<z.ZodString>;
|
|
160
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
161
|
+
update: "update";
|
|
162
|
+
create: "create";
|
|
163
|
+
}>>;
|
|
164
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
165
|
+
rule: z.ZodLiteral<"postalCode">;
|
|
166
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
167
|
+
field: z.ZodString;
|
|
168
|
+
}, z.core.$loose>]>>;
|
|
169
|
+
message: z.ZodOptional<z.ZodString>;
|
|
170
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
171
|
+
update: "update";
|
|
172
|
+
create: "create";
|
|
173
|
+
}>>;
|
|
174
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
175
|
+
rule: z.ZodLiteral<"crop">;
|
|
176
|
+
value: z.ZodObject<{
|
|
177
|
+
ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
178
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
}, z.core.$loose>;
|
|
180
|
+
message: z.ZodOptional<z.ZodString>;
|
|
181
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
182
|
+
update: "update";
|
|
183
|
+
create: "create";
|
|
184
|
+
}>>;
|
|
185
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
186
|
+
rule: z.ZodLiteral<"providers">;
|
|
187
|
+
value: z.ZodArray<z.ZodString>;
|
|
188
|
+
message: z.ZodOptional<z.ZodString>;
|
|
189
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
190
|
+
update: "update";
|
|
191
|
+
create: "create";
|
|
192
|
+
}>>;
|
|
101
193
|
}, z.core.$loose>, z.ZodObject<{
|
|
102
194
|
rule: z.ZodString;
|
|
103
195
|
message: z.ZodOptional<z.ZodString>;
|
|
196
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
197
|
+
update: "update";
|
|
198
|
+
create: "create";
|
|
199
|
+
}>>;
|
|
104
200
|
}, z.core.$loose>]>>>;
|
|
105
201
|
visibleWhen: z.ZodOptional<z.ZodObject<{
|
|
106
202
|
field: z.ZodOptional<z.ZodString>;
|
|
@@ -108,22 +204,32 @@ export declare const Action: z.ZodObject<{
|
|
|
108
204
|
in: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
109
205
|
notIn: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
110
206
|
filled: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
-
all: z.ZodOptional<z.ZodArray<typeof import("./common").Condition>>;
|
|
112
|
-
any: z.ZodOptional<z.ZodArray<typeof import("./common").Condition>>;
|
|
207
|
+
all: z.ZodOptional<z.ZodArray<typeof import("./common.js").Condition>>;
|
|
208
|
+
any: z.ZodOptional<z.ZodArray<typeof import("./common.js").Condition>>;
|
|
113
209
|
}, z.core.$loose>>;
|
|
114
210
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
211
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
116
212
|
label: z.ZodString;
|
|
117
213
|
description: z.ZodOptional<z.ZodString>;
|
|
118
214
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
215
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
119
216
|
}, z.core.$loose>>>;
|
|
120
217
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
-
resource: z.ZodOptional<z.ZodString
|
|
218
|
+
resource: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
122
219
|
accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
220
|
+
ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
221
|
+
rotate: z.ZodOptional<z.ZodBoolean>;
|
|
222
|
+
focalPoint: z.ZodOptional<z.ZodBoolean>;
|
|
223
|
+
transformBase: z.ZodOptional<z.ZodEnum<{
|
|
224
|
+
media: "media";
|
|
225
|
+
original: "original";
|
|
226
|
+
choose: "choose";
|
|
227
|
+
}>>;
|
|
123
228
|
from: z.ZodOptional<z.ZodString>;
|
|
229
|
+
check: z.ZodOptional<z.ZodBoolean>;
|
|
124
230
|
display: z.ZodOptional<z.ZodString>;
|
|
125
231
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
126
|
-
types: z.ZodOptional<z.ZodArray<typeof import("./field").BlockType>>;
|
|
232
|
+
types: z.ZodOptional<z.ZodArray<typeof import("./field.js").BlockType>>;
|
|
127
233
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
128
234
|
}, z.core.$loose>>>;
|
|
129
235
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -133,6 +239,7 @@ export declare const Action: z.ZodObject<{
|
|
|
133
239
|
description: z.ZodOptional<z.ZodString>;
|
|
134
240
|
text: z.ZodOptional<z.ZodString>;
|
|
135
241
|
component: z.ZodOptional<z.ZodString>;
|
|
242
|
+
panel: z.ZodOptional<z.ZodString>;
|
|
136
243
|
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
137
244
|
width: z.ZodOptional<z.ZodNumber>;
|
|
138
245
|
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -143,13 +250,14 @@ export declare const Action: z.ZodObject<{
|
|
|
143
250
|
in: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
144
251
|
notIn: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
145
252
|
filled: z.ZodOptional<z.ZodBoolean>;
|
|
146
|
-
all: z.ZodOptional<z.ZodArray<typeof import("./common").Condition>>;
|
|
147
|
-
any: z.ZodOptional<z.ZodArray<typeof import("./common").Condition>>;
|
|
253
|
+
all: z.ZodOptional<z.ZodArray<typeof import("./common.js").Condition>>;
|
|
254
|
+
any: z.ZodOptional<z.ZodArray<typeof import("./common.js").Condition>>;
|
|
148
255
|
}, z.core.$loose>>;
|
|
149
256
|
children: z.ZodOptional<z.ZodArray<typeof LayoutNode>>;
|
|
150
257
|
}, z.core.$loose>>>;
|
|
151
258
|
queued: z.ZodOptional<z.ZodBoolean>;
|
|
152
259
|
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
undoable: z.ZodOptional<z.ZodBoolean>;
|
|
153
261
|
url: z.ZodOptional<z.ZodString>;
|
|
154
262
|
route: z.ZodOptional<z.ZodString>;
|
|
155
263
|
component: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;EAA4C,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;EAA6C,CAAC;AAE1E,eAAO,MAAM,aAAa;;;;;mBAWxB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6Eb,CAAC;AAEP,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/schemas/action.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { isBuiltInItemAction, isBuiltInLink } from "../constants.js";
|
|
1
2
|
import { Abilities } from "./common.js";
|
|
2
3
|
import { Field } from "./field.js";
|
|
4
|
+
import { actionJsonRules } from "./jsonRules.js";
|
|
3
5
|
import { LayoutNode } from "./layout.js";
|
|
4
6
|
import { z } from "zod";
|
|
5
7
|
//#region src/schemas/action.ts
|
|
@@ -22,7 +24,7 @@ var ActionConfirm = z.union([z.boolean(), z.looseObject({
|
|
|
22
24
|
})]);
|
|
23
25
|
var Action = z.looseObject({
|
|
24
26
|
id: z.string().min(1),
|
|
25
|
-
label: z.string(),
|
|
27
|
+
label: z.string().optional().meta({ description: "Required, except for the built-in item actions (`show`, `edit`, `duplicate`, `delete`), which the client labels in its locale." }),
|
|
26
28
|
icon: z.string().optional(),
|
|
27
29
|
kind: z.enum([
|
|
28
30
|
"server",
|
|
@@ -37,12 +39,24 @@ var Action = z.looseObject({
|
|
|
37
39
|
layout: z.array(LayoutNode).optional(),
|
|
38
40
|
queued: z.boolean().optional().meta({ description: "The action always answers `202` with a run." }),
|
|
39
41
|
dryRun: z.boolean().optional().meta({ description: "The backend answers dry runs of this action (`dryRun` in the request): lists ask it how many items of a query selection will be skipped. Without it, the UI never sends `dryRun`, since a backend that ignores it would run the action." }),
|
|
42
|
+
undoable: z.boolean().optional().meta({ description: "Its runs can be undone: the client runs it without a confirmation (unless it sets `confirm`), and shows \"Undo\" when its result has an `undo`. Above `UNDO_LIMIT` items (100), and for queued runs, the client confirms it first (decision 0063). The `delete` of a resource with a trash declares it, undone by `restore`." }),
|
|
40
43
|
url: z.string().optional().meta({ description: "`link`: URL template, with `{id}` for the item." }),
|
|
41
44
|
route: z.string().optional().meta({ description: "`link`: name of a route in the definition." }),
|
|
42
45
|
component: z.string().optional().meta({ description: "`client`: the plugin handler." }),
|
|
43
46
|
abilities: Abilities.optional().meta({ description: "`run`: whether the current user can run the action on the resource." })
|
|
44
47
|
}).superRefine((action, context) => {
|
|
45
|
-
|
|
48
|
+
const builtInLink = isBuiltInLink(action.id);
|
|
49
|
+
if (builtInLink && action.kind !== "link") context.addIssue({
|
|
50
|
+
code: "custom",
|
|
51
|
+
path: ["kind"],
|
|
52
|
+
message: `The id \`${action.id}\` is reserved for the built-in link: its \`kind\` must be \`link\`.`
|
|
53
|
+
});
|
|
54
|
+
if (action.label === void 0 && !isBuiltInItemAction(action.id)) context.addIssue({
|
|
55
|
+
code: "custom",
|
|
56
|
+
path: ["label"],
|
|
57
|
+
message: "An action needs a `label`."
|
|
58
|
+
});
|
|
59
|
+
if (action.kind === "link" && action.url === void 0 && action.route === void 0 && !builtInLink) context.addIssue({
|
|
46
60
|
code: "custom",
|
|
47
61
|
message: "A `link` action needs a `url` or a `route`."
|
|
48
62
|
});
|
|
@@ -50,7 +64,10 @@ var Action = z.looseObject({
|
|
|
50
64
|
code: "custom",
|
|
51
65
|
message: "A `client` action needs a `component`."
|
|
52
66
|
});
|
|
53
|
-
}).meta({
|
|
67
|
+
}).meta({
|
|
68
|
+
description: "An operation on one item, a selection, or the whole resource.",
|
|
69
|
+
...actionJsonRules
|
|
70
|
+
});
|
|
54
71
|
//#endregion
|
|
55
72
|
export { Action, ActionConfirm, ActionPlacement, ActionScope };
|
|
56
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","names":[],"sources":["../../src/schemas/action.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Abilities } from './common';\nimport { Field } from './field';\nimport { LayoutNode } from './layout';\n\nexport const ActionScope = z.enum(['item', 'selection', 'resource']);\n\nexport const ActionPlacement = z.enum(['row', 'toolbar', 'form', 'menu']);\n\nexport const ActionConfirm = z.union([\n z.boolean(),\n z.looseObject({\n title: z.string().optional(),\n message: z\n .string()\n .optional()\n .meta({ description: 'ICU message. `{count}` is the number of items.' }),\n confirmLabel: z.string().optional(),\n cancelLabel: z.string().optional(),\n }),\n]);\n\nexport const Action = z\n .looseObject({\n id: z.string().min(1),\n label: z.string(),\n icon: z.string().optional(),\n kind: z.enum(['server', 'link', 'client']).default('server').meta({\n description:\n '`server` calls the action endpoint; `link` navigates; `client` runs a plugin handler.',\n }),\n scope: z.array(ActionScope).min(1),\n placement: z.array(ActionPlacement).optional(),\n destructive: z.boolean().optional(),\n confirm: ActionConfirm.optional(),\n fields: z.array(Field).optional().meta({ description: 'Parameters, shown in a modal.' }),\n layout: z.array(LayoutNode).optional(),\n queued: z\n .boolean()\n .optional()\n .meta({ description: 'The action always answers `202` with a run.' }),\n dryRun: z.boolean().optional().meta({\n description:\n 'The backend answers dry runs of this action (`dryRun` in the request): lists ask it how many items of a query selection will be skipped. Without it, the UI never sends `dryRun`, since a backend that ignores it would run the action.',\n }),\n url: z\n .string()\n .optional()\n .meta({ description: '`link`: URL template, with `{id}` for the item.' }),\n route: z\n .string()\n .optional()\n .meta({ description: '`link`: name of a route in the definition.' }),\n component: z.string().optional().meta({ description: '`client`: the plugin handler.' }),\n abilities: Abilities.optional().meta({\n description: '`run`: whether the current user can run the action on the resource.',\n }),\n })\n .superRefine((action, context) => {\n if (action.kind
|
|
1
|
+
{"version":3,"file":"action.js","names":[],"sources":["../../src/schemas/action.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { isBuiltInItemAction, isBuiltInLink } from '../constants';\nimport { Abilities } from './common';\nimport { Field } from './field';\nimport { actionJsonRules } from './jsonRules';\nimport { LayoutNode } from './layout';\n\nexport const ActionScope = z.enum(['item', 'selection', 'resource']);\n\nexport const ActionPlacement = z.enum(['row', 'toolbar', 'form', 'menu']);\n\nexport const ActionConfirm = z.union([\n z.boolean(),\n z.looseObject({\n title: z.string().optional(),\n message: z\n .string()\n .optional()\n .meta({ description: 'ICU message. `{count}` is the number of items.' }),\n confirmLabel: z.string().optional(),\n cancelLabel: z.string().optional(),\n }),\n]);\n\nexport const Action = z\n .looseObject({\n id: z.string().min(1),\n label: z.string().optional().meta({\n description:\n 'Required, except for the built-in item actions (`show`, `edit`, `duplicate`, `delete`), which the client labels in its locale.',\n }),\n icon: z.string().optional(),\n kind: z.enum(['server', 'link', 'client']).default('server').meta({\n description:\n '`server` calls the action endpoint; `link` navigates; `client` runs a plugin handler.',\n }),\n scope: z.array(ActionScope).min(1),\n placement: z.array(ActionPlacement).optional(),\n destructive: z.boolean().optional(),\n confirm: ActionConfirm.optional(),\n fields: z.array(Field).optional().meta({ description: 'Parameters, shown in a modal.' }),\n layout: z.array(LayoutNode).optional(),\n queued: z\n .boolean()\n .optional()\n .meta({ description: 'The action always answers `202` with a run.' }),\n dryRun: z.boolean().optional().meta({\n description:\n 'The backend answers dry runs of this action (`dryRun` in the request): lists ask it how many items of a query selection will be skipped. Without it, the UI never sends `dryRun`, since a backend that ignores it would run the action.',\n }),\n undoable: z.boolean().optional().meta({\n description:\n 'Its runs can be undone: the client runs it without a confirmation (unless it sets `confirm`), and shows \"Undo\" when its result has an `undo`. Above `UNDO_LIMIT` items (100), and for queued runs, the client confirms it first (decision 0063). The `delete` of a resource with a trash declares it, undone by `restore`.',\n }),\n url: z\n .string()\n .optional()\n .meta({ description: '`link`: URL template, with `{id}` for the item.' }),\n route: z\n .string()\n .optional()\n .meta({ description: '`link`: name of a route in the definition.' }),\n component: z.string().optional().meta({ description: '`client`: the plugin handler.' }),\n abilities: Abilities.optional().meta({\n description: '`run`: whether the current user can run the action on the resource.',\n }),\n })\n .superRefine((action, context) => {\n const builtInLink = isBuiltInLink(action.id);\n if (builtInLink && action.kind !== 'link') {\n context.addIssue({\n code: 'custom',\n path: ['kind'],\n message: `The id \\`${action.id}\\` is reserved for the built-in link: its \\`kind\\` must be \\`link\\`.`,\n });\n }\n if (action.label === undefined && !isBuiltInItemAction(action.id)) {\n context.addIssue({\n code: 'custom',\n path: ['label'],\n message: 'An action needs a `label`.',\n });\n }\n if (\n action.kind === 'link' &&\n action.url === undefined &&\n action.route === undefined &&\n !builtInLink\n ) {\n context.addIssue({\n code: 'custom',\n message: 'A `link` action needs a `url` or a `route`.',\n });\n }\n if (action.kind === 'client' && action.component === undefined) {\n context.addIssue({ code: 'custom', message: 'A `client` action needs a `component`.' });\n }\n })\n .meta({\n description: 'An operation on one item, a selection, or the whole resource.',\n ...actionJsonRules,\n });\n\nexport type ActionScope = z.infer<typeof ActionScope>;\nexport type ActionPlacement = z.infer<typeof ActionPlacement>;\nexport type ActionConfirm = z.infer<typeof ActionConfirm>;\nexport type Action = z.infer<typeof Action>;\n/** An action as a backend writes it: `kind` defaults to `server`. */\nexport type ActionInput = z.input<typeof Action>;\n"],"mappings":";;;;;;;AAQA,IAAa,cAAc,EAAE,KAAK;CAAC;CAAQ;CAAa;AAAU,CAAC;AAEnE,IAAa,kBAAkB,EAAE,KAAK;CAAC;CAAO;CAAW;CAAQ;AAAM,CAAC;AAExE,IAAa,gBAAgB,EAAE,MAAM,CACjC,EAAE,QAAQ,GACV,EAAE,YAAY;CACV,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,SAAS,EACJ,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iDAAiD,CAAC;CAC3E,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;AACrC,CAAC,CACL,CAAC;AAED,IAAa,SAAS,EACjB,YAAY;CACT,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC9B,aACI,iIACR,CAAC;CACD,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAM,EAAE,KAAK;EAAC;EAAU;EAAQ;CAAQ,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,CAAC,KAAK,EAC9D,aACI,wFACR,CAAC;CACD,OAAO,EAAE,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC;CACjC,WAAW,EAAE,MAAM,eAAe,CAAC,CAAC,SAAS;CAC7C,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS;CAClC,SAAS,cAAc,SAAS;CAChC,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,gCAAgC,CAAC;CACvF,QAAQ,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;CACrC,QAAQ,EACH,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,8CAA8C,CAAC;CACxE,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aACI,0OACR,CAAC;CACD,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAClC,aACI,+TACR,CAAC;CACD,KAAK,EACA,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,kDAAkD,CAAC;CAC5E,OAAO,EACF,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,6CAA6C,CAAC;CACvE,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,gCAAgC,CAAC;CACtF,WAAW,UAAU,SAAS,CAAC,CAAC,KAAK,EACjC,aAAa,sEACjB,CAAC;AACL,CAAC,CAAC,CACD,aAAa,QAAQ,YAAY;CAC9B,MAAM,cAAc,cAAc,OAAO,EAAE;CAC3C,IAAI,eAAe,OAAO,SAAS,QAC/B,QAAQ,SAAS;EACb,MAAM;EACN,MAAM,CAAC,MAAM;EACb,SAAS,YAAY,OAAO,GAAG;CACnC,CAAC;CAEL,IAAI,OAAO,UAAU,KAAA,KAAa,CAAC,oBAAoB,OAAO,EAAE,GAC5D,QAAQ,SAAS;EACb,MAAM;EACN,MAAM,CAAC,OAAO;EACd,SAAS;CACb,CAAC;CAEL,IACI,OAAO,SAAS,UAChB,OAAO,QAAQ,KAAA,KACf,OAAO,UAAU,KAAA,KACjB,CAAC,aAED,QAAQ,SAAS;EACb,MAAM;EACN,SAAS;CACb,CAAC;CAEL,IAAI,OAAO,SAAS,YAAY,OAAO,cAAc,KAAA,GACjD,QAAQ,SAAS;EAAE,MAAM;EAAU,SAAS;CAAyC,CAAC;AAE9F,CAAC,CAAC,CACD,KAAK;CACF,aAAa;CACb,GAAG;AACP,CAAC"}
|