@panneau/protocol 0.0.0-stage → 5.0.0-alpha.1
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/README.md +35 -2
- package/dist/conditions.d.ts +7 -0
- package/dist/conditions.d.ts.map +1 -0
- package/dist/conditions.js +21 -0
- package/dist/conditions.js.map +1 -0
- package/dist/conformance/index.d.ts +42 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +270 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +73 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/lint.d.ts +8 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +73 -0
- package/dist/lint.js.map +1 -0
- package/dist/mock/example.d.ts +8 -0
- package/dist/mock/example.d.ts.map +1 -0
- package/dist/mock/example.js +190 -0
- package/dist/mock/example.js.map +1 -0
- package/dist/mock/index.d.ts +24 -0
- package/dist/mock/index.d.ts.map +1 -0
- package/dist/mock/index.js +254 -0
- package/dist/mock/index.js.map +1 -0
- package/dist/openapi.d.ts +11 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +540 -0
- package/dist/openapi.js.map +1 -0
- package/dist/problem.d.ts +7 -0
- package/dist/problem.d.ts.map +1 -0
- package/dist/problem.js +22 -0
- package/dist/problem.js.map +1 -0
- package/dist/query.d.ts +41 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +80 -0
- package/dist/query.js.map +1 -0
- package/dist/rules.d.ts +29 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/rules.js +143 -0
- package/dist/rules.js.map +1 -0
- package/dist/runtime/index.d.ts +10 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +9 -0
- package/dist/schemas/action.d.ts +163 -0
- package/dist/schemas/action.d.ts.map +1 -0
- package/dist/schemas/action.js +56 -0
- package/dist/schemas/action.js.map +1 -0
- package/dist/schemas/api.d.ts +371 -0
- package/dist/schemas/api.d.ts.map +1 -0
- package/dist/schemas/api.js +140 -0
- package/dist/schemas/api.js.map +1 -0
- package/dist/schemas/boot.d.ts +14 -0
- package/dist/schemas/boot.d.ts.map +1 -0
- package/dist/schemas/boot.js +16 -0
- package/dist/schemas/boot.js.map +1 -0
- package/dist/schemas/common.d.ts +28 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +35 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/definition.d.ts +462 -0
- package/dist/schemas/definition.d.ts.map +1 -0
- package/dist/schemas/definition.js +101 -0
- package/dist/schemas/definition.js.map +1 -0
- package/dist/schemas/field.d.ts +139 -0
- package/dist/schemas/field.d.ts.map +1 -0
- package/dist/schemas/field.js +94 -0
- package/dist/schemas/field.js.map +1 -0
- package/dist/schemas/index.d.ts +1536 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +68 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/layout.d.ts +26 -0
- package/dist/schemas/layout.d.ts.map +1 -0
- package/dist/schemas/layout.js +23 -0
- package/dist/schemas/layout.js.map +1 -0
- package/dist/schemas/list.d.ts +69 -0
- package/dist/schemas/list.d.ts.map +1 -0
- package/dist/schemas/list.js +41 -0
- package/dist/schemas/list.js.map +1 -0
- package/dist/schemas/resource.d.ts +328 -0
- package/dist/schemas/resource.d.ts.map +1 -0
- package/dist/schemas/resource.js +38 -0
- package/dist/schemas/resource.js.map +1 -0
- package/dist/validate.d.ts +28 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +52 -0
- package/dist/validate.js.map +1 -0
- package/dist/values.d.ts +7 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/values.js +29 -0
- package/dist/values.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/package.json +53 -5
- package/schema/boot.schema.json +1229 -0
- package/schema/definition.schema.json +1195 -0
- package/schema/openapi.json +3839 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Item: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
version: z.ZodNullable<z.ZodString>;
|
|
5
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export declare const Pagination: z.ZodObject<{
|
|
8
|
+
page: z.ZodNumber;
|
|
9
|
+
perPage: z.ZodNumber;
|
|
10
|
+
total: z.ZodNumber;
|
|
11
|
+
lastPage: z.ZodNumber;
|
|
12
|
+
}, z.core.$loose>;
|
|
13
|
+
export declare const ItemResponse: z.ZodObject<{
|
|
14
|
+
data: z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
version: z.ZodNullable<z.ZodString>;
|
|
17
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
18
|
+
}, z.core.$loose>;
|
|
19
|
+
}, z.core.$loose>;
|
|
20
|
+
export declare const ListResponse: z.ZodObject<{
|
|
21
|
+
data: z.ZodArray<z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
version: z.ZodNullable<z.ZodString>;
|
|
24
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
25
|
+
}, z.core.$loose>>;
|
|
26
|
+
meta: z.ZodObject<{
|
|
27
|
+
page: z.ZodNumber;
|
|
28
|
+
perPage: z.ZodNumber;
|
|
29
|
+
total: z.ZodNumber;
|
|
30
|
+
lastPage: z.ZodNumber;
|
|
31
|
+
}, z.core.$loose>;
|
|
32
|
+
}, z.core.$loose>;
|
|
33
|
+
export declare const Problem: z.ZodObject<{
|
|
34
|
+
type: z.ZodString;
|
|
35
|
+
title: z.ZodString;
|
|
36
|
+
status: z.ZodNumber;
|
|
37
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
38
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
39
|
+
errors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
40
|
+
current: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
version: z.ZodNullable<z.ZodString>;
|
|
43
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
44
|
+
}, z.core.$loose>>;
|
|
45
|
+
}, z.core.$loose>;
|
|
46
|
+
export declare const Selection: z.ZodUnion<readonly [z.ZodObject<{
|
|
47
|
+
ids: z.ZodArray<z.ZodString>;
|
|
48
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
49
|
+
query: z.ZodObject<{
|
|
50
|
+
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
51
|
+
q: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$loose>;
|
|
53
|
+
except: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
|
+
}, z.core.$loose>]>;
|
|
55
|
+
export declare const ActionRequest: z.ZodObject<{
|
|
56
|
+
selection: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
57
|
+
ids: z.ZodArray<z.ZodString>;
|
|
58
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
59
|
+
query: z.ZodObject<{
|
|
60
|
+
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
61
|
+
q: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$loose>;
|
|
63
|
+
except: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
64
|
+
}, z.core.$loose>]>>;
|
|
65
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
66
|
+
}, z.core.$loose>;
|
|
67
|
+
export declare const ActionItemResult: z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
status: z.ZodEnum<{
|
|
70
|
+
failed: "failed";
|
|
71
|
+
skipped: "skipped";
|
|
72
|
+
}>;
|
|
73
|
+
message: z.ZodOptional<z.ZodString>;
|
|
74
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$loose>;
|
|
76
|
+
export declare const ActionResult: z.ZodObject<{
|
|
77
|
+
message: z.ZodOptional<z.ZodString>;
|
|
78
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
succeeded: z.ZodNumber;
|
|
80
|
+
failed: z.ZodNumber;
|
|
81
|
+
skipped: z.ZodNumber;
|
|
82
|
+
}, z.core.$loose>>;
|
|
83
|
+
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
status: z.ZodEnum<{
|
|
86
|
+
failed: "failed";
|
|
87
|
+
skipped: "skipped";
|
|
88
|
+
}>;
|
|
89
|
+
message: z.ZodOptional<z.ZodString>;
|
|
90
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$loose>>>;
|
|
92
|
+
refresh: z.ZodOptional<z.ZodEnum<{
|
|
93
|
+
list: "list";
|
|
94
|
+
none: "none";
|
|
95
|
+
items: "items";
|
|
96
|
+
}>>;
|
|
97
|
+
redirect: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
98
|
+
route: z.ZodString;
|
|
99
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
100
|
+
}, z.core.$loose>]>>>;
|
|
101
|
+
download: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
102
|
+
url: z.ZodString;
|
|
103
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
104
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$loose>>>;
|
|
106
|
+
}, z.core.$loose>;
|
|
107
|
+
export declare const ActionRun: z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
action: z.ZodString;
|
|
110
|
+
resource: z.ZodString;
|
|
111
|
+
status: z.ZodEnum<{
|
|
112
|
+
queued: "queued";
|
|
113
|
+
failed: "failed";
|
|
114
|
+
succeeded: "succeeded";
|
|
115
|
+
running: "running";
|
|
116
|
+
partial: "partial";
|
|
117
|
+
cancelled: "cancelled";
|
|
118
|
+
}>;
|
|
119
|
+
progress: z.ZodNumber;
|
|
120
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
122
|
+
message: z.ZodOptional<z.ZodString>;
|
|
123
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
succeeded: z.ZodNumber;
|
|
125
|
+
failed: z.ZodNumber;
|
|
126
|
+
skipped: z.ZodNumber;
|
|
127
|
+
}, z.core.$loose>>;
|
|
128
|
+
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
status: z.ZodEnum<{
|
|
131
|
+
failed: "failed";
|
|
132
|
+
skipped: "skipped";
|
|
133
|
+
}>;
|
|
134
|
+
message: z.ZodOptional<z.ZodString>;
|
|
135
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$loose>>>;
|
|
137
|
+
refresh: z.ZodOptional<z.ZodEnum<{
|
|
138
|
+
list: "list";
|
|
139
|
+
none: "none";
|
|
140
|
+
items: "items";
|
|
141
|
+
}>>;
|
|
142
|
+
redirect: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
143
|
+
route: z.ZodString;
|
|
144
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
145
|
+
}, z.core.$loose>]>>>;
|
|
146
|
+
download: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
147
|
+
url: z.ZodString;
|
|
148
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
149
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, z.core.$loose>>>;
|
|
151
|
+
}, z.core.$loose>>;
|
|
152
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
153
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
154
|
+
}, z.core.$loose>;
|
|
155
|
+
export declare const ActionRunResponse: z.ZodObject<{
|
|
156
|
+
run: z.ZodObject<{
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
action: z.ZodString;
|
|
159
|
+
resource: z.ZodString;
|
|
160
|
+
status: z.ZodEnum<{
|
|
161
|
+
queued: "queued";
|
|
162
|
+
failed: "failed";
|
|
163
|
+
succeeded: "succeeded";
|
|
164
|
+
running: "running";
|
|
165
|
+
partial: "partial";
|
|
166
|
+
cancelled: "cancelled";
|
|
167
|
+
}>;
|
|
168
|
+
progress: z.ZodNumber;
|
|
169
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
170
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
message: z.ZodOptional<z.ZodString>;
|
|
172
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
succeeded: z.ZodNumber;
|
|
174
|
+
failed: z.ZodNumber;
|
|
175
|
+
skipped: z.ZodNumber;
|
|
176
|
+
}, z.core.$loose>>;
|
|
177
|
+
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
status: z.ZodEnum<{
|
|
180
|
+
failed: "failed";
|
|
181
|
+
skipped: "skipped";
|
|
182
|
+
}>;
|
|
183
|
+
message: z.ZodOptional<z.ZodString>;
|
|
184
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$loose>>>;
|
|
186
|
+
refresh: z.ZodOptional<z.ZodEnum<{
|
|
187
|
+
list: "list";
|
|
188
|
+
none: "none";
|
|
189
|
+
items: "items";
|
|
190
|
+
}>>;
|
|
191
|
+
redirect: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
192
|
+
route: z.ZodString;
|
|
193
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
194
|
+
}, z.core.$loose>]>>>;
|
|
195
|
+
download: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
196
|
+
url: z.ZodString;
|
|
197
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
198
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, z.core.$loose>>>;
|
|
200
|
+
}, z.core.$loose>>;
|
|
201
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
202
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
203
|
+
}, z.core.$loose>;
|
|
204
|
+
}, z.core.$loose>;
|
|
205
|
+
export declare const MediaTransform: z.ZodObject<{
|
|
206
|
+
crop: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
x: z.ZodNumber;
|
|
208
|
+
y: z.ZodNumber;
|
|
209
|
+
width: z.ZodNumber;
|
|
210
|
+
height: z.ZodNumber;
|
|
211
|
+
}, z.core.$loose>>;
|
|
212
|
+
rotate: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
213
|
+
flipX: z.ZodOptional<z.ZodBoolean>;
|
|
214
|
+
flipY: z.ZodOptional<z.ZodBoolean>;
|
|
215
|
+
focalPoint: z.ZodOptional<z.ZodObject<{
|
|
216
|
+
x: z.ZodNumber;
|
|
217
|
+
y: z.ZodNumber;
|
|
218
|
+
}, z.core.$loose>>;
|
|
219
|
+
}, z.core.$loose>;
|
|
220
|
+
export declare const Media: z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
version: z.ZodNullable<z.ZodString>;
|
|
223
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
224
|
+
type: z.ZodString;
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
mime: z.ZodString;
|
|
227
|
+
size: z.ZodNumber;
|
|
228
|
+
url: z.ZodString;
|
|
229
|
+
thumbnailUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
230
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
231
|
+
url: z.ZodString;
|
|
232
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
}, z.core.$loose>>>;
|
|
235
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
236
|
+
transform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
237
|
+
crop: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
x: z.ZodNumber;
|
|
239
|
+
y: z.ZodNumber;
|
|
240
|
+
width: z.ZodNumber;
|
|
241
|
+
height: z.ZodNumber;
|
|
242
|
+
}, z.core.$loose>>;
|
|
243
|
+
rotate: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
244
|
+
flipX: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
flipY: z.ZodOptional<z.ZodBoolean>;
|
|
246
|
+
focalPoint: z.ZodOptional<z.ZodObject<{
|
|
247
|
+
x: z.ZodNumber;
|
|
248
|
+
y: z.ZodNumber;
|
|
249
|
+
}, z.core.$loose>>;
|
|
250
|
+
}, z.core.$loose>>>;
|
|
251
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
252
|
+
}, z.core.$loose>;
|
|
253
|
+
export declare const MediaResponse: z.ZodObject<{
|
|
254
|
+
data: z.ZodObject<{
|
|
255
|
+
id: z.ZodString;
|
|
256
|
+
version: z.ZodNullable<z.ZodString>;
|
|
257
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
258
|
+
type: z.ZodString;
|
|
259
|
+
name: z.ZodString;
|
|
260
|
+
mime: z.ZodString;
|
|
261
|
+
size: z.ZodNumber;
|
|
262
|
+
url: z.ZodString;
|
|
263
|
+
thumbnailUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
265
|
+
url: z.ZodString;
|
|
266
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
}, z.core.$loose>>>;
|
|
269
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
270
|
+
transform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
271
|
+
crop: z.ZodOptional<z.ZodObject<{
|
|
272
|
+
x: z.ZodNumber;
|
|
273
|
+
y: z.ZodNumber;
|
|
274
|
+
width: z.ZodNumber;
|
|
275
|
+
height: z.ZodNumber;
|
|
276
|
+
}, z.core.$loose>>;
|
|
277
|
+
rotate: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
278
|
+
flipX: z.ZodOptional<z.ZodBoolean>;
|
|
279
|
+
flipY: z.ZodOptional<z.ZodBoolean>;
|
|
280
|
+
focalPoint: z.ZodOptional<z.ZodObject<{
|
|
281
|
+
x: z.ZodNumber;
|
|
282
|
+
y: z.ZodNumber;
|
|
283
|
+
}, z.core.$loose>>;
|
|
284
|
+
}, z.core.$loose>>>;
|
|
285
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
286
|
+
}, z.core.$loose>;
|
|
287
|
+
}, z.core.$loose>;
|
|
288
|
+
export declare const MediaListResponse: z.ZodObject<{
|
|
289
|
+
data: z.ZodArray<z.ZodObject<{
|
|
290
|
+
id: z.ZodString;
|
|
291
|
+
version: z.ZodNullable<z.ZodString>;
|
|
292
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
293
|
+
type: z.ZodString;
|
|
294
|
+
name: z.ZodString;
|
|
295
|
+
mime: z.ZodString;
|
|
296
|
+
size: z.ZodNumber;
|
|
297
|
+
url: z.ZodString;
|
|
298
|
+
thumbnailUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
299
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
300
|
+
url: z.ZodString;
|
|
301
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
302
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
303
|
+
}, z.core.$loose>>>;
|
|
304
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
305
|
+
transform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
306
|
+
crop: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
x: z.ZodNumber;
|
|
308
|
+
y: z.ZodNumber;
|
|
309
|
+
width: z.ZodNumber;
|
|
310
|
+
height: z.ZodNumber;
|
|
311
|
+
}, z.core.$loose>>;
|
|
312
|
+
rotate: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
313
|
+
flipX: z.ZodOptional<z.ZodBoolean>;
|
|
314
|
+
flipY: z.ZodOptional<z.ZodBoolean>;
|
|
315
|
+
focalPoint: z.ZodOptional<z.ZodObject<{
|
|
316
|
+
x: z.ZodNumber;
|
|
317
|
+
y: z.ZodNumber;
|
|
318
|
+
}, z.core.$loose>>;
|
|
319
|
+
}, z.core.$loose>>>;
|
|
320
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
321
|
+
}, z.core.$loose>>;
|
|
322
|
+
meta: z.ZodObject<{
|
|
323
|
+
page: z.ZodNumber;
|
|
324
|
+
perPage: z.ZodNumber;
|
|
325
|
+
total: z.ZodNumber;
|
|
326
|
+
lastPage: z.ZodNumber;
|
|
327
|
+
}, z.core.$loose>;
|
|
328
|
+
}, z.core.$loose>;
|
|
329
|
+
export declare const Session: z.ZodObject<{
|
|
330
|
+
user: z.ZodObject<{
|
|
331
|
+
id: z.ZodString;
|
|
332
|
+
name: z.ZodString;
|
|
333
|
+
email: z.ZodOptional<z.ZodString>;
|
|
334
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
335
|
+
abilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
336
|
+
}, z.core.$loose>;
|
|
337
|
+
}, z.core.$loose>;
|
|
338
|
+
export declare const SearchResponse: z.ZodObject<{
|
|
339
|
+
data: z.ZodArray<z.ZodObject<{
|
|
340
|
+
resource: z.ZodString;
|
|
341
|
+
items: z.ZodArray<z.ZodObject<{
|
|
342
|
+
id: z.ZodString;
|
|
343
|
+
version: z.ZodNullable<z.ZodString>;
|
|
344
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
345
|
+
}, z.core.$loose>>;
|
|
346
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
}, z.core.$loose>>;
|
|
348
|
+
}, z.core.$loose>;
|
|
349
|
+
export declare const PreviewResponse: z.ZodObject<{
|
|
350
|
+
url: z.ZodString;
|
|
351
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
352
|
+
}, z.core.$loose>;
|
|
353
|
+
export type Item = z.infer<typeof Item>;
|
|
354
|
+
export type Pagination = z.infer<typeof Pagination>;
|
|
355
|
+
export type ItemResponse = z.infer<typeof ItemResponse>;
|
|
356
|
+
export type ListResponse = z.infer<typeof ListResponse>;
|
|
357
|
+
export type Problem = z.infer<typeof Problem>;
|
|
358
|
+
export type Selection = z.infer<typeof Selection>;
|
|
359
|
+
export type ActionRequest = z.infer<typeof ActionRequest>;
|
|
360
|
+
export type ActionItemResult = z.infer<typeof ActionItemResult>;
|
|
361
|
+
export type ActionResult = z.infer<typeof ActionResult>;
|
|
362
|
+
export type ActionRun = z.infer<typeof ActionRun>;
|
|
363
|
+
export type ActionRunResponse = z.infer<typeof ActionRunResponse>;
|
|
364
|
+
export type MediaTransform = z.infer<typeof MediaTransform>;
|
|
365
|
+
export type Media = z.infer<typeof Media>;
|
|
366
|
+
export type MediaResponse = z.infer<typeof MediaResponse>;
|
|
367
|
+
export type MediaListResponse = z.infer<typeof MediaListResponse>;
|
|
368
|
+
export type Session = z.infer<typeof Session>;
|
|
369
|
+
export type SearchResponse = z.infer<typeof SearchResponse>;
|
|
370
|
+
export type PreviewResponse = z.infer<typeof PreviewResponse>;
|
|
371
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/schemas/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,IAAI;;;;iBAUX,CAAC;AAEP,eAAO,MAAM,UAAU;;;;;iBAKrB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;iBAAgC,CAAC;AAE1D,eAAO,MAAM,YAAY;;;;;;;;;;;;iBAA2D,CAAC;AAErF,eAAO,MAAM,OAAO;;;;;;;;;;;;iBAa6E,CAAC;AAElG,eAAO,MAAM,SAAS;;;;;;;;mBAYpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;iBAQ3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUpB,CAA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,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAC1C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Abilities, Id, RouteReference } from "./common.js";
|
|
2
|
+
import { User } from "./definition.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/schemas/api.ts
|
|
5
|
+
var Item = z.looseObject({
|
|
6
|
+
id: Id,
|
|
7
|
+
version: z.string().nullable().meta({ description: "Changes on every update. `null` when the backend has no versions." }),
|
|
8
|
+
abilities: Abilities
|
|
9
|
+
}).meta({ description: "An item of a resource. Its other properties are the values of its fields." });
|
|
10
|
+
var Pagination = z.looseObject({
|
|
11
|
+
page: z.number().int().positive(),
|
|
12
|
+
perPage: z.number().int().positive(),
|
|
13
|
+
total: z.number().int().nonnegative(),
|
|
14
|
+
lastPage: z.number().int().positive()
|
|
15
|
+
});
|
|
16
|
+
var ItemResponse = z.looseObject({ data: Item });
|
|
17
|
+
var ListResponse = z.looseObject({
|
|
18
|
+
data: z.array(Item),
|
|
19
|
+
meta: Pagination
|
|
20
|
+
});
|
|
21
|
+
var Problem = z.looseObject({
|
|
22
|
+
type: z.string().meta({ description: "A URI reference that identifies the problem type." }),
|
|
23
|
+
title: z.string(),
|
|
24
|
+
status: z.number().int().min(400).max(599),
|
|
25
|
+
detail: z.string().optional(),
|
|
26
|
+
instance: z.string().optional(),
|
|
27
|
+
errors: z.record(z.string(), z.array(z.string())).optional().meta({ description: "`422`: messages keyed by the dot path of the invalid value." }),
|
|
28
|
+
current: Item.optional().meta({ description: "`412`: the current version of the item." })
|
|
29
|
+
}).meta({ description: "An error, as RFC 9457 problem details (`application/problem+json`)." });
|
|
30
|
+
var Selection = z.union([z.looseObject({ ids: z.array(Id).min(1) }), z.looseObject({
|
|
31
|
+
query: z.looseObject({
|
|
32
|
+
filter: z.record(z.string(), z.unknown()).optional().meta({ description: "The `filter` of the list query, by filter id: a value, a list of values, or the bounds of a range (`{ \"from\": \"2026-01-01\", \"to\": \"2026-01-31\" }`)." }),
|
|
33
|
+
q: z.string().optional()
|
|
34
|
+
}),
|
|
35
|
+
except: z.array(Id).optional()
|
|
36
|
+
})]);
|
|
37
|
+
var ActionRequest = z.looseObject({
|
|
38
|
+
selection: Selection.optional().meta({ description: "Omitted for actions on the whole resource." }),
|
|
39
|
+
values: z.record(z.string(), z.unknown()).optional()
|
|
40
|
+
});
|
|
41
|
+
var ActionItemResult = z.looseObject({
|
|
42
|
+
id: Id,
|
|
43
|
+
status: z.enum(["failed", "skipped"]),
|
|
44
|
+
message: z.string().optional(),
|
|
45
|
+
reason: z.string().optional().meta({ description: "`skipped`: `forbidden`, `not_found` or `unchanged`." })
|
|
46
|
+
});
|
|
47
|
+
var ActionResult = z.looseObject({
|
|
48
|
+
message: z.string().optional(),
|
|
49
|
+
summary: z.looseObject({
|
|
50
|
+
succeeded: z.number().int().nonnegative(),
|
|
51
|
+
failed: z.number().int().nonnegative(),
|
|
52
|
+
skipped: z.number().int().nonnegative()
|
|
53
|
+
}).optional(),
|
|
54
|
+
results: z.array(ActionItemResult).optional().meta({ description: "The items that did not succeed." }),
|
|
55
|
+
refresh: z.enum([
|
|
56
|
+
"none",
|
|
57
|
+
"items",
|
|
58
|
+
"list"
|
|
59
|
+
]).optional(),
|
|
60
|
+
redirect: z.union([z.string(), RouteReference]).nullable().optional(),
|
|
61
|
+
download: z.looseObject({
|
|
62
|
+
url: z.string(),
|
|
63
|
+
filename: z.string().optional(),
|
|
64
|
+
expiresAt: z.string().optional()
|
|
65
|
+
}).nullable().optional()
|
|
66
|
+
});
|
|
67
|
+
var ActionRun = z.looseObject({
|
|
68
|
+
id: Id,
|
|
69
|
+
action: z.string(),
|
|
70
|
+
resource: z.string(),
|
|
71
|
+
status: z.enum([
|
|
72
|
+
"queued",
|
|
73
|
+
"running",
|
|
74
|
+
"succeeded",
|
|
75
|
+
"partial",
|
|
76
|
+
"failed",
|
|
77
|
+
"cancelled"
|
|
78
|
+
]),
|
|
79
|
+
progress: z.number().int().nonnegative(),
|
|
80
|
+
total: z.number().int().nonnegative().nullable(),
|
|
81
|
+
result: ActionResult.optional().meta({ description: "Set once the run has finished." }),
|
|
82
|
+
createdAt: z.string().optional(),
|
|
83
|
+
finishedAt: z.string().nullable().optional()
|
|
84
|
+
});
|
|
85
|
+
var ActionRunResponse = z.looseObject({ run: ActionRun });
|
|
86
|
+
var MediaTransform = z.looseObject({
|
|
87
|
+
crop: z.looseObject({
|
|
88
|
+
x: z.number(),
|
|
89
|
+
y: z.number(),
|
|
90
|
+
width: z.number(),
|
|
91
|
+
height: z.number()
|
|
92
|
+
}).optional().meta({ description: "In pixels of the original image." }),
|
|
93
|
+
rotate: z.union([
|
|
94
|
+
z.literal(0),
|
|
95
|
+
z.literal(90),
|
|
96
|
+
z.literal(180),
|
|
97
|
+
z.literal(270)
|
|
98
|
+
]).optional(),
|
|
99
|
+
flipX: z.boolean().optional(),
|
|
100
|
+
flipY: z.boolean().optional(),
|
|
101
|
+
focalPoint: z.looseObject({
|
|
102
|
+
x: z.number().min(0).max(1),
|
|
103
|
+
y: z.number().min(0).max(1)
|
|
104
|
+
}).optional().meta({ description: "Relative to the width and height, from 0 to 1." })
|
|
105
|
+
});
|
|
106
|
+
var Media = Item.extend({
|
|
107
|
+
type: z.string().meta({ description: "`image`, `video`, `audio`, `document`, `font`, or another type." }),
|
|
108
|
+
name: z.string(),
|
|
109
|
+
mime: z.string(),
|
|
110
|
+
size: z.number().int().nonnegative(),
|
|
111
|
+
url: z.string(),
|
|
112
|
+
thumbnailUrl: z.string().nullable().optional(),
|
|
113
|
+
variants: z.record(z.string(), z.looseObject({
|
|
114
|
+
url: z.string(),
|
|
115
|
+
width: z.number().optional(),
|
|
116
|
+
height: z.number().optional()
|
|
117
|
+
})).optional(),
|
|
118
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
119
|
+
transform: MediaTransform.nullable().optional(),
|
|
120
|
+
tags: z.array(z.string()).optional()
|
|
121
|
+
});
|
|
122
|
+
var MediaResponse = z.looseObject({ data: Media });
|
|
123
|
+
var MediaListResponse = z.looseObject({
|
|
124
|
+
data: z.array(Media),
|
|
125
|
+
meta: Pagination
|
|
126
|
+
});
|
|
127
|
+
var Session = z.looseObject({ user: User });
|
|
128
|
+
var SearchResponse = z.looseObject({ data: z.array(z.looseObject({
|
|
129
|
+
resource: z.string(),
|
|
130
|
+
items: z.array(Item),
|
|
131
|
+
total: z.number().int().nonnegative().optional()
|
|
132
|
+
})) });
|
|
133
|
+
var PreviewResponse = z.looseObject({
|
|
134
|
+
url: z.string(),
|
|
135
|
+
expiresAt: z.string().optional()
|
|
136
|
+
});
|
|
137
|
+
//#endregion
|
|
138
|
+
export { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, Item, ItemResponse, ListResponse, Media, MediaListResponse, MediaResponse, MediaTransform, Pagination, PreviewResponse, Problem, SearchResponse, Selection, Session };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Abilities, Id, RouteReference } from './common';\nimport { User } from './definition';\n\nexport const Item = z\n .looseObject({\n id: Id,\n version: z.string().nullable().meta({\n description: 'Changes on every update. `null` when the backend has no versions.',\n }),\n abilities: Abilities,\n })\n .meta({\n description: 'An item of a resource. Its other properties are the values of its fields.',\n });\n\nexport const Pagination = z.looseObject({\n page: z.number().int().positive(),\n perPage: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n lastPage: z.number().int().positive(),\n});\n\nexport const ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({ data: z.array(Item), meta: Pagination });\n\nexport const Problem = z\n .looseObject({\n type: z.string().meta({ description: 'A URI reference that identifies the problem type.' }),\n title: z.string(),\n status: z.number().int().min(400).max(599),\n detail: z.string().optional(),\n instance: z.string().optional(),\n errors: z\n .record(z.string(), z.array(z.string()))\n .optional()\n .meta({ description: '`422`: messages keyed by the dot path of the invalid value.' }),\n current: Item.optional().meta({ description: '`412`: the current version of the item.' }),\n })\n .meta({ description: 'An error, as RFC 9457 problem details (`application/problem+json`).' });\n\nexport const Selection = z.union([\n z.looseObject({ ids: z.array(Id).min(1) }),\n z.looseObject({\n query: z.looseObject({\n filter: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'The `filter` of the list query, by filter id: a value, a list of values, or the bounds of a range (`{ \"from\": \"2026-01-01\", \"to\": \"2026-01-31\" }`).',\n }),\n q: z.string().optional(),\n }),\n except: z.array(Id).optional(),\n }),\n]);\n\nexport const ActionRequest = z.looseObject({\n selection: Selection.optional().meta({\n description: 'Omitted for actions on the whole resource.',\n }),\n values: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const ActionItemResult = z.looseObject({\n id: Id,\n status: z.enum(['failed', 'skipped']),\n message: z.string().optional(),\n reason: z\n .string()\n .optional()\n .meta({ description: '`skipped`: `forbidden`, `not_found` or `unchanged`.' }),\n});\n\nexport const ActionResult = z.looseObject({\n message: z.string().optional(),\n summary: z\n .looseObject({\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n skipped: z.number().int().nonnegative(),\n })\n .optional(),\n results: z\n .array(ActionItemResult)\n .optional()\n .meta({ description: 'The items that did not succeed.' }),\n refresh: z.enum(['none', 'items', 'list']).optional(),\n redirect: z.union([z.string(), RouteReference]).nullable().optional(),\n download: z\n .looseObject({\n url: z.string(),\n filename: z.string().optional(),\n expiresAt: z.string().optional(),\n })\n .nullable()\n .optional(),\n});\n\nexport const ActionRun = z.looseObject({\n id: Id,\n action: z.string(),\n resource: z.string(),\n status: z.enum(['queued', 'running', 'succeeded', 'partial', 'failed', 'cancelled']),\n progress: z.number().int().nonnegative(),\n total: z.number().int().nonnegative().nullable(),\n result: ActionResult.optional().meta({ description: 'Set once the run has finished.' }),\n createdAt: z.string().optional(),\n finishedAt: z.string().nullable().optional(),\n});\n\nexport const ActionRunResponse = z.looseObject({ run: ActionRun });\n\nexport const MediaTransform = z.looseObject({\n crop: z\n .looseObject({ x: z.number(), y: z.number(), width: z.number(), height: z.number() })\n .optional()\n .meta({ description: 'In pixels of the original image.' }),\n rotate: z.union([z.literal(0), z.literal(90), z.literal(180), z.literal(270)]).optional(),\n flipX: z.boolean().optional(),\n flipY: z.boolean().optional(),\n focalPoint: z\n .looseObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) })\n .optional()\n .meta({ description: 'Relative to the width and height, from 0 to 1.' }),\n});\n\nexport const Media = Item.extend({\n type: z\n .string()\n .meta({ description: '`image`, `video`, `audio`, `document`, `font`, or another type.' }),\n name: z.string(),\n mime: z.string(),\n size: z.number().int().nonnegative(),\n url: z.string(),\n thumbnailUrl: z.string().nullable().optional(),\n variants: z\n .record(\n z.string(),\n z.looseObject({\n url: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n }),\n )\n .optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n transform: MediaTransform.nullable().optional(),\n tags: z.array(z.string()).optional(),\n});\n\nexport const MediaResponse = z.looseObject({ data: Media });\n\nexport const MediaListResponse = z.looseObject({ data: z.array(Media), meta: Pagination });\n\nexport const Session = z.looseObject({ user: User });\n\nexport const SearchResponse = z.looseObject({\n data: z.array(\n z.looseObject({\n resource: z.string(),\n items: z.array(Item),\n total: z.number().int().nonnegative().optional(),\n }),\n ),\n});\n\nexport const PreviewResponse = z.looseObject({ url: z.string(), expiresAt: z.string().optional() });\n\nexport type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type ListResponse = z.infer<typeof ListResponse>;\nexport type Problem = z.infer<typeof Problem>;\nexport type Selection = z.infer<typeof Selection>;\nexport type ActionRequest = z.infer<typeof ActionRequest>;\nexport type ActionItemResult = z.infer<typeof ActionItemResult>;\nexport type ActionResult = z.infer<typeof ActionResult>;\nexport type ActionRun = z.infer<typeof ActionRun>;\nexport type ActionRunResponse = z.infer<typeof ActionRunResponse>;\nexport type MediaTransform = z.infer<typeof MediaTransform>;\nexport type Media = z.infer<typeof Media>;\nexport type MediaResponse = z.infer<typeof MediaResponse>;\nexport type MediaListResponse = z.infer<typeof MediaListResponse>;\nexport type Session = z.infer<typeof Session>;\nexport type SearchResponse = z.infer<typeof SearchResponse>;\nexport type PreviewResponse = z.infer<typeof PreviewResponse>;\n"],"mappings":";;;;AAKA,IAAa,OAAO,EACf,YAAY;CACT,IAAI;CACJ,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aAAa,oEACjB,CAAC;CACD,WAAW;AACf,CAAC,CAAC,CACD,KAAK,EACF,aAAa,4EACjB,CAAC;AAEL,IAAa,aAAa,EAAE,YAAY;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CA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O;CAAG,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Definition } from './definition';
|
|
3
|
+
export declare const BootConfig: z.ZodObject<{
|
|
4
|
+
protocol: z.ZodLiteral<1>;
|
|
5
|
+
apiBaseUrl: z.ZodString;
|
|
6
|
+
basePath: z.ZodString;
|
|
7
|
+
locale: z.ZodString;
|
|
8
|
+
definition: z.ZodOptional<typeof Definition>;
|
|
9
|
+
loginUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
}, z.core.$loose>;
|
|
11
|
+
export type BootConfig = z.infer<typeof BootConfig>;
|
|
12
|
+
/** A boot config as a backend writes it, before defaults are applied. */
|
|
13
|
+
export type BootConfigInput = z.input<typeof BootConfig>;
|
|
14
|
+
//# sourceMappingURL=boot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/schemas/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,eAAO,MAAM,UAAU;;;;;gBAsBT,CAAC,CAAC,WAAW,CAAC,OAAO,UAAU,CAAC;;iBASxC,CAAC;AAEP,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../version.js";
|
|
2
|
+
import { Definition } from "./definition.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/schemas/boot.ts
|
|
5
|
+
var BootConfig = z.looseObject({
|
|
6
|
+
protocol: z.literal(1),
|
|
7
|
+
apiBaseUrl: z.string().min(1).meta({ description: "URL of the API (`/panneau/api`), where the app fetches `{apiBaseUrl}/definition`. A path or an absolute URL." }),
|
|
8
|
+
basePath: z.string().regex(/^\/([^/?#]+(\/[^/?#]+)*)?\/?$/, "A path that starts with `/`.").meta({ description: "Path of the app in the site (`/panneau`, or `/` on its own domain). Client routes are under it." }),
|
|
9
|
+
locale: z.string().min(2).meta({ description: "BCP 47 locale of the UI, used before the definition loads." }),
|
|
10
|
+
definition: Definition.optional().meta({ description: "The definition for the current user, inlined so the app skips the first `GET /definition`." }),
|
|
11
|
+
loginUrl: z.string().nullable().optional().meta({ description: "Where to send unauthenticated users when the API answers `401` before the definition is loaded. Afterwards, `auth.loginUrl` of the definition is used." })
|
|
12
|
+
}).meta({ description: "What a server writes in the page so the app can start, in the element `#panneau-boot`." });
|
|
13
|
+
//#endregion
|
|
14
|
+
export { BootConfig };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=boot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.js","names":[],"sources":["../../src/schemas/boot.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PROTOCOL_VERSION } from '../version';\nimport { Definition } from './definition';\n\nexport const BootConfig = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n apiBaseUrl: z.string().min(1).meta({\n description:\n 'URL of the API (`/panneau/api`), where the app fetches `{apiBaseUrl}/definition`. A path or an absolute URL.',\n }),\n basePath: z\n .string()\n .regex(/^\\/([^/?#]+(\\/[^/?#]+)*)?\\/?$/, 'A path that starts with `/`.')\n .meta({\n description:\n 'Path of the app in the site (`/panneau`, or `/` on its own domain). Client routes are under it.',\n }),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the UI, used before the definition loads.' }),\n // The type is written out so that declaration files reference the definition's schema.\n definition: Definition.optional().meta({\n description:\n 'The definition for the current user, inlined so the app skips the first `GET /definition`.',\n }) as z.ZodOptional<typeof Definition>,\n loginUrl: z.string().nullable().optional().meta({\n description:\n 'Where to send unauthenticated users when the API answers `401` before the definition is loaded. Afterwards, `auth.loginUrl` of the definition is used.',\n }),\n })\n .meta({\n description:\n 'What a server writes in the page so the app can start, in the element `#panneau-boot`.',\n });\n\nexport type BootConfig = z.infer<typeof BootConfig>;\n/** A boot config as a backend writes it, before defaults are applied. */\nexport type BootConfigInput = z.input<typeof BootConfig>;\n"],"mappings":";;;;AAKA,IAAa,aAAa,EACrB,YAAY;CACT,UAAU,EAAE,QAAA,CAAwB;CACpC,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAC/B,aACI,+GACR,CAAC;CACD,UAAU,EACL,OAAO,CAAC,CACR,MAAM,iCAAiC,8BAA8B,CAAC,CACtE,KAAK,EACF,aACI,kGACR,CAAC;CACL,QAAQ,EACH,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,KAAK,EAAE,aAAa,6DAA6D,CAAC;CAEvF,YAAY,WAAW,SAAS,CAAC,CAAC,KAAK,EACnC,aACI,6FACR,CAAC;CACD,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC5C,aACI,yJACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,yFACR,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Id: z.ZodString;
|
|
3
|
+
export declare const Abilities: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
4
|
+
export declare const RouteReference: z.ZodObject<{
|
|
5
|
+
route: z.ZodString;
|
|
6
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
7
|
+
}, z.core.$loose>;
|
|
8
|
+
export declare const Condition: z.ZodObject<{
|
|
9
|
+
field: z.ZodOptional<z.ZodString>;
|
|
10
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
11
|
+
in: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
12
|
+
notIn: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
13
|
+
filled: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
all: z.ZodOptional<z.ZodArray<typeof Condition>>;
|
|
15
|
+
any: z.ZodOptional<z.ZodArray<typeof Condition>>;
|
|
16
|
+
}, z.core.$loose>;
|
|
17
|
+
export declare const Option: z.ZodObject<{
|
|
18
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
}, z.core.$loose>;
|
|
23
|
+
export type Id = z.infer<typeof Id>;
|
|
24
|
+
export type Abilities = z.infer<typeof Abilities>;
|
|
25
|
+
export type RouteReference = z.infer<typeof RouteReference>;
|
|
26
|
+
export type Condition = z.infer<typeof Condition>;
|
|
27
|
+
export type Option = z.infer<typeof Option>;
|
|
28
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,EAAE,aAGsE,CAAC;AAEtF,eAAO,MAAM,SAAS,wCAGpB,CAAC;AAEH,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;SAQH,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;SAG3C,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;iBAOxD,CAAC;AAEP,eAAO,MAAM,MAAM;;;;;iBAKjB,CAAC;AAEH,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACpC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/schemas/common.ts
|
|
3
|
+
var Id = z.string().min(1).meta({ description: "Opaque identifier. Clients never parse or generate ids." });
|
|
4
|
+
var Abilities = z.record(z.string(), z.boolean()).meta({ description: "What the current user can do, keyed by ability (`viewAny`, `create`, `update`, `delete`, or an action id)." });
|
|
5
|
+
var RouteReference = z.looseObject({
|
|
6
|
+
route: z.string().min(1).meta({ description: "Name of a route in the definition." }),
|
|
7
|
+
params: z.record(z.string(), z.union([z.string(), z.number()])).optional()
|
|
8
|
+
});
|
|
9
|
+
var Condition = z.looseObject({
|
|
10
|
+
field: z.string().min(1).optional().meta({ description: "Field name, or a dot path." }),
|
|
11
|
+
equals: z.unknown().optional(),
|
|
12
|
+
in: z.array(z.unknown()).optional(),
|
|
13
|
+
notIn: z.array(z.unknown()).optional(),
|
|
14
|
+
filled: z.boolean().optional(),
|
|
15
|
+
get all() {
|
|
16
|
+
return z.array(Condition).optional();
|
|
17
|
+
},
|
|
18
|
+
get any() {
|
|
19
|
+
return z.array(Condition).optional();
|
|
20
|
+
}
|
|
21
|
+
}).meta({ description: "A condition on form values: compare one field (`equals`, `in`, `notIn`, `filled`), or combine conditions with `all` or `any`." });
|
|
22
|
+
var Option = z.looseObject({
|
|
23
|
+
value: z.union([
|
|
24
|
+
z.string(),
|
|
25
|
+
z.number(),
|
|
26
|
+
z.boolean()
|
|
27
|
+
]),
|
|
28
|
+
label: z.string(),
|
|
29
|
+
description: z.string().optional(),
|
|
30
|
+
disabled: z.boolean().optional()
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Abilities, Condition, Id, Option, RouteReference };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":[],"sources":["../../src/schemas/common.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const Id = z\n .string()\n .min(1)\n .meta({ description: 'Opaque identifier. Clients never parse or generate ids.' });\n\nexport const Abilities = z.record(z.string(), z.boolean()).meta({\n description:\n 'What the current user can do, keyed by ability (`viewAny`, `create`, `update`, `delete`, or an action id).',\n});\n\nexport const RouteReference = z.looseObject({\n route: z.string().min(1).meta({ description: 'Name of a route in the definition.' }),\n params: z.record(z.string(), z.union([z.string(), z.number()])).optional(),\n});\n\nexport const Condition = z\n .looseObject({\n field: z.string().min(1).optional().meta({ description: 'Field name, or a dot path.' }),\n equals: z.unknown().optional(),\n in: z.array(z.unknown()).optional(),\n notIn: z.array(z.unknown()).optional(),\n filled: z.boolean().optional(),\n // Return types are written out so that declaration files keep the recursion.\n get all(): z.ZodOptional<z.ZodArray<typeof Condition>> {\n return z.array(Condition).optional();\n },\n get any(): z.ZodOptional<z.ZodArray<typeof Condition>> {\n return z.array(Condition).optional();\n },\n })\n .meta({\n description:\n 'A condition on form values: compare one field (`equals`, `in`, `notIn`, `filled`), or combine conditions with `all` or `any`.',\n });\n\nexport const Option = z.looseObject({\n value: z.union([z.string(), z.number(), z.boolean()]),\n label: z.string(),\n description: z.string().optional(),\n disabled: z.boolean().optional(),\n});\n\nexport type Id = z.infer<typeof Id>;\nexport type Abilities = z.infer<typeof Abilities>;\nexport type RouteReference = z.infer<typeof RouteReference>;\nexport type Condition = z.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