@composable-os/pack-dailychecks 0.0.0-stage → 0.1.0-beta.12
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/LICENSE +109 -0
- package/dist/blocks/dailychecks-history/history.d.ts +8 -0
- package/dist/blocks/dailychecks-history/history.js +38 -0
- package/dist/blocks/dailychecks-native-today/today-screen.d.ts +6 -0
- package/dist/blocks/dailychecks-native-today/today-screen.js +92 -0
- package/dist/blocks/dailychecks-today/today.d.ts +6 -0
- package/dist/blocks/dailychecks-today/today.js +113 -0
- package/dist/client/index.d.ts +734 -0
- package/dist/client/index.js +185 -0
- package/dist/index.d.ts +350 -0
- package/dist/index.js +64 -0
- package/dist/tools.d.ts +314 -0
- package/dist/tools.js +199 -0
- package/package.json +36 -4
- package/README.md +0 -3
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
import { type ClientHolding, forgetAfter, type PackClient, type UseMutation, type UseQuery } from "@composable-os/client";
|
|
2
|
+
import type { z } from "@composable-os/sdk";
|
|
3
|
+
import type { checklistDay, done, history, tickStep, today } from "../tools.ts";
|
|
4
|
+
export { forgetAfter };
|
|
5
|
+
type Io<T extends {
|
|
6
|
+
input: z.ZodType;
|
|
7
|
+
output: z.ZodType;
|
|
8
|
+
}> = {
|
|
9
|
+
input: z.input<T["input"]>;
|
|
10
|
+
output: z.output<T["output"]>;
|
|
11
|
+
};
|
|
12
|
+
/** The operations this entry calls, as the generated client types them. */
|
|
13
|
+
export type DailyChecksOperations = {
|
|
14
|
+
"x.dailychecks.today": {
|
|
15
|
+
kind: "query";
|
|
16
|
+
} & Io<typeof today>;
|
|
17
|
+
"x.dailychecks.day": {
|
|
18
|
+
kind: "query";
|
|
19
|
+
} & Io<typeof checklistDay>;
|
|
20
|
+
"x.dailychecks.tick": {
|
|
21
|
+
kind: "mutation";
|
|
22
|
+
} & Io<typeof tickStep>;
|
|
23
|
+
"x.dailychecks.done": {
|
|
24
|
+
kind: "mutation";
|
|
25
|
+
} & Io<typeof done>;
|
|
26
|
+
"x.dailychecks.history": {
|
|
27
|
+
kind: "query";
|
|
28
|
+
} & Io<typeof history>;
|
|
29
|
+
};
|
|
30
|
+
type Name = keyof DailyChecksOperations & string;
|
|
31
|
+
type In<N extends Name> = DailyChecksOperations[N]["input"];
|
|
32
|
+
type Out<N extends Name> = DailyChecksOperations[N]["output"];
|
|
33
|
+
export type Today = Out<"x.dailychecks.today">;
|
|
34
|
+
export type DayItem = Today["items"][number];
|
|
35
|
+
export type DayRun = NonNullable<DayItem["run"]>;
|
|
36
|
+
export type DayStep = DayRun["steps"][number];
|
|
37
|
+
export type DayTick = NonNullable<DayStep["tick"]>;
|
|
38
|
+
export type DayDetail = Out<"x.dailychecks.day">;
|
|
39
|
+
export type TickInput = In<"x.dailychecks.tick">;
|
|
40
|
+
export type History = Out<"x.dailychecks.history">;
|
|
41
|
+
export type HistoryDay = History["days"][number];
|
|
42
|
+
/** The client of every operation this entry calls (ADR 0453). */
|
|
43
|
+
export type DailyChecksClient = PackClient<DailyChecksOperations>;
|
|
44
|
+
/** A day's state as a person reads it. */
|
|
45
|
+
export declare function dayStateLabel(state: DayItem["state"] | HistoryDay["state"]): string;
|
|
46
|
+
/** A step's tick as every screen shows it: what was ticked, by whom and for whom. */
|
|
47
|
+
export declare function tickLabel(tick: DayTick): string;
|
|
48
|
+
/** A time of day in the business's zone. */
|
|
49
|
+
export declare function timeIn(iso: string, zone: string, locale?: string): string;
|
|
50
|
+
/** A `YYYY-MM-DD` date as a person reads it (a calendar date: no zone). */
|
|
51
|
+
export declare function dateLabel(date: string, locale?: string): string;
|
|
52
|
+
/** A `YYYY-MM-DD` date `days` later (or earlier). */
|
|
53
|
+
export declare function addDays(date: string, days: number): string;
|
|
54
|
+
/** The steps a day shows: its run's, or its preview before the run is made. */
|
|
55
|
+
export declare function stepsOf(item: DayItem): {
|
|
56
|
+
position: number;
|
|
57
|
+
text: string;
|
|
58
|
+
required: boolean;
|
|
59
|
+
asksNote: boolean;
|
|
60
|
+
tick: DayTick | null;
|
|
61
|
+
history: DayStep["history"];
|
|
62
|
+
missed: boolean;
|
|
63
|
+
}[];
|
|
64
|
+
/** How a finished day reads: who finished it, for whom, and when. */
|
|
65
|
+
export declare function finishedLabel(item: DayItem, locale?: string, zone?: string): string | null;
|
|
66
|
+
/** The rules a refusal of the day's checklists names, each with its own designed state. */
|
|
67
|
+
declare const HOST_RULES: readonly ["checklist_window", "checklist_closed", "checklist_not_your_tick", "checklist_nothing_to_clear", "checklist_too_many_ticks", "checklist_for_why", "checklist_for_whom", "checklist_for_someone", "checklist_not_theirs", "checklist_note_needed", "checklist_why", "checklist_incomplete", "checklists_manage", "human_only"];
|
|
68
|
+
export type DayRefusalKind = (typeof HOST_RULES)[number] | "forbidden" | "not_found" | "invalid" | "network" | "other";
|
|
69
|
+
export interface DayRefusal {
|
|
70
|
+
kind: DayRefusalKind;
|
|
71
|
+
/** The host's words, or ours for a network failure or a refusal with none. */
|
|
72
|
+
message: string;
|
|
73
|
+
}
|
|
74
|
+
/** What the host's refusal was, for the screen's designed state. */
|
|
75
|
+
export declare function dayRefusal(error: unknown): DayRefusal;
|
|
76
|
+
export type { UseMutation, UseQuery } from "@composable-os/client";
|
|
77
|
+
/**
|
|
78
|
+
* The operations each hook calls (ADR 0453). Every staff client and every role client holds the
|
|
79
|
+
* first four (the tools are every staff account's, ADR 0652); `useHistory` is for those who
|
|
80
|
+
* manage checklists (the host refuses anyone else).
|
|
81
|
+
*/
|
|
82
|
+
export declare const DAILYCHECKS_HOOKS_CALL: {
|
|
83
|
+
readonly useToday: readonly ["x.dailychecks.today"];
|
|
84
|
+
readonly useDay: readonly ["x.dailychecks.day"];
|
|
85
|
+
readonly useTick: readonly ["x.dailychecks.tick"];
|
|
86
|
+
readonly useDone: readonly ["x.dailychecks.done"];
|
|
87
|
+
readonly useHistory: readonly ["x.dailychecks.history"];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Hooks for a React or React Native app:
|
|
91
|
+
* `const dailychecks = createDailyChecksHooks({ useQuery, useMutation }, api)`. `api` is the client
|
|
92
|
+
* the screen's user holds: a role client (a cleaner's, a coach's) or the staff client. The hooks it
|
|
93
|
+
* cannot back are not there.
|
|
94
|
+
*/
|
|
95
|
+
export declare function createDailyChecksHooks<C extends ClientHolding>(react: {
|
|
96
|
+
useQuery: UseQuery;
|
|
97
|
+
useMutation: UseMutation;
|
|
98
|
+
}, client: C): import("@composable-os/client").HooksFor<{
|
|
99
|
+
/** Today's checklists I may do (every one, if I manage checklists): on screen only. */
|
|
100
|
+
useToday(enabled?: boolean): {
|
|
101
|
+
data: {
|
|
102
|
+
zone: string;
|
|
103
|
+
date: string;
|
|
104
|
+
items: {
|
|
105
|
+
template: {
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
purpose: string | null;
|
|
109
|
+
};
|
|
110
|
+
date: string;
|
|
111
|
+
who: {
|
|
112
|
+
kind: "staff" | "role" | "grant";
|
|
113
|
+
value: string | null;
|
|
114
|
+
};
|
|
115
|
+
dueBy: string | null;
|
|
116
|
+
dueAt: string | null;
|
|
117
|
+
opens: string;
|
|
118
|
+
closes: string;
|
|
119
|
+
state: "not_started" | "open" | "done" | "missed";
|
|
120
|
+
late: boolean;
|
|
121
|
+
run: {
|
|
122
|
+
id: string;
|
|
123
|
+
object: string;
|
|
124
|
+
record: string;
|
|
125
|
+
template: {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
version: number;
|
|
129
|
+
};
|
|
130
|
+
state: "open" | "done" | "missed" | "cancelled";
|
|
131
|
+
account: string | null;
|
|
132
|
+
name: string | null;
|
|
133
|
+
opens: string;
|
|
134
|
+
closes: string;
|
|
135
|
+
tickUntil: string;
|
|
136
|
+
madeAt: string;
|
|
137
|
+
closedAt: string | null;
|
|
138
|
+
closedBy: string | null;
|
|
139
|
+
closedByName: string | null;
|
|
140
|
+
closedWhy: string | null;
|
|
141
|
+
steps: {
|
|
142
|
+
position: number;
|
|
143
|
+
text: string;
|
|
144
|
+
required: boolean;
|
|
145
|
+
asksNote: boolean;
|
|
146
|
+
tick: {
|
|
147
|
+
id: string;
|
|
148
|
+
state: "done" | "not_done" | "cleared";
|
|
149
|
+
done: boolean;
|
|
150
|
+
why: string | null;
|
|
151
|
+
note: string | null;
|
|
152
|
+
onBehalfWhy: string | null;
|
|
153
|
+
withheld: boolean;
|
|
154
|
+
by: string;
|
|
155
|
+
byName: string;
|
|
156
|
+
for: string;
|
|
157
|
+
forName: string;
|
|
158
|
+
onBehalf: boolean;
|
|
159
|
+
at: string;
|
|
160
|
+
label: string;
|
|
161
|
+
} | null;
|
|
162
|
+
history: {
|
|
163
|
+
id: string;
|
|
164
|
+
state: "done" | "not_done" | "cleared";
|
|
165
|
+
done: boolean;
|
|
166
|
+
why: string | null;
|
|
167
|
+
note: string | null;
|
|
168
|
+
onBehalfWhy: string | null;
|
|
169
|
+
withheld: boolean;
|
|
170
|
+
by: string;
|
|
171
|
+
byName: string;
|
|
172
|
+
for: string;
|
|
173
|
+
forName: string;
|
|
174
|
+
onBehalf: boolean;
|
|
175
|
+
at: string;
|
|
176
|
+
label: string;
|
|
177
|
+
}[];
|
|
178
|
+
historyTruncated: boolean;
|
|
179
|
+
missed: boolean;
|
|
180
|
+
}[];
|
|
181
|
+
corrections: {
|
|
182
|
+
id: string;
|
|
183
|
+
text: string;
|
|
184
|
+
by: string;
|
|
185
|
+
byName: string;
|
|
186
|
+
at: string;
|
|
187
|
+
}[];
|
|
188
|
+
} | null;
|
|
189
|
+
preview: {
|
|
190
|
+
text: string;
|
|
191
|
+
required: boolean;
|
|
192
|
+
asksNote: boolean;
|
|
193
|
+
}[] | null;
|
|
194
|
+
mayDo: boolean;
|
|
195
|
+
canTick: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
you: string;
|
|
198
|
+
youManage: boolean;
|
|
199
|
+
} | undefined;
|
|
200
|
+
isPending: boolean;
|
|
201
|
+
error: unknown;
|
|
202
|
+
refetch?: () => unknown;
|
|
203
|
+
};
|
|
204
|
+
/** One checklist on one day (any day, for someone who manages checklists): on screen only. */
|
|
205
|
+
useDay(input: In<"x.dailychecks.day"> | null): {
|
|
206
|
+
data: {
|
|
207
|
+
item: {
|
|
208
|
+
template: {
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
purpose: string | null;
|
|
212
|
+
};
|
|
213
|
+
date: string;
|
|
214
|
+
who: {
|
|
215
|
+
kind: "staff" | "role" | "grant";
|
|
216
|
+
value: string | null;
|
|
217
|
+
};
|
|
218
|
+
dueBy: string | null;
|
|
219
|
+
dueAt: string | null;
|
|
220
|
+
opens: string;
|
|
221
|
+
closes: string;
|
|
222
|
+
state: "not_started" | "open" | "done" | "missed";
|
|
223
|
+
late: boolean;
|
|
224
|
+
run: {
|
|
225
|
+
id: string;
|
|
226
|
+
object: string;
|
|
227
|
+
record: string;
|
|
228
|
+
template: {
|
|
229
|
+
id: string;
|
|
230
|
+
name: string;
|
|
231
|
+
version: number;
|
|
232
|
+
};
|
|
233
|
+
state: "open" | "done" | "missed" | "cancelled";
|
|
234
|
+
account: string | null;
|
|
235
|
+
name: string | null;
|
|
236
|
+
opens: string;
|
|
237
|
+
closes: string;
|
|
238
|
+
tickUntil: string;
|
|
239
|
+
madeAt: string;
|
|
240
|
+
closedAt: string | null;
|
|
241
|
+
closedBy: string | null;
|
|
242
|
+
closedByName: string | null;
|
|
243
|
+
closedWhy: string | null;
|
|
244
|
+
steps: {
|
|
245
|
+
position: number;
|
|
246
|
+
text: string;
|
|
247
|
+
required: boolean;
|
|
248
|
+
asksNote: boolean;
|
|
249
|
+
tick: {
|
|
250
|
+
id: string;
|
|
251
|
+
state: "done" | "not_done" | "cleared";
|
|
252
|
+
done: boolean;
|
|
253
|
+
why: string | null;
|
|
254
|
+
note: string | null;
|
|
255
|
+
onBehalfWhy: string | null;
|
|
256
|
+
withheld: boolean;
|
|
257
|
+
by: string;
|
|
258
|
+
byName: string;
|
|
259
|
+
for: string;
|
|
260
|
+
forName: string;
|
|
261
|
+
onBehalf: boolean;
|
|
262
|
+
at: string;
|
|
263
|
+
label: string;
|
|
264
|
+
} | null;
|
|
265
|
+
history: {
|
|
266
|
+
id: string;
|
|
267
|
+
state: "done" | "not_done" | "cleared";
|
|
268
|
+
done: boolean;
|
|
269
|
+
why: string | null;
|
|
270
|
+
note: string | null;
|
|
271
|
+
onBehalfWhy: string | null;
|
|
272
|
+
withheld: boolean;
|
|
273
|
+
by: string;
|
|
274
|
+
byName: string;
|
|
275
|
+
for: string;
|
|
276
|
+
forName: string;
|
|
277
|
+
onBehalf: boolean;
|
|
278
|
+
at: string;
|
|
279
|
+
label: string;
|
|
280
|
+
}[];
|
|
281
|
+
historyTruncated: boolean;
|
|
282
|
+
missed: boolean;
|
|
283
|
+
}[];
|
|
284
|
+
corrections: {
|
|
285
|
+
id: string;
|
|
286
|
+
text: string;
|
|
287
|
+
by: string;
|
|
288
|
+
byName: string;
|
|
289
|
+
at: string;
|
|
290
|
+
}[];
|
|
291
|
+
} | null;
|
|
292
|
+
preview: {
|
|
293
|
+
text: string;
|
|
294
|
+
required: boolean;
|
|
295
|
+
asksNote: boolean;
|
|
296
|
+
}[] | null;
|
|
297
|
+
mayDo: boolean;
|
|
298
|
+
canTick: boolean;
|
|
299
|
+
};
|
|
300
|
+
zone: string;
|
|
301
|
+
doers: {
|
|
302
|
+
id: string;
|
|
303
|
+
name: string;
|
|
304
|
+
}[] | null;
|
|
305
|
+
you: string;
|
|
306
|
+
youManage: boolean;
|
|
307
|
+
} | undefined;
|
|
308
|
+
isPending: boolean;
|
|
309
|
+
error: unknown;
|
|
310
|
+
refetch?: () => unknown;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Tick a step (a person's own act). What is written on it is forgotten once the call is over:
|
|
314
|
+
* call it through `forgetAfter`.
|
|
315
|
+
*/
|
|
316
|
+
useTick(): {
|
|
317
|
+
mutate(input: {
|
|
318
|
+
step: number;
|
|
319
|
+
state: "done" | "not_done" | "clear";
|
|
320
|
+
template: string;
|
|
321
|
+
date: string;
|
|
322
|
+
for?: string | undefined;
|
|
323
|
+
forWhy?: string | undefined;
|
|
324
|
+
note?: string | undefined;
|
|
325
|
+
why?: string | undefined;
|
|
326
|
+
}): void;
|
|
327
|
+
mutateAsync(input: {
|
|
328
|
+
step: number;
|
|
329
|
+
state: "done" | "not_done" | "clear";
|
|
330
|
+
template: string;
|
|
331
|
+
date: string;
|
|
332
|
+
for?: string | undefined;
|
|
333
|
+
forWhy?: string | undefined;
|
|
334
|
+
note?: string | undefined;
|
|
335
|
+
why?: string | undefined;
|
|
336
|
+
}): Promise<{
|
|
337
|
+
run: string;
|
|
338
|
+
step: number;
|
|
339
|
+
state: "done" | "not_done" | "clear";
|
|
340
|
+
ticked: number;
|
|
341
|
+
of: number;
|
|
342
|
+
finished: boolean;
|
|
343
|
+
}>;
|
|
344
|
+
data: {
|
|
345
|
+
run: string;
|
|
346
|
+
step: number;
|
|
347
|
+
state: "done" | "not_done" | "clear";
|
|
348
|
+
ticked: number;
|
|
349
|
+
of: number;
|
|
350
|
+
finished: boolean;
|
|
351
|
+
} | undefined;
|
|
352
|
+
isPending: boolean;
|
|
353
|
+
error: unknown;
|
|
354
|
+
reset?: () => void;
|
|
355
|
+
};
|
|
356
|
+
/** Finish it with optional steps left: final. */
|
|
357
|
+
useDone(): {
|
|
358
|
+
mutate(input: {
|
|
359
|
+
template: string;
|
|
360
|
+
date: string;
|
|
361
|
+
for?: string | undefined;
|
|
362
|
+
forWhy?: string | undefined;
|
|
363
|
+
}): void;
|
|
364
|
+
mutateAsync(input: {
|
|
365
|
+
template: string;
|
|
366
|
+
date: string;
|
|
367
|
+
for?: string | undefined;
|
|
368
|
+
forWhy?: string | undefined;
|
|
369
|
+
}): Promise<{
|
|
370
|
+
run: string;
|
|
371
|
+
state: "done";
|
|
372
|
+
}>;
|
|
373
|
+
data: {
|
|
374
|
+
run: string;
|
|
375
|
+
state: "done";
|
|
376
|
+
} | undefined;
|
|
377
|
+
isPending: boolean;
|
|
378
|
+
error: unknown;
|
|
379
|
+
reset?: () => void;
|
|
380
|
+
};
|
|
381
|
+
/** How each day went (those who manage checklists): on screen only. */
|
|
382
|
+
useHistory(input: In<"x.dailychecks.history"> | null): {
|
|
383
|
+
data: {
|
|
384
|
+
zone: string;
|
|
385
|
+
days: {
|
|
386
|
+
run: string;
|
|
387
|
+
template: {
|
|
388
|
+
id: string;
|
|
389
|
+
name: string;
|
|
390
|
+
};
|
|
391
|
+
date: string;
|
|
392
|
+
state: "open" | "done" | "missed";
|
|
393
|
+
dueAt: string | null;
|
|
394
|
+
late: boolean;
|
|
395
|
+
finishedAt: string | null;
|
|
396
|
+
finishedBy: string | null;
|
|
397
|
+
finishedFor: string | null;
|
|
398
|
+
steps: number;
|
|
399
|
+
ticked: number;
|
|
400
|
+
notDone: number;
|
|
401
|
+
onBehalf: number;
|
|
402
|
+
missed: string[];
|
|
403
|
+
}[];
|
|
404
|
+
truncated: boolean;
|
|
405
|
+
} | undefined;
|
|
406
|
+
isPending: boolean;
|
|
407
|
+
error: unknown;
|
|
408
|
+
refetch?: () => unknown;
|
|
409
|
+
};
|
|
410
|
+
}, {
|
|
411
|
+
readonly useToday: readonly ["x.dailychecks.today"];
|
|
412
|
+
readonly useDay: readonly ["x.dailychecks.day"];
|
|
413
|
+
readonly useTick: readonly ["x.dailychecks.tick"];
|
|
414
|
+
readonly useDone: readonly ["x.dailychecks.done"];
|
|
415
|
+
readonly useHistory: readonly ["x.dailychecks.history"];
|
|
416
|
+
}, import("@composable-os/client").OperationsOf<C>>;
|
|
417
|
+
declare function allDailyChecksHooks(react: {
|
|
418
|
+
useQuery: UseQuery;
|
|
419
|
+
useMutation: UseMutation;
|
|
420
|
+
}, api: DailyChecksClient): {
|
|
421
|
+
/** Today's checklists I may do (every one, if I manage checklists): on screen only. */
|
|
422
|
+
useToday(enabled?: boolean): {
|
|
423
|
+
data: {
|
|
424
|
+
zone: string;
|
|
425
|
+
date: string;
|
|
426
|
+
items: {
|
|
427
|
+
template: {
|
|
428
|
+
id: string;
|
|
429
|
+
name: string;
|
|
430
|
+
purpose: string | null;
|
|
431
|
+
};
|
|
432
|
+
date: string;
|
|
433
|
+
who: {
|
|
434
|
+
kind: "staff" | "role" | "grant";
|
|
435
|
+
value: string | null;
|
|
436
|
+
};
|
|
437
|
+
dueBy: string | null;
|
|
438
|
+
dueAt: string | null;
|
|
439
|
+
opens: string;
|
|
440
|
+
closes: string;
|
|
441
|
+
state: "not_started" | "open" | "done" | "missed";
|
|
442
|
+
late: boolean;
|
|
443
|
+
run: {
|
|
444
|
+
id: string;
|
|
445
|
+
object: string;
|
|
446
|
+
record: string;
|
|
447
|
+
template: {
|
|
448
|
+
id: string;
|
|
449
|
+
name: string;
|
|
450
|
+
version: number;
|
|
451
|
+
};
|
|
452
|
+
state: "open" | "done" | "missed" | "cancelled";
|
|
453
|
+
account: string | null;
|
|
454
|
+
name: string | null;
|
|
455
|
+
opens: string;
|
|
456
|
+
closes: string;
|
|
457
|
+
tickUntil: string;
|
|
458
|
+
madeAt: string;
|
|
459
|
+
closedAt: string | null;
|
|
460
|
+
closedBy: string | null;
|
|
461
|
+
closedByName: string | null;
|
|
462
|
+
closedWhy: string | null;
|
|
463
|
+
steps: {
|
|
464
|
+
position: number;
|
|
465
|
+
text: string;
|
|
466
|
+
required: boolean;
|
|
467
|
+
asksNote: boolean;
|
|
468
|
+
tick: {
|
|
469
|
+
id: string;
|
|
470
|
+
state: "done" | "not_done" | "cleared";
|
|
471
|
+
done: boolean;
|
|
472
|
+
why: string | null;
|
|
473
|
+
note: string | null;
|
|
474
|
+
onBehalfWhy: string | null;
|
|
475
|
+
withheld: boolean;
|
|
476
|
+
by: string;
|
|
477
|
+
byName: string;
|
|
478
|
+
for: string;
|
|
479
|
+
forName: string;
|
|
480
|
+
onBehalf: boolean;
|
|
481
|
+
at: string;
|
|
482
|
+
label: string;
|
|
483
|
+
} | null;
|
|
484
|
+
history: {
|
|
485
|
+
id: string;
|
|
486
|
+
state: "done" | "not_done" | "cleared";
|
|
487
|
+
done: boolean;
|
|
488
|
+
why: string | null;
|
|
489
|
+
note: string | null;
|
|
490
|
+
onBehalfWhy: string | null;
|
|
491
|
+
withheld: boolean;
|
|
492
|
+
by: string;
|
|
493
|
+
byName: string;
|
|
494
|
+
for: string;
|
|
495
|
+
forName: string;
|
|
496
|
+
onBehalf: boolean;
|
|
497
|
+
at: string;
|
|
498
|
+
label: string;
|
|
499
|
+
}[];
|
|
500
|
+
historyTruncated: boolean;
|
|
501
|
+
missed: boolean;
|
|
502
|
+
}[];
|
|
503
|
+
corrections: {
|
|
504
|
+
id: string;
|
|
505
|
+
text: string;
|
|
506
|
+
by: string;
|
|
507
|
+
byName: string;
|
|
508
|
+
at: string;
|
|
509
|
+
}[];
|
|
510
|
+
} | null;
|
|
511
|
+
preview: {
|
|
512
|
+
text: string;
|
|
513
|
+
required: boolean;
|
|
514
|
+
asksNote: boolean;
|
|
515
|
+
}[] | null;
|
|
516
|
+
mayDo: boolean;
|
|
517
|
+
canTick: boolean;
|
|
518
|
+
}[];
|
|
519
|
+
you: string;
|
|
520
|
+
youManage: boolean;
|
|
521
|
+
} | undefined;
|
|
522
|
+
isPending: boolean;
|
|
523
|
+
error: unknown;
|
|
524
|
+
refetch?: () => unknown;
|
|
525
|
+
};
|
|
526
|
+
/** One checklist on one day (any day, for someone who manages checklists): on screen only. */
|
|
527
|
+
useDay(input: In<"x.dailychecks.day"> | null): {
|
|
528
|
+
data: {
|
|
529
|
+
item: {
|
|
530
|
+
template: {
|
|
531
|
+
id: string;
|
|
532
|
+
name: string;
|
|
533
|
+
purpose: string | null;
|
|
534
|
+
};
|
|
535
|
+
date: string;
|
|
536
|
+
who: {
|
|
537
|
+
kind: "staff" | "role" | "grant";
|
|
538
|
+
value: string | null;
|
|
539
|
+
};
|
|
540
|
+
dueBy: string | null;
|
|
541
|
+
dueAt: string | null;
|
|
542
|
+
opens: string;
|
|
543
|
+
closes: string;
|
|
544
|
+
state: "not_started" | "open" | "done" | "missed";
|
|
545
|
+
late: boolean;
|
|
546
|
+
run: {
|
|
547
|
+
id: string;
|
|
548
|
+
object: string;
|
|
549
|
+
record: string;
|
|
550
|
+
template: {
|
|
551
|
+
id: string;
|
|
552
|
+
name: string;
|
|
553
|
+
version: number;
|
|
554
|
+
};
|
|
555
|
+
state: "open" | "done" | "missed" | "cancelled";
|
|
556
|
+
account: string | null;
|
|
557
|
+
name: string | null;
|
|
558
|
+
opens: string;
|
|
559
|
+
closes: string;
|
|
560
|
+
tickUntil: string;
|
|
561
|
+
madeAt: string;
|
|
562
|
+
closedAt: string | null;
|
|
563
|
+
closedBy: string | null;
|
|
564
|
+
closedByName: string | null;
|
|
565
|
+
closedWhy: string | null;
|
|
566
|
+
steps: {
|
|
567
|
+
position: number;
|
|
568
|
+
text: string;
|
|
569
|
+
required: boolean;
|
|
570
|
+
asksNote: boolean;
|
|
571
|
+
tick: {
|
|
572
|
+
id: string;
|
|
573
|
+
state: "done" | "not_done" | "cleared";
|
|
574
|
+
done: boolean;
|
|
575
|
+
why: string | null;
|
|
576
|
+
note: string | null;
|
|
577
|
+
onBehalfWhy: string | null;
|
|
578
|
+
withheld: boolean;
|
|
579
|
+
by: string;
|
|
580
|
+
byName: string;
|
|
581
|
+
for: string;
|
|
582
|
+
forName: string;
|
|
583
|
+
onBehalf: boolean;
|
|
584
|
+
at: string;
|
|
585
|
+
label: string;
|
|
586
|
+
} | null;
|
|
587
|
+
history: {
|
|
588
|
+
id: string;
|
|
589
|
+
state: "done" | "not_done" | "cleared";
|
|
590
|
+
done: boolean;
|
|
591
|
+
why: string | null;
|
|
592
|
+
note: string | null;
|
|
593
|
+
onBehalfWhy: string | null;
|
|
594
|
+
withheld: boolean;
|
|
595
|
+
by: string;
|
|
596
|
+
byName: string;
|
|
597
|
+
for: string;
|
|
598
|
+
forName: string;
|
|
599
|
+
onBehalf: boolean;
|
|
600
|
+
at: string;
|
|
601
|
+
label: string;
|
|
602
|
+
}[];
|
|
603
|
+
historyTruncated: boolean;
|
|
604
|
+
missed: boolean;
|
|
605
|
+
}[];
|
|
606
|
+
corrections: {
|
|
607
|
+
id: string;
|
|
608
|
+
text: string;
|
|
609
|
+
by: string;
|
|
610
|
+
byName: string;
|
|
611
|
+
at: string;
|
|
612
|
+
}[];
|
|
613
|
+
} | null;
|
|
614
|
+
preview: {
|
|
615
|
+
text: string;
|
|
616
|
+
required: boolean;
|
|
617
|
+
asksNote: boolean;
|
|
618
|
+
}[] | null;
|
|
619
|
+
mayDo: boolean;
|
|
620
|
+
canTick: boolean;
|
|
621
|
+
};
|
|
622
|
+
zone: string;
|
|
623
|
+
doers: {
|
|
624
|
+
id: string;
|
|
625
|
+
name: string;
|
|
626
|
+
}[] | null;
|
|
627
|
+
you: string;
|
|
628
|
+
youManage: boolean;
|
|
629
|
+
} | undefined;
|
|
630
|
+
isPending: boolean;
|
|
631
|
+
error: unknown;
|
|
632
|
+
refetch?: () => unknown;
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* Tick a step (a person's own act). What is written on it is forgotten once the call is over:
|
|
636
|
+
* call it through `forgetAfter`.
|
|
637
|
+
*/
|
|
638
|
+
useTick(): {
|
|
639
|
+
mutate(input: {
|
|
640
|
+
step: number;
|
|
641
|
+
state: "done" | "not_done" | "clear";
|
|
642
|
+
template: string;
|
|
643
|
+
date: string;
|
|
644
|
+
for?: string | undefined;
|
|
645
|
+
forWhy?: string | undefined;
|
|
646
|
+
note?: string | undefined;
|
|
647
|
+
why?: string | undefined;
|
|
648
|
+
}): void;
|
|
649
|
+
mutateAsync(input: {
|
|
650
|
+
step: number;
|
|
651
|
+
state: "done" | "not_done" | "clear";
|
|
652
|
+
template: string;
|
|
653
|
+
date: string;
|
|
654
|
+
for?: string | undefined;
|
|
655
|
+
forWhy?: string | undefined;
|
|
656
|
+
note?: string | undefined;
|
|
657
|
+
why?: string | undefined;
|
|
658
|
+
}): Promise<{
|
|
659
|
+
run: string;
|
|
660
|
+
step: number;
|
|
661
|
+
state: "done" | "not_done" | "clear";
|
|
662
|
+
ticked: number;
|
|
663
|
+
of: number;
|
|
664
|
+
finished: boolean;
|
|
665
|
+
}>;
|
|
666
|
+
data: {
|
|
667
|
+
run: string;
|
|
668
|
+
step: number;
|
|
669
|
+
state: "done" | "not_done" | "clear";
|
|
670
|
+
ticked: number;
|
|
671
|
+
of: number;
|
|
672
|
+
finished: boolean;
|
|
673
|
+
} | undefined;
|
|
674
|
+
isPending: boolean;
|
|
675
|
+
error: unknown;
|
|
676
|
+
reset?: () => void;
|
|
677
|
+
};
|
|
678
|
+
/** Finish it with optional steps left: final. */
|
|
679
|
+
useDone(): {
|
|
680
|
+
mutate(input: {
|
|
681
|
+
template: string;
|
|
682
|
+
date: string;
|
|
683
|
+
for?: string | undefined;
|
|
684
|
+
forWhy?: string | undefined;
|
|
685
|
+
}): void;
|
|
686
|
+
mutateAsync(input: {
|
|
687
|
+
template: string;
|
|
688
|
+
date: string;
|
|
689
|
+
for?: string | undefined;
|
|
690
|
+
forWhy?: string | undefined;
|
|
691
|
+
}): Promise<{
|
|
692
|
+
run: string;
|
|
693
|
+
state: "done";
|
|
694
|
+
}>;
|
|
695
|
+
data: {
|
|
696
|
+
run: string;
|
|
697
|
+
state: "done";
|
|
698
|
+
} | undefined;
|
|
699
|
+
isPending: boolean;
|
|
700
|
+
error: unknown;
|
|
701
|
+
reset?: () => void;
|
|
702
|
+
};
|
|
703
|
+
/** How each day went (those who manage checklists): on screen only. */
|
|
704
|
+
useHistory(input: In<"x.dailychecks.history"> | null): {
|
|
705
|
+
data: {
|
|
706
|
+
zone: string;
|
|
707
|
+
days: {
|
|
708
|
+
run: string;
|
|
709
|
+
template: {
|
|
710
|
+
id: string;
|
|
711
|
+
name: string;
|
|
712
|
+
};
|
|
713
|
+
date: string;
|
|
714
|
+
state: "open" | "done" | "missed";
|
|
715
|
+
dueAt: string | null;
|
|
716
|
+
late: boolean;
|
|
717
|
+
finishedAt: string | null;
|
|
718
|
+
finishedBy: string | null;
|
|
719
|
+
finishedFor: string | null;
|
|
720
|
+
steps: number;
|
|
721
|
+
ticked: number;
|
|
722
|
+
notDone: number;
|
|
723
|
+
onBehalf: number;
|
|
724
|
+
missed: string[];
|
|
725
|
+
}[];
|
|
726
|
+
truncated: boolean;
|
|
727
|
+
} | undefined;
|
|
728
|
+
isPending: boolean;
|
|
729
|
+
error: unknown;
|
|
730
|
+
refetch?: () => unknown;
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
/** Every hook of this entry. A block takes the ones it calls: `Pick<DailyChecksHooks, "useToday">`. */
|
|
734
|
+
export type DailyChecksHooks = ReturnType<typeof allDailyChecksHooks>;
|