@hadoku/platform-wire 0.1.50 → 0.1.51
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/events.d.ts +59 -4
- package/dist/events.js +20 -6
- package/package.json +2 -2
package/dist/events.d.ts
CHANGED
|
@@ -21,6 +21,35 @@ export declare const updateEventBodySchema: (titleMax: number) => z.ZodObject<{
|
|
|
21
21
|
title: z.ZodOptional<z.ZodString>;
|
|
22
22
|
startsAt: z.ZodISODateTime;
|
|
23
23
|
}, z.core.$strict>;
|
|
24
|
+
/**
|
|
25
|
+
* One person signed up for an event, as the calendar and the room draw them: their name and face now
|
|
26
|
+
* (a Rally respondent with no account, the name they typed and no face), and whether they are in the
|
|
27
|
+
* event's room.
|
|
28
|
+
*/
|
|
29
|
+
export declare const EventSignupSchema: z.ZodObject<{
|
|
30
|
+
avatarId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
look: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
32
|
+
picture: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
|
|
33
|
+
cosmetics: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
34
|
+
effect: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
35
|
+
gradient: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
36
|
+
font: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
37
|
+
overlay: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
38
|
+
message: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
39
|
+
placement: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
40
|
+
x: z.ZodNumber;
|
|
41
|
+
y: z.ZodNumber;
|
|
42
|
+
r: z.ZodNumber;
|
|
43
|
+
s: z.ZodNumber;
|
|
44
|
+
flip: z.ZodBoolean;
|
|
45
|
+
back: z.ZodBoolean;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
}, z.core.$strip>>>;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
inRoom: z.ZodCatch<z.ZodBoolean>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type EventSignup = z.infer<typeof EventSignupSchema>;
|
|
24
53
|
/** One event as `GET /api/events` sends it, scoped to the caller (`mine`): the game's `kind` and `room`. */
|
|
25
54
|
export declare const eventViewSchema: <K extends z.ZodType, R extends z.ZodType>(kind: K, room: R) => z.ZodObject<{
|
|
26
55
|
id: z.ZodString;
|
|
@@ -32,7 +61,29 @@ export declare const eventViewSchema: <K extends z.ZodType, R extends z.ZodType>
|
|
|
32
61
|
joined: z.ZodCatch<z.ZodBoolean>;
|
|
33
62
|
roomId: z.ZodCatch<z.ZodNullable<z.ZodString>>;
|
|
34
63
|
room: z.ZodOptional<z.ZodCatch<z.ZodNullable<R>>>;
|
|
35
|
-
|
|
64
|
+
signups: z.ZodCatch<z.ZodArray<z.ZodObject<{
|
|
65
|
+
avatarId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
66
|
+
look: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
67
|
+
picture: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
|
|
68
|
+
cosmetics: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
69
|
+
effect: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
70
|
+
gradient: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
71
|
+
font: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
72
|
+
overlay: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
73
|
+
message: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
74
|
+
placement: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
75
|
+
x: z.ZodNumber;
|
|
76
|
+
y: z.ZodNumber;
|
|
77
|
+
r: z.ZodNumber;
|
|
78
|
+
s: z.ZodNumber;
|
|
79
|
+
flip: z.ZodBoolean;
|
|
80
|
+
back: z.ZodBoolean;
|
|
81
|
+
}, z.core.$strip>>>;
|
|
82
|
+
}, z.core.$strip>>>;
|
|
83
|
+
}, z.core.$strip>>>;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
inRoom: z.ZodCatch<z.ZodBoolean>;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
36
87
|
}, z.core.$strip>;
|
|
37
88
|
export declare const eventListSchema: <V extends z.ZodType>(view: V) => z.ZodObject<{
|
|
38
89
|
events: z.ZodCatch<z.ZodArray<V>>;
|
|
@@ -69,7 +120,7 @@ export declare const RallyAvailabilitySchema: z.ZodObject<{
|
|
|
69
120
|
}, z.core.$strip>>;
|
|
70
121
|
}, z.core.$strip>;
|
|
71
122
|
export type RallyAvailability = z.infer<typeof RallyAvailabilitySchema>;
|
|
72
|
-
/** Rally's `GET /rally/api/forms/{id}/summary`, its `data`. `availability`
|
|
123
|
+
/** Rally's `GET /rally/api/forms/{id}/summary`, its `data`. `availability` and `respondents` come to a service caller only. */
|
|
73
124
|
export declare const RallyFormSummarySchema: z.ZodObject<{
|
|
74
125
|
id: z.ZodString;
|
|
75
126
|
title: z.ZodString;
|
|
@@ -98,6 +149,10 @@ export declare const RallyFormSummarySchema: z.ZodObject<{
|
|
|
98
149
|
pick: z.ZodNullable<z.ZodString>;
|
|
99
150
|
}, z.core.$strip>>;
|
|
100
151
|
}, z.core.$strip>>>;
|
|
152
|
+
respondents: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>>>>;
|
|
101
156
|
}, z.core.$strip>;
|
|
102
157
|
export type RallyFormSummary = z.infer<typeof RallyFormSummarySchema>;
|
|
103
158
|
/** Whether a form makes the promise an event form needs. */
|
|
@@ -109,6 +164,7 @@ export declare const AttachFormBodySchema: z.ZodObject<{
|
|
|
109
164
|
export type AttachFormBody = z.output<typeof AttachFormBodySchema>;
|
|
110
165
|
/** An attached form as `GET /api/events/forms` and `POST /api/events/forms` send it: Rally's summary, and who attached it. */
|
|
111
166
|
export declare const AttachedFormSchema: z.ZodObject<{
|
|
167
|
+
url: z.ZodString;
|
|
112
168
|
id: z.ZodString;
|
|
113
169
|
title: z.ZodString;
|
|
114
170
|
status: z.ZodEnum<{
|
|
@@ -116,7 +172,6 @@ export declare const AttachedFormSchema: z.ZodObject<{
|
|
|
116
172
|
closed: "closed";
|
|
117
173
|
}>;
|
|
118
174
|
closesAt: z.ZodNullable<z.ZodString>;
|
|
119
|
-
url: z.ZodString;
|
|
120
175
|
createdBy: z.ZodNullable<z.ZodString>;
|
|
121
176
|
createdById: z.ZodOptional<z.ZodString>;
|
|
122
177
|
schema: z.ZodObject<{
|
|
@@ -135,6 +190,7 @@ export declare const AttachedFormSchema: z.ZodObject<{
|
|
|
135
190
|
export type AttachedForm = z.infer<typeof AttachedFormSchema>;
|
|
136
191
|
export declare const FormListSchema: z.ZodObject<{
|
|
137
192
|
forms: z.ZodCatch<z.ZodArray<z.ZodObject<{
|
|
193
|
+
url: z.ZodString;
|
|
138
194
|
id: z.ZodString;
|
|
139
195
|
title: z.ZodString;
|
|
140
196
|
status: z.ZodEnum<{
|
|
@@ -142,7 +198,6 @@ export declare const FormListSchema: z.ZodObject<{
|
|
|
142
198
|
closed: "closed";
|
|
143
199
|
}>;
|
|
144
200
|
closesAt: z.ZodNullable<z.ZodString>;
|
|
145
|
-
url: z.ZodString;
|
|
146
201
|
createdBy: z.ZodNullable<z.ZodString>;
|
|
147
202
|
createdById: z.ZodOptional<z.ZodString>;
|
|
148
203
|
schema: z.ZodObject<{
|
package/dist/events.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* is a Rally form on schema `event-signup@1`, listed while Rally says it is open (#22).
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
+
import { PersonFaceSchema } from "./look.js";
|
|
8
9
|
// eslint-disable-next-line no-control-regex
|
|
9
10
|
const CONTROL = /[\u0000-\u001f\u007f]/;
|
|
10
11
|
/** An event's title, which is its room's name: 1 to `max` characters, no control characters. */
|
|
@@ -35,6 +36,15 @@ export const strictBody = (shape) => z.strictObject(shape, {
|
|
|
35
36
|
* still saves.
|
|
36
37
|
*/
|
|
37
38
|
export const updateEventBodySchema = (titleMax) => strictBody({ title: eventTitleSchema(titleMax).optional(), startsAt: StartsAtSchema });
|
|
39
|
+
/**
|
|
40
|
+
* One person signed up for an event, as the calendar and the room draw them: their name and face now
|
|
41
|
+
* (a Rally respondent with no account, the name they typed and no face), and whether they are in the
|
|
42
|
+
* event's room.
|
|
43
|
+
*/
|
|
44
|
+
export const EventSignupSchema = PersonFaceSchema.extend({
|
|
45
|
+
name: z.string(),
|
|
46
|
+
inRoom: z.boolean().catch(false),
|
|
47
|
+
});
|
|
38
48
|
/** One event as `GET /api/events` sends it, scoped to the caller (`mine`): the game's `kind` and `room`. */
|
|
39
49
|
export const eventViewSchema = (kind, room) => z.object({
|
|
40
50
|
id: z.string(),
|
|
@@ -53,11 +63,10 @@ export const eventViewSchema = (kind, room) => z.object({
|
|
|
53
63
|
/** The room as it is now. Always sent; optional only so a reader's fixture may leave it out. */
|
|
54
64
|
room: room.nullable().catch(null).optional(),
|
|
55
65
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* cannot say.
|
|
66
|
+
* Who has signed up: everyone who submitted the event's Rally form and everyone in its room,
|
|
67
|
+
* once each by account. Its length is the event's sign-up count.
|
|
59
68
|
*/
|
|
60
|
-
|
|
69
|
+
signups: z.array(EventSignupSchema).catch([]),
|
|
61
70
|
});
|
|
62
71
|
export const eventListSchema = (view) => z.object({ events: z.array(view).catch([]) });
|
|
63
72
|
/* ── Rally forms ─────────────────────────────────────────────────────── */
|
|
@@ -80,7 +89,7 @@ export const RallyAvailabilitySchema = z.object({
|
|
|
80
89
|
starts: z.array(z.object({ at: z.string(), free: z.number().int().min(0) })),
|
|
81
90
|
best: z.array(RallyWindowSchema),
|
|
82
91
|
});
|
|
83
|
-
/** Rally's `GET /rally/api/forms/{id}/summary`, its `data`. `availability`
|
|
92
|
+
/** Rally's `GET /rally/api/forms/{id}/summary`, its `data`. `availability` and `respondents` come to a service caller only. */
|
|
84
93
|
export const RallyFormSummarySchema = z.object({
|
|
85
94
|
id: z.string(),
|
|
86
95
|
title: z.string(),
|
|
@@ -92,6 +101,11 @@ export const RallyFormSummarySchema = z.object({
|
|
|
92
101
|
createdById: z.string().optional(),
|
|
93
102
|
schema: z.object({ name: z.string(), version: z.number().int() }),
|
|
94
103
|
availability: RallyAvailabilitySchema.optional().catch(undefined),
|
|
104
|
+
/** Service callers only: who submitted a response, earliest first, by the name they gave and their userId (null for an anonymous one). */
|
|
105
|
+
respondents: z
|
|
106
|
+
.array(z.object({ name: z.string(), userId: z.string().nullable() }))
|
|
107
|
+
.optional()
|
|
108
|
+
.catch(undefined),
|
|
95
109
|
});
|
|
96
110
|
/** Whether a form makes the promise an event form needs. */
|
|
97
111
|
export function isEventSignupForm(summary) {
|
|
@@ -100,7 +114,7 @@ export function isEventSignupForm(summary) {
|
|
|
100
114
|
/** `POST /api/events/forms`: attach a Rally form, checked through its summary. */
|
|
101
115
|
export const AttachFormBodySchema = strictBody({ formId: RallyFormIdSchema });
|
|
102
116
|
/** An attached form as `GET /api/events/forms` and `POST /api/events/forms` send it: Rally's summary, and who attached it. */
|
|
103
|
-
export const AttachedFormSchema = RallyFormSummarySchema.omit({ availability: true }).extend({
|
|
117
|
+
export const AttachedFormSchema = RallyFormSummarySchema.omit({ availability: true, respondents: true }).extend({
|
|
104
118
|
attachedBy: z.string(),
|
|
105
119
|
/** Whether the caller attached it: only they may detach it, or make an event from it. */
|
|
106
120
|
mine: z.boolean().catch(false),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/platform-wire",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.51",
|
|
4
|
+
"gitHead": "afb568b441f3bcca3e4ab5bbdd860a0cbfc9ca15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The wire any game speaks: room ids, telemetry, presence, events and tables, the Discord relay, looks, the restart notice, secure random and a generic server envelope. Knows no game; a game's own part rides as a type parameter. MIT; imports only zod.",
|