@composable-os/pack-programs 0.0.0-stage → 0.1.0-beta.7

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.
Files changed (39) hide show
  1. package/LICENSE +109 -0
  2. package/dist/authoring.d.ts +47 -0
  3. package/dist/authoring.js +493 -0
  4. package/dist/blocks/programs-bank/exercise-bank.d.ts +4 -0
  5. package/dist/blocks/programs-bank/exercise-bank.js +68 -0
  6. package/dist/blocks/programs-builder/program-builder.d.ts +26 -0
  7. package/dist/blocks/programs-builder/program-builder.js +295 -0
  8. package/dist/blocks/programs-class-today/class-today.d.ts +6 -0
  9. package/dist/blocks/programs-class-today/class-today.js +15 -0
  10. package/dist/blocks/programs-coach-client/coach-client.d.ts +5 -0
  11. package/dist/blocks/programs-coach-client/coach-client.js +10 -0
  12. package/dist/blocks/programs-native-class-today/class-today-screen.d.ts +6 -0
  13. package/dist/blocks/programs-native-class-today/class-today-screen.js +14 -0
  14. package/dist/blocks/programs-native-coach-client/coach-client-screen.d.ts +7 -0
  15. package/dist/blocks/programs-native-coach-client/coach-client-screen.js +9 -0
  16. package/dist/blocks/programs-native-progress/progress-screen.d.ts +5 -0
  17. package/dist/blocks/programs-native-progress/progress-screen.js +31 -0
  18. package/dist/blocks/programs-native-session/session-screen.d.ts +7 -0
  19. package/dist/blocks/programs-native-session/session-screen.js +130 -0
  20. package/dist/blocks/programs-native-today/today-screen.d.ts +7 -0
  21. package/dist/blocks/programs-native-today/today-screen.js +11 -0
  22. package/dist/blocks/programs-progress/progress.d.ts +10 -0
  23. package/dist/blocks/programs-progress/progress.js +40 -0
  24. package/dist/blocks/programs-session/session-view.d.ts +9 -0
  25. package/dist/blocks/programs-session/session-view.js +116 -0
  26. package/dist/blocks/programs-today/today.d.ts +7 -0
  27. package/dist/blocks/programs-today/today.js +16 -0
  28. package/dist/client/index.d.ts +1721 -0
  29. package/dist/client/index.js +778 -0
  30. package/dist/dashboards.d.ts +5 -0
  31. package/dist/dashboards.js +145 -0
  32. package/dist/index.d.ts +1181 -0
  33. package/dist/index.js +608 -0
  34. package/dist/layout.d.ts +88 -0
  35. package/dist/layout.js +268 -0
  36. package/dist/tools.d.ts +344 -0
  37. package/dist/tools.js +930 -0
  38. package/package.json +36 -4
  39. package/README.md +0 -3
@@ -0,0 +1,1721 @@
1
+ import { type ClientHolding, type PackClient } from "@composable-os/client";
2
+ import type { z } from "@composable-os/sdk";
3
+ import type { Block, Item, Layout, Level, Note, Prescription, Session, SetTarget } from "../layout.ts";
4
+ import type { assign, classToday, draft, history, importText, logAdd, logUpdate, progress, sessionComplete, sessionGet, today } from "../tools.ts";
5
+ export type { Block, Item, Layout, Level, Note, Prescription, Session, SetTarget };
6
+ type Io<T extends {
7
+ input: z.ZodType;
8
+ output: z.ZodType;
9
+ }> = {
10
+ input: z.input<T["input"]>;
11
+ output: z.output<T["output"]>;
12
+ };
13
+ /** A record as the record operations return it. */
14
+ export interface RecordOut {
15
+ object: string;
16
+ id: string;
17
+ title?: string | null;
18
+ values: Record<string, unknown>;
19
+ }
20
+ interface Page {
21
+ items: RecordOut[];
22
+ nextCursor: string | null;
23
+ }
24
+ type ListInput = {
25
+ object: string;
26
+ filter?: unknown;
27
+ sort?: {
28
+ field: string;
29
+ direction?: "asc" | "desc";
30
+ };
31
+ limit?: number;
32
+ cursor?: string;
33
+ };
34
+ export interface VersionSummary {
35
+ version: number;
36
+ current: boolean;
37
+ publishedAt: string;
38
+ publishedBy: string | null;
39
+ note: string | null;
40
+ bytes: number;
41
+ }
42
+ /** The operations this entry calls, as the generated client types them. */
43
+ export type ProgramsOperations = {
44
+ "x.programs.assign": {
45
+ kind: "mutation";
46
+ } & Io<typeof assign>;
47
+ "x.programs.today": {
48
+ kind: "query";
49
+ } & Io<typeof today>;
50
+ "x.programs.sessionGet": {
51
+ kind: "query";
52
+ } & Io<typeof sessionGet>;
53
+ "x.programs.classToday": {
54
+ kind: "query";
55
+ } & Io<typeof classToday>;
56
+ "x.programs.logAdd": {
57
+ kind: "mutation";
58
+ } & Io<typeof logAdd>;
59
+ "x.programs.logUpdate": {
60
+ kind: "mutation";
61
+ } & Io<typeof logUpdate>;
62
+ "x.programs.sessionComplete": {
63
+ kind: "mutation";
64
+ } & Io<typeof sessionComplete>;
65
+ "x.programs.history": {
66
+ kind: "query";
67
+ } & Io<typeof history>;
68
+ "x.programs.progress": {
69
+ kind: "query";
70
+ } & Io<typeof progress>;
71
+ "x.programs.draft": {
72
+ kind: "mutation";
73
+ } & Io<typeof draft>;
74
+ "x.programs.importText": {
75
+ kind: "mutation";
76
+ } & Io<typeof importText>;
77
+ "record.get": {
78
+ kind: "query";
79
+ input: {
80
+ object: string;
81
+ id: string;
82
+ };
83
+ output: RecordOut;
84
+ };
85
+ "record.list": {
86
+ kind: "query";
87
+ input: ListInput;
88
+ output: Page;
89
+ };
90
+ "record.create": {
91
+ kind: "mutation";
92
+ input: {
93
+ object: string;
94
+ values: Record<string, unknown>;
95
+ };
96
+ output: RecordOut;
97
+ };
98
+ "record.update": {
99
+ kind: "mutation";
100
+ input: {
101
+ object: string;
102
+ id: string;
103
+ values: Record<string, unknown>;
104
+ };
105
+ output: RecordOut;
106
+ };
107
+ "record.versions": {
108
+ kind: "query";
109
+ input: {
110
+ object: string;
111
+ id: string;
112
+ limit?: number;
113
+ };
114
+ output: {
115
+ items: VersionSummary[];
116
+ };
117
+ };
118
+ "record.publish": {
119
+ kind: "mutation";
120
+ input: {
121
+ object: string;
122
+ id: string;
123
+ note?: string;
124
+ };
125
+ output: VersionSummary;
126
+ };
127
+ "record.restoreVersion": {
128
+ kind: "mutation";
129
+ input: {
130
+ object: string;
131
+ id: string;
132
+ version: number;
133
+ };
134
+ output: {
135
+ record: RecordOut;
136
+ skipped: string[];
137
+ };
138
+ };
139
+ "person.list": {
140
+ kind: "query";
141
+ input: {
142
+ filter?: unknown;
143
+ limit?: number;
144
+ sort?: {
145
+ field: string;
146
+ direction?: "asc" | "desc";
147
+ };
148
+ };
149
+ output: {
150
+ items: {
151
+ id: string;
152
+ displayName?: string | null;
153
+ }[];
154
+ nextCursor: string | null;
155
+ };
156
+ };
157
+ "user.me": {
158
+ kind: "query";
159
+ input: Record<string, never>;
160
+ output: {
161
+ id: string;
162
+ name: string;
163
+ role: string;
164
+ granted: string[];
165
+ permissions: string[];
166
+ };
167
+ };
168
+ };
169
+ type Name = keyof ProgramsOperations & string;
170
+ type In<N extends Name> = ProgramsOperations[N]["input"];
171
+ type Out<N extends Name> = ProgramsOperations[N]["output"];
172
+ export type TodayOut = Out<"x.programs.today">;
173
+ export type PlannedSession = TodayOut["sessions"][number];
174
+ export type SessionDetail = Out<"x.programs.sessionGet">;
175
+ export type LoggedSet = SessionDetail["logged"][number];
176
+ export type SessionExercise = SessionDetail["exercises"][number];
177
+ export type HistoryOut = Out<"x.programs.history">;
178
+ export type ProgressOut = Out<"x.programs.progress">;
179
+ /**
180
+ * The client of every operation this entry calls. The hooks are written against it; the client an
181
+ * app passes may hold fewer (a member's customer client holds no staff operation), and then gets
182
+ * only the hooks it can back (ADR 0453).
183
+ */
184
+ export type ProgramsClient = PackClient<ProgramsOperations>;
185
+ export declare const PROGRAM = "programs.program";
186
+ export declare const EXERCISE = "programs.exercise";
187
+ export declare const SESSION = "programs.session";
188
+ export declare const LOG = "programs.log";
189
+ /** "3 × 8–12 @ 20 kg, 32X1, rest 90 s": a set target as a person reads it. */
190
+ export declare function describeSet(set: SetTarget): string;
191
+ /** A prescription's sets, grouped when they repeat: "3 × 8 reps @ 20 kg". */
192
+ export declare function describeSets(sets: readonly SetTarget[]): string;
193
+ /** The exercises of a level, whatever its mode. */
194
+ export declare function levelExercises(level: Level): Prescription[];
195
+ /** What a level is, in words: "Level 3: one of these". */
196
+ export declare function levelLabel(level: Level): string;
197
+ /** The sets already logged of one prescription's set number in a session. */
198
+ export declare function loggedFor(logged: readonly LoggedSet[], item: string, exercise: string, setNumber: number): LoggedSet | undefined;
199
+ /** A number typed in a field, or undefined when it is empty or not one. */
200
+ export declare function numberFrom(text: string): number | undefined;
201
+ /**
202
+ * The faults the host reported for a layout, by path: `weeks.0.sessions.1.day` → "At most 7". The
203
+ * builder shows each beside the part it names, and a part's own faults and those inside it
204
+ * (`faultsUnder`). The host's document check reports every fault with its path (ADR 0445); a ref
205
+ * to a missing exercise reports its path in `details.path`.
206
+ */
207
+ export declare function faultsOf(error: unknown, field?: string): Map<string, string>;
208
+ /** The faults at `path` and inside it. */
209
+ export declare function faultsUnder(faults: ReadonlyMap<string, string>, path: string): string[];
210
+ /** Where a part of the layout is: indexes from the week down. */
211
+ export interface At {
212
+ week: number;
213
+ session?: number;
214
+ block?: number;
215
+ item?: number;
216
+ level?: number;
217
+ exercise?: number;
218
+ set?: number;
219
+ }
220
+ /** The path the host names a part with (`weeks.0.sessions.1.blocks.0.items.2`). */
221
+ export declare function pathOf(at: At): string;
222
+ export declare function emptyLayout(): Layout;
223
+ /** A set as a new one starts: 8 reps, or 30 seconds for time, 20 for a hold. */
224
+ export declare function newSet(measure?: string | null): SetTarget;
225
+ export declare function newPrescription(exercise: string, measure?: string | null, sets?: number): Prescription;
226
+ /** The next free label in a list: A, B, C… for blocks; A1, A2… for a block's items. */
227
+ export declare function nextLabel(taken: readonly string[], prefix?: string): string;
228
+ /** The prescription at `at`: an "all" item's `exercise`, or a level's. */
229
+ export declare function prescriptionAt(layout: Layout, at: At): Prescription;
230
+ /** Moves an entry of a list from one place to another (drag and drop, or a key). */
231
+ export declare function move<T>(list: readonly T[], from: number, to: number): T[];
232
+ export declare const layoutEdits: {
233
+ addWeek: (layout: Layout) => Layout;
234
+ /** A copy of week `week`, right after it. */
235
+ copyWeek: (layout: Layout, week: number) => Layout;
236
+ removeWeek: (layout: Layout, week: number) => Layout;
237
+ setWeekLabel: (layout: Layout, week: number, label: string) => Layout;
238
+ addSession: (layout: Layout, week: number) => Layout;
239
+ /** A copy of a session: in its own week, or into every later week (`toEveryWeek`). */
240
+ copySession: (layout: Layout, at: At, toWeek?: number) => Layout;
241
+ removeSession: (layout: Layout, at: At) => Layout;
242
+ moveSession: (layout: Layout, week: number, from: number, to: number) => Layout;
243
+ setSession: (layout: Layout, at: At, values: Partial<Pick<Session, "name" | "focus" | "day">>) => Layout;
244
+ setWarmup: (layout: Layout, at: At, text: string) => Layout;
245
+ addBlock: (layout: Layout, at: At) => Layout;
246
+ removeBlock: (layout: Layout, at: At) => Layout;
247
+ moveBlock: (layout: Layout, at: At, from: number, to: number) => Layout;
248
+ setBlock: (layout: Layout, at: At, values: {
249
+ label?: string;
250
+ rounds?: number | null;
251
+ }) => Layout;
252
+ /** An item for everyone with one exercise, or with levels (level 1 of the exercise). */
253
+ addItem: (layout: Layout, at: At, exercise: string, measure?: string | null, kind?: Item["kind"]) => Layout;
254
+ removeItem: (layout: Layout, at: At) => Layout;
255
+ /** Moves an item within its block, or into another block of the same session. */
256
+ moveItem: (layout: Layout, at: At, to: {
257
+ block: number;
258
+ item: number;
259
+ }) => Layout;
260
+ setItemLabel: (layout: Layout, at: At, label: string) => Layout;
261
+ /** Everyone, or levels: an item's exercises become level 1, or level 1 becomes everyone's. */
262
+ setItemKind: (layout: Layout, at: At, kind: Item["kind"]) => Layout;
263
+ /** A new level (the lowest free number) with one exercise. */
264
+ addLevel: (layout: Layout, at: At, exercise: string, measure?: string | null, level?: number) => Layout;
265
+ removeLevel: (layout: Layout, at: At) => Layout;
266
+ setLevelNumber: (layout: Layout, at: At, number: number) => Layout;
267
+ /** One, together or alternatives: a level's exercises kept, its shape changed. */
268
+ setLevelMode: (layout: Layout, at: At, mode: Level["mode"]) => Layout;
269
+ /** Another exercise beside the ones at `at` (an "all" item's, or a level's). */
270
+ addExercise: (layout: Layout, at: At, exercise: string, measure?: string | null) => Layout;
271
+ removeExercise: (layout: Layout, at: At) => Layout;
272
+ /** The exercise at `at` replaced by another of the bank, keeping its sets and note. */
273
+ swapExercise: (layout: Layout, at: At, exercise: string) => Layout;
274
+ setSets: (layout: Layout, at: At, sets: SetTarget[]) => Layout;
275
+ /** One more set, like the last. */
276
+ addSet: (layout: Layout, at: At) => Layout;
277
+ removeSet: (layout: Layout, at: At) => Layout;
278
+ /** One set's values: switching its kind keeps what the new kind has (load, rest). */
279
+ setSet: (layout: Layout, at: At, values: Partial<SetTarget> & {
280
+ kind?: SetTarget["kind"];
281
+ }) => Layout;
282
+ setPrescriptionNote: (layout: Layout, at: At, note: string) => Layout;
283
+ /** A note on a session, a block or an item (whichever `at` reaches deepest). */
284
+ addNote: (layout: Layout, at: At, text: string, members?: boolean) => Layout;
285
+ setNote: (layout: Layout, at: At, index: number, note: Note | null) => Layout;
286
+ };
287
+ /** How many sessions, items and exercises a layout has, for the builder's summary. */
288
+ export declare function layoutSummary(layout: Layout): {
289
+ weeks: number;
290
+ sessions: number;
291
+ items: number;
292
+ };
293
+ /** The ids of every exercise a layout names. */
294
+ export declare function exercisesIn(layout: Layout): string[];
295
+ /** The app's `useQuery`, as far as these hooks use it. */
296
+ export type UseQuery = <T>(options: {
297
+ queryKey: readonly unknown[];
298
+ queryFn: () => Promise<T>;
299
+ enabled?: boolean;
300
+ }) => {
301
+ data: T | undefined;
302
+ isPending: boolean;
303
+ error: unknown;
304
+ refetch?: () => unknown;
305
+ };
306
+ /** The app's `useMutation`, as far as these hooks use it. */
307
+ export type UseMutation = <I, O>(options: {
308
+ mutationKey: readonly unknown[];
309
+ mutationFn: (input: I) => Promise<O>;
310
+ onSuccess?: (data: O) => void;
311
+ }) => {
312
+ mutate(input: I): void;
313
+ mutateAsync(input: I): Promise<O>;
314
+ data: O | undefined;
315
+ isPending: boolean;
316
+ error: unknown;
317
+ };
318
+ /** The app's `useState`. */
319
+ export type UseState = <T>(initial: T) => [T, (next: T | ((previous: T) => T)) => void];
320
+ /** The app's `useEffect`. */
321
+ export type UseEffect = (effect: () => undefined | (() => void), deps: readonly unknown[]) => void;
322
+ /** How long the builder waits after the last edit before it saves the working copy. */
323
+ export declare const SAVE_AFTER_MS = 800;
324
+ export type SaveState = "saved" | "saving" | "unsaved" | "refused";
325
+ /**
326
+ * The operations each hook calls (ADR 0453). A member's customer client gets the training hooks
327
+ * (today, a session, logging, history, progress, the class view), the staff client all of them.
328
+ * Who may do what is still the host's: a coach whose grants (ADR 0449) do not cover an operation
329
+ * is refused it there; `usePublishOffered` asks the host what the account holds.
330
+ */
331
+ export declare const PROGRAMS_HOOKS_CALL: {
332
+ readonly useToday: readonly ["x.programs.today"];
333
+ readonly useSession: readonly ["x.programs.sessionGet"];
334
+ readonly useClassToday: readonly ["x.programs.classToday"];
335
+ readonly useLogSet: readonly ["x.programs.logAdd"];
336
+ readonly useUpdateSet: readonly ["x.programs.logUpdate"];
337
+ readonly useMarkSession: readonly ["x.programs.sessionComplete"];
338
+ readonly useHistory: readonly ["x.programs.history"];
339
+ readonly useProgress: readonly ["x.programs.progress"];
340
+ readonly useClientSessions: readonly ["record.list"];
341
+ readonly usePeople: readonly ["person.list"];
342
+ readonly useClassTypes: readonly ["record.list"];
343
+ readonly useBank: readonly ["record.list"];
344
+ readonly useExercises: readonly ["record.list"];
345
+ readonly useCreateExercise: readonly ["record.create"];
346
+ readonly useUpdateExercise: readonly ["record.update"];
347
+ readonly usePrograms: readonly ["record.list"];
348
+ readonly useCreateProgram: readonly ["record.create"];
349
+ readonly useDraft: readonly ["x.programs.draft"];
350
+ readonly useImportText: readonly ["x.programs.importText"];
351
+ readonly useAssign: readonly ["x.programs.assign"];
352
+ readonly useVersions: readonly ["record.versions"];
353
+ readonly usePublishOffered: readonly ["user.me"];
354
+ readonly usePublish: readonly ["record.publish"];
355
+ readonly useRestoreVersion: readonly ["record.restoreVersion"];
356
+ readonly useWorkingCopy: readonly ["record.get", "record.update"];
357
+ };
358
+ type ProgramsReact = {
359
+ useQuery: UseQuery;
360
+ useMutation: UseMutation;
361
+ useState: UseState;
362
+ useEffect?: UseEffect;
363
+ };
364
+ /**
365
+ * Hooks for a React or React Native app:
366
+ * `const programs = createProgramsHooks({ useQuery, useMutation, useState, useEffect }, api)`.
367
+ * `api` is any generated client; the hooks it cannot back are not there, and calling one does
368
+ * not compile.
369
+ */
370
+ export declare function createProgramsHooks<C extends ClientHolding>(react: ProgramsReact, client: C): import("@composable-os/client").HooksFor<{
371
+ useToday(input?: In<"x.programs.today">): {
372
+ data: {
373
+ date: string;
374
+ sessions: {
375
+ id: string;
376
+ name: string | null;
377
+ date: string | null;
378
+ week: number | null;
379
+ day: number | null;
380
+ kind: string | null;
381
+ classType: string | null;
382
+ assignment: string | null;
383
+ programVersion: number | null;
384
+ programTitle: string | null;
385
+ classTypeName: string | null;
386
+ focus: string | null;
387
+ state: string | null;
388
+ plan: Record<string, unknown> | null;
389
+ exercises: {
390
+ id: string;
391
+ name: string | null;
392
+ video: string | null;
393
+ cues: string | null;
394
+ measure: string | null;
395
+ last: {
396
+ date: string | null;
397
+ reps: number | null;
398
+ seconds: number | null;
399
+ load: number | null;
400
+ rpe: number | null;
401
+ level: number | null;
402
+ }[];
403
+ }[];
404
+ }[];
405
+ } | undefined;
406
+ isPending: boolean;
407
+ error: unknown;
408
+ refetch?: () => unknown;
409
+ };
410
+ useSession(input: In<"x.programs.sessionGet">): {
411
+ data: {
412
+ session: {
413
+ id: string;
414
+ name: string | null;
415
+ date: string | null;
416
+ week: number | null;
417
+ day: number | null;
418
+ kind: string | null;
419
+ classType: string | null;
420
+ assignment: string | null;
421
+ programVersion: number | null;
422
+ programTitle: string | null;
423
+ classTypeName: string | null;
424
+ focus: string | null;
425
+ state: string | null;
426
+ plan: Record<string, unknown> | null;
427
+ };
428
+ exercises: {
429
+ id: string;
430
+ name: string | null;
431
+ video: string | null;
432
+ cues: string | null;
433
+ measure: string | null;
434
+ last: {
435
+ date: string | null;
436
+ reps: number | null;
437
+ seconds: number | null;
438
+ load: number | null;
439
+ rpe: number | null;
440
+ level: number | null;
441
+ }[];
442
+ }[];
443
+ logged: {
444
+ id: string;
445
+ item: string | null;
446
+ exercise: string | null;
447
+ setNumber: number | null;
448
+ level: number | null;
449
+ target: {
450
+ reps: number | null;
451
+ seconds: number | null;
452
+ load: number | null;
453
+ };
454
+ actual: {
455
+ reps: number | null;
456
+ seconds: number | null;
457
+ load: number | null;
458
+ };
459
+ rpe: number | null;
460
+ note: string | null;
461
+ recordedAs: string | null;
462
+ recordedByName: string | null;
463
+ exerciseName: string | null;
464
+ }[];
465
+ } | undefined;
466
+ isPending: boolean;
467
+ error: unknown;
468
+ refetch?: () => unknown;
469
+ };
470
+ useClassToday(input: In<"x.programs.classToday">): {
471
+ data: {
472
+ date: string;
473
+ sessions: {
474
+ id: string;
475
+ name: string | null;
476
+ date: string | null;
477
+ week: number | null;
478
+ day: number | null;
479
+ kind: string | null;
480
+ classType: string | null;
481
+ assignment: string | null;
482
+ programVersion: number | null;
483
+ programTitle: string | null;
484
+ classTypeName: string | null;
485
+ focus: string | null;
486
+ state: string | null;
487
+ plan: Record<string, unknown> | null;
488
+ exercises: {
489
+ id: string;
490
+ name: string | null;
491
+ video: string | null;
492
+ cues: string | null;
493
+ measure: string | null;
494
+ last: {
495
+ date: string | null;
496
+ reps: number | null;
497
+ seconds: number | null;
498
+ load: number | null;
499
+ rpe: number | null;
500
+ level: number | null;
501
+ }[];
502
+ }[];
503
+ }[];
504
+ } | undefined;
505
+ isPending: boolean;
506
+ error: unknown;
507
+ refetch?: () => unknown;
508
+ };
509
+ useLogSet(): {
510
+ mutate(input: {
511
+ sessionId: string;
512
+ item: string;
513
+ setNumber: number;
514
+ actual: {
515
+ reps?: number | undefined;
516
+ seconds?: number | undefined;
517
+ load?: number | undefined;
518
+ };
519
+ exerciseId?: string | undefined;
520
+ level?: number | undefined;
521
+ rpe?: number | undefined;
522
+ note?: string | undefined;
523
+ personId?: string | undefined;
524
+ }): void;
525
+ mutateAsync(input: {
526
+ sessionId: string;
527
+ item: string;
528
+ setNumber: number;
529
+ actual: {
530
+ reps?: number | undefined;
531
+ seconds?: number | undefined;
532
+ load?: number | undefined;
533
+ };
534
+ exerciseId?: string | undefined;
535
+ level?: number | undefined;
536
+ rpe?: number | undefined;
537
+ note?: string | undefined;
538
+ personId?: string | undefined;
539
+ }): Promise<{
540
+ id: string;
541
+ item: string | null;
542
+ exercise: string | null;
543
+ setNumber: number | null;
544
+ level: number | null;
545
+ target: {
546
+ reps: number | null;
547
+ seconds: number | null;
548
+ load: number | null;
549
+ };
550
+ actual: {
551
+ reps: number | null;
552
+ seconds: number | null;
553
+ load: number | null;
554
+ };
555
+ rpe: number | null;
556
+ note: string | null;
557
+ recordedAs: string | null;
558
+ recordedByName: string | null;
559
+ exerciseName: string | null;
560
+ }>;
561
+ data: {
562
+ id: string;
563
+ item: string | null;
564
+ exercise: string | null;
565
+ setNumber: number | null;
566
+ level: number | null;
567
+ target: {
568
+ reps: number | null;
569
+ seconds: number | null;
570
+ load: number | null;
571
+ };
572
+ actual: {
573
+ reps: number | null;
574
+ seconds: number | null;
575
+ load: number | null;
576
+ };
577
+ rpe: number | null;
578
+ note: string | null;
579
+ recordedAs: string | null;
580
+ recordedByName: string | null;
581
+ exerciseName: string | null;
582
+ } | undefined;
583
+ isPending: boolean;
584
+ error: unknown;
585
+ };
586
+ useUpdateSet(): {
587
+ mutate(input: {
588
+ logId: string;
589
+ actual?: {
590
+ reps?: number | undefined;
591
+ seconds?: number | undefined;
592
+ load?: number | undefined;
593
+ } | undefined;
594
+ rpe?: number | undefined;
595
+ note?: string | null | undefined;
596
+ }): void;
597
+ mutateAsync(input: {
598
+ logId: string;
599
+ actual?: {
600
+ reps?: number | undefined;
601
+ seconds?: number | undefined;
602
+ load?: number | undefined;
603
+ } | undefined;
604
+ rpe?: number | undefined;
605
+ note?: string | null | undefined;
606
+ }): Promise<{
607
+ id: string;
608
+ item: string | null;
609
+ exercise: string | null;
610
+ setNumber: number | null;
611
+ level: number | null;
612
+ target: {
613
+ reps: number | null;
614
+ seconds: number | null;
615
+ load: number | null;
616
+ };
617
+ actual: {
618
+ reps: number | null;
619
+ seconds: number | null;
620
+ load: number | null;
621
+ };
622
+ rpe: number | null;
623
+ note: string | null;
624
+ recordedAs: string | null;
625
+ recordedByName: string | null;
626
+ exerciseName: string | null;
627
+ }>;
628
+ data: {
629
+ id: string;
630
+ item: string | null;
631
+ exercise: string | null;
632
+ setNumber: number | null;
633
+ level: number | null;
634
+ target: {
635
+ reps: number | null;
636
+ seconds: number | null;
637
+ load: number | null;
638
+ };
639
+ actual: {
640
+ reps: number | null;
641
+ seconds: number | null;
642
+ load: number | null;
643
+ };
644
+ rpe: number | null;
645
+ note: string | null;
646
+ recordedAs: string | null;
647
+ recordedByName: string | null;
648
+ exerciseName: string | null;
649
+ } | undefined;
650
+ isPending: boolean;
651
+ error: unknown;
652
+ };
653
+ useMarkSession(): {
654
+ mutate(input: {
655
+ sessionId: string;
656
+ state?: "done" | "skipped" | "planned" | undefined;
657
+ }): void;
658
+ mutateAsync(input: {
659
+ sessionId: string;
660
+ state?: "done" | "skipped" | "planned" | undefined;
661
+ }): Promise<{
662
+ changed: boolean;
663
+ session: {
664
+ id: string;
665
+ name: string | null;
666
+ date: string | null;
667
+ week: number | null;
668
+ day: number | null;
669
+ kind: string | null;
670
+ classType: string | null;
671
+ assignment: string | null;
672
+ programVersion: number | null;
673
+ programTitle: string | null;
674
+ classTypeName: string | null;
675
+ focus: string | null;
676
+ state: string | null;
677
+ plan: Record<string, unknown> | null;
678
+ };
679
+ }>;
680
+ data: {
681
+ changed: boolean;
682
+ session: {
683
+ id: string;
684
+ name: string | null;
685
+ date: string | null;
686
+ week: number | null;
687
+ day: number | null;
688
+ kind: string | null;
689
+ classType: string | null;
690
+ assignment: string | null;
691
+ programVersion: number | null;
692
+ programTitle: string | null;
693
+ classTypeName: string | null;
694
+ focus: string | null;
695
+ state: string | null;
696
+ plan: Record<string, unknown> | null;
697
+ };
698
+ } | undefined;
699
+ isPending: boolean;
700
+ error: unknown;
701
+ };
702
+ useHistory(input: In<"x.programs.history">): {
703
+ data: {
704
+ exercise: {
705
+ id: string;
706
+ name: string | null;
707
+ };
708
+ sets: {
709
+ id: string;
710
+ item: string | null;
711
+ exercise: string | null;
712
+ setNumber: number | null;
713
+ level: number | null;
714
+ target: {
715
+ reps: number | null;
716
+ seconds: number | null;
717
+ load: number | null;
718
+ };
719
+ actual: {
720
+ reps: number | null;
721
+ seconds: number | null;
722
+ load: number | null;
723
+ };
724
+ rpe: number | null;
725
+ note: string | null;
726
+ recordedAs: string | null;
727
+ recordedByName: string | null;
728
+ exerciseName: string | null;
729
+ date: string | null;
730
+ }[];
731
+ best: {
732
+ load: number | null;
733
+ reps: number | null;
734
+ seconds: number | null;
735
+ };
736
+ capped: boolean;
737
+ } | undefined;
738
+ isPending: boolean;
739
+ error: unknown;
740
+ refetch?: () => unknown;
741
+ };
742
+ useProgress(input?: In<"x.programs.progress">): {
743
+ data: {
744
+ exercises: {
745
+ id: string;
746
+ name: string | null;
747
+ sets: number;
748
+ first: string | null;
749
+ last: string | null;
750
+ best: {
751
+ load: number | null;
752
+ reps: number | null;
753
+ seconds: number | null;
754
+ };
755
+ }[];
756
+ assignments: {
757
+ id: string;
758
+ title: string | null;
759
+ sessions: number;
760
+ done: number;
761
+ skipped: number;
762
+ planned: number;
763
+ }[];
764
+ capped: boolean;
765
+ } | undefined;
766
+ isPending: boolean;
767
+ error: unknown;
768
+ refetch?: () => unknown;
769
+ };
770
+ /** A client's sessions, newest first (staff): the coach's client view. */
771
+ useClientSessions(personId: string): {
772
+ data: Page | undefined;
773
+ isPending: boolean;
774
+ error: unknown;
775
+ refetch?: () => unknown;
776
+ };
777
+ /** People whose name contains `search` (staff): whom to assign a program to. */
778
+ usePeople(search: string): {
779
+ data: {
780
+ items: {
781
+ id: string;
782
+ displayName?: string | null;
783
+ }[];
784
+ nextCursor: string | null;
785
+ } | undefined;
786
+ isPending: boolean;
787
+ error: unknown;
788
+ refetch?: () => unknown;
789
+ };
790
+ /** The class types, for a member choosing their class. */
791
+ useClassTypes(): {
792
+ data: Page | undefined;
793
+ isPending: boolean;
794
+ error: unknown;
795
+ refetch?: () => unknown;
796
+ };
797
+ useBank(search?: string): {
798
+ data: Page | undefined;
799
+ isPending: boolean;
800
+ error: unknown;
801
+ refetch?: () => unknown;
802
+ };
803
+ /** The bank's exercises with these ids (a program's own, whatever the size of the bank). */
804
+ useExercises(ids: readonly string[]): {
805
+ data: Page | undefined;
806
+ isPending: boolean;
807
+ error: unknown;
808
+ refetch?: () => unknown;
809
+ };
810
+ useCreateExercise(): {
811
+ mutate(input: {
812
+ object: string;
813
+ values: Record<string, unknown>;
814
+ }): void;
815
+ mutateAsync(input: {
816
+ object: string;
817
+ values: Record<string, unknown>;
818
+ }): Promise<RecordOut>;
819
+ data: RecordOut | undefined;
820
+ isPending: boolean;
821
+ error: unknown;
822
+ };
823
+ useUpdateExercise(): {
824
+ mutate(input: {
825
+ object: string;
826
+ id: string;
827
+ values: Record<string, unknown>;
828
+ }): void;
829
+ mutateAsync(input: {
830
+ object: string;
831
+ id: string;
832
+ values: Record<string, unknown>;
833
+ }): Promise<RecordOut>;
834
+ data: RecordOut | undefined;
835
+ isPending: boolean;
836
+ error: unknown;
837
+ };
838
+ usePrograms(): {
839
+ data: Page | undefined;
840
+ isPending: boolean;
841
+ error: unknown;
842
+ refetch?: () => unknown;
843
+ };
844
+ useCreateProgram(): {
845
+ mutate(input: {
846
+ object: string;
847
+ values: Record<string, unknown>;
848
+ }): void;
849
+ mutateAsync(input: {
850
+ object: string;
851
+ values: Record<string, unknown>;
852
+ }): Promise<RecordOut>;
853
+ data: RecordOut | undefined;
854
+ isPending: boolean;
855
+ error: unknown;
856
+ };
857
+ useDraft(): {
858
+ mutate(input: {
859
+ brief: string;
860
+ title?: string | undefined;
861
+ kind?: "class" | "client" | "course" | undefined;
862
+ }): void;
863
+ mutateAsync(input: {
864
+ brief: string;
865
+ title?: string | undefined;
866
+ kind?: "class" | "client" | "course" | undefined;
867
+ }): Promise<{
868
+ programId: string;
869
+ title: string;
870
+ weeks: number;
871
+ sessions: number;
872
+ published: false;
873
+ exercises: {
874
+ id: string;
875
+ name: string;
876
+ }[];
877
+ }>;
878
+ data: {
879
+ programId: string;
880
+ title: string;
881
+ weeks: number;
882
+ sessions: number;
883
+ published: false;
884
+ exercises: {
885
+ id: string;
886
+ name: string;
887
+ }[];
888
+ } | undefined;
889
+ isPending: boolean;
890
+ error: unknown;
891
+ };
892
+ useImportText(): {
893
+ mutate(input: {
894
+ text: string;
895
+ title?: string | undefined;
896
+ kind?: "class" | "client" | "course" | undefined;
897
+ }): void;
898
+ mutateAsync(input: {
899
+ text: string;
900
+ title?: string | undefined;
901
+ kind?: "class" | "client" | "course" | undefined;
902
+ }): Promise<{
903
+ programId: string;
904
+ title: string;
905
+ weeks: number;
906
+ sessions: number;
907
+ published: false;
908
+ items: number;
909
+ unread: {
910
+ line: number;
911
+ text: string;
912
+ reason: string;
913
+ }[];
914
+ }>;
915
+ data: {
916
+ programId: string;
917
+ title: string;
918
+ weeks: number;
919
+ sessions: number;
920
+ published: false;
921
+ items: number;
922
+ unread: {
923
+ line: number;
924
+ text: string;
925
+ reason: string;
926
+ }[];
927
+ } | undefined;
928
+ isPending: boolean;
929
+ error: unknown;
930
+ };
931
+ useAssign(): {
932
+ mutate(input: {
933
+ programId: string;
934
+ startDate: string;
935
+ personId?: string | undefined;
936
+ classTypeId?: string | undefined;
937
+ }): void;
938
+ mutateAsync(input: {
939
+ programId: string;
940
+ startDate: string;
941
+ personId?: string | undefined;
942
+ classTypeId?: string | undefined;
943
+ }): Promise<{
944
+ assignmentId: string;
945
+ programVersion: number;
946
+ sessions: number;
947
+ startDate: string;
948
+ endDate: string;
949
+ }>;
950
+ data: {
951
+ assignmentId: string;
952
+ programVersion: number;
953
+ sessions: number;
954
+ startDate: string;
955
+ endDate: string;
956
+ } | undefined;
957
+ isPending: boolean;
958
+ error: unknown;
959
+ };
960
+ useVersions(programId: string): {
961
+ data: {
962
+ items: VersionSummary[];
963
+ } | undefined;
964
+ isPending: boolean;
965
+ error: unknown;
966
+ refetch?: () => unknown;
967
+ };
968
+ /**
969
+ * Whether to offer publishing: what `user.me` says the account holds. Only an offer: the host
970
+ * decides when it is asked (`records:publish`, and a person, never an AI actor).
971
+ */
972
+ usePublishOffered(): boolean;
973
+ usePublish(): {
974
+ mutate(input: {
975
+ object: string;
976
+ id: string;
977
+ note?: string;
978
+ }): void;
979
+ mutateAsync(input: {
980
+ object: string;
981
+ id: string;
982
+ note?: string;
983
+ }): Promise<VersionSummary>;
984
+ data: VersionSummary | undefined;
985
+ isPending: boolean;
986
+ error: unknown;
987
+ };
988
+ useRestoreVersion(): {
989
+ mutate(input: {
990
+ object: string;
991
+ id: string;
992
+ version: number;
993
+ }): void;
994
+ mutateAsync(input: {
995
+ object: string;
996
+ id: string;
997
+ version: number;
998
+ }): Promise<{
999
+ record: RecordOut;
1000
+ skipped: string[];
1001
+ }>;
1002
+ data: {
1003
+ record: RecordOut;
1004
+ skipped: string[];
1005
+ } | undefined;
1006
+ isPending: boolean;
1007
+ error: unknown;
1008
+ };
1009
+ /**
1010
+ * The builder's working copy of one program: the layout as the coach edits it, saved to the
1011
+ * host `SAVE_AFTER_MS` after the last edit (and on `saveNow`). Faults the host reports come
1012
+ * back by path (`faults`); the edit stays on screen so the coach fixes it where it is.
1013
+ */
1014
+ useWorkingCopy(programId: string): {
1015
+ program: RecordOut | undefined;
1016
+ isPending: boolean;
1017
+ error: unknown;
1018
+ layout: Layout | null;
1019
+ title: string;
1020
+ guidance: string;
1021
+ state: SaveState;
1022
+ faults: Map<string, string>;
1023
+ message: string | null;
1024
+ /** Applies an edit (one of `layoutEdits`) and saves it shortly after. */
1025
+ change(next: Layout): void;
1026
+ rename(title: string, guidance?: string): void;
1027
+ saveNow(): Promise<void>;
1028
+ /** The working copy as a version had it (after restoring one). */
1029
+ reset(layout: Layout, title?: string): void;
1030
+ };
1031
+ }, {
1032
+ readonly useToday: readonly ["x.programs.today"];
1033
+ readonly useSession: readonly ["x.programs.sessionGet"];
1034
+ readonly useClassToday: readonly ["x.programs.classToday"];
1035
+ readonly useLogSet: readonly ["x.programs.logAdd"];
1036
+ readonly useUpdateSet: readonly ["x.programs.logUpdate"];
1037
+ readonly useMarkSession: readonly ["x.programs.sessionComplete"];
1038
+ readonly useHistory: readonly ["x.programs.history"];
1039
+ readonly useProgress: readonly ["x.programs.progress"];
1040
+ readonly useClientSessions: readonly ["record.list"];
1041
+ readonly usePeople: readonly ["person.list"];
1042
+ readonly useClassTypes: readonly ["record.list"];
1043
+ readonly useBank: readonly ["record.list"];
1044
+ readonly useExercises: readonly ["record.list"];
1045
+ readonly useCreateExercise: readonly ["record.create"];
1046
+ readonly useUpdateExercise: readonly ["record.update"];
1047
+ readonly usePrograms: readonly ["record.list"];
1048
+ readonly useCreateProgram: readonly ["record.create"];
1049
+ readonly useDraft: readonly ["x.programs.draft"];
1050
+ readonly useImportText: readonly ["x.programs.importText"];
1051
+ readonly useAssign: readonly ["x.programs.assign"];
1052
+ readonly useVersions: readonly ["record.versions"];
1053
+ readonly usePublishOffered: readonly ["user.me"];
1054
+ readonly usePublish: readonly ["record.publish"];
1055
+ readonly useRestoreVersion: readonly ["record.restoreVersion"];
1056
+ readonly useWorkingCopy: readonly ["record.get", "record.update"];
1057
+ }, import("@composable-os/client").OperationsOf<C>>;
1058
+ declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient): {
1059
+ useToday(input?: In<"x.programs.today">): {
1060
+ data: {
1061
+ date: string;
1062
+ sessions: {
1063
+ id: string;
1064
+ name: string | null;
1065
+ date: string | null;
1066
+ week: number | null;
1067
+ day: number | null;
1068
+ kind: string | null;
1069
+ classType: string | null;
1070
+ assignment: string | null;
1071
+ programVersion: number | null;
1072
+ programTitle: string | null;
1073
+ classTypeName: string | null;
1074
+ focus: string | null;
1075
+ state: string | null;
1076
+ plan: Record<string, unknown> | null;
1077
+ exercises: {
1078
+ id: string;
1079
+ name: string | null;
1080
+ video: string | null;
1081
+ cues: string | null;
1082
+ measure: string | null;
1083
+ last: {
1084
+ date: string | null;
1085
+ reps: number | null;
1086
+ seconds: number | null;
1087
+ load: number | null;
1088
+ rpe: number | null;
1089
+ level: number | null;
1090
+ }[];
1091
+ }[];
1092
+ }[];
1093
+ } | undefined;
1094
+ isPending: boolean;
1095
+ error: unknown;
1096
+ refetch?: () => unknown;
1097
+ };
1098
+ useSession(input: In<"x.programs.sessionGet">): {
1099
+ data: {
1100
+ session: {
1101
+ id: string;
1102
+ name: string | null;
1103
+ date: string | null;
1104
+ week: number | null;
1105
+ day: number | null;
1106
+ kind: string | null;
1107
+ classType: string | null;
1108
+ assignment: string | null;
1109
+ programVersion: number | null;
1110
+ programTitle: string | null;
1111
+ classTypeName: string | null;
1112
+ focus: string | null;
1113
+ state: string | null;
1114
+ plan: Record<string, unknown> | null;
1115
+ };
1116
+ exercises: {
1117
+ id: string;
1118
+ name: string | null;
1119
+ video: string | null;
1120
+ cues: string | null;
1121
+ measure: string | null;
1122
+ last: {
1123
+ date: string | null;
1124
+ reps: number | null;
1125
+ seconds: number | null;
1126
+ load: number | null;
1127
+ rpe: number | null;
1128
+ level: number | null;
1129
+ }[];
1130
+ }[];
1131
+ logged: {
1132
+ id: string;
1133
+ item: string | null;
1134
+ exercise: string | null;
1135
+ setNumber: number | null;
1136
+ level: number | null;
1137
+ target: {
1138
+ reps: number | null;
1139
+ seconds: number | null;
1140
+ load: number | null;
1141
+ };
1142
+ actual: {
1143
+ reps: number | null;
1144
+ seconds: number | null;
1145
+ load: number | null;
1146
+ };
1147
+ rpe: number | null;
1148
+ note: string | null;
1149
+ recordedAs: string | null;
1150
+ recordedByName: string | null;
1151
+ exerciseName: string | null;
1152
+ }[];
1153
+ } | undefined;
1154
+ isPending: boolean;
1155
+ error: unknown;
1156
+ refetch?: () => unknown;
1157
+ };
1158
+ useClassToday(input: In<"x.programs.classToday">): {
1159
+ data: {
1160
+ date: string;
1161
+ sessions: {
1162
+ id: string;
1163
+ name: string | null;
1164
+ date: string | null;
1165
+ week: number | null;
1166
+ day: number | null;
1167
+ kind: string | null;
1168
+ classType: string | null;
1169
+ assignment: string | null;
1170
+ programVersion: number | null;
1171
+ programTitle: string | null;
1172
+ classTypeName: string | null;
1173
+ focus: string | null;
1174
+ state: string | null;
1175
+ plan: Record<string, unknown> | null;
1176
+ exercises: {
1177
+ id: string;
1178
+ name: string | null;
1179
+ video: string | null;
1180
+ cues: string | null;
1181
+ measure: string | null;
1182
+ last: {
1183
+ date: string | null;
1184
+ reps: number | null;
1185
+ seconds: number | null;
1186
+ load: number | null;
1187
+ rpe: number | null;
1188
+ level: number | null;
1189
+ }[];
1190
+ }[];
1191
+ }[];
1192
+ } | undefined;
1193
+ isPending: boolean;
1194
+ error: unknown;
1195
+ refetch?: () => unknown;
1196
+ };
1197
+ useLogSet(): {
1198
+ mutate(input: {
1199
+ sessionId: string;
1200
+ item: string;
1201
+ setNumber: number;
1202
+ actual: {
1203
+ reps?: number | undefined;
1204
+ seconds?: number | undefined;
1205
+ load?: number | undefined;
1206
+ };
1207
+ exerciseId?: string | undefined;
1208
+ level?: number | undefined;
1209
+ rpe?: number | undefined;
1210
+ note?: string | undefined;
1211
+ personId?: string | undefined;
1212
+ }): void;
1213
+ mutateAsync(input: {
1214
+ sessionId: string;
1215
+ item: string;
1216
+ setNumber: number;
1217
+ actual: {
1218
+ reps?: number | undefined;
1219
+ seconds?: number | undefined;
1220
+ load?: number | undefined;
1221
+ };
1222
+ exerciseId?: string | undefined;
1223
+ level?: number | undefined;
1224
+ rpe?: number | undefined;
1225
+ note?: string | undefined;
1226
+ personId?: string | undefined;
1227
+ }): Promise<{
1228
+ id: string;
1229
+ item: string | null;
1230
+ exercise: string | null;
1231
+ setNumber: number | null;
1232
+ level: number | null;
1233
+ target: {
1234
+ reps: number | null;
1235
+ seconds: number | null;
1236
+ load: number | null;
1237
+ };
1238
+ actual: {
1239
+ reps: number | null;
1240
+ seconds: number | null;
1241
+ load: number | null;
1242
+ };
1243
+ rpe: number | null;
1244
+ note: string | null;
1245
+ recordedAs: string | null;
1246
+ recordedByName: string | null;
1247
+ exerciseName: string | null;
1248
+ }>;
1249
+ data: {
1250
+ id: string;
1251
+ item: string | null;
1252
+ exercise: string | null;
1253
+ setNumber: number | null;
1254
+ level: number | null;
1255
+ target: {
1256
+ reps: number | null;
1257
+ seconds: number | null;
1258
+ load: number | null;
1259
+ };
1260
+ actual: {
1261
+ reps: number | null;
1262
+ seconds: number | null;
1263
+ load: number | null;
1264
+ };
1265
+ rpe: number | null;
1266
+ note: string | null;
1267
+ recordedAs: string | null;
1268
+ recordedByName: string | null;
1269
+ exerciseName: string | null;
1270
+ } | undefined;
1271
+ isPending: boolean;
1272
+ error: unknown;
1273
+ };
1274
+ useUpdateSet(): {
1275
+ mutate(input: {
1276
+ logId: string;
1277
+ actual?: {
1278
+ reps?: number | undefined;
1279
+ seconds?: number | undefined;
1280
+ load?: number | undefined;
1281
+ } | undefined;
1282
+ rpe?: number | undefined;
1283
+ note?: string | null | undefined;
1284
+ }): void;
1285
+ mutateAsync(input: {
1286
+ logId: string;
1287
+ actual?: {
1288
+ reps?: number | undefined;
1289
+ seconds?: number | undefined;
1290
+ load?: number | undefined;
1291
+ } | undefined;
1292
+ rpe?: number | undefined;
1293
+ note?: string | null | undefined;
1294
+ }): Promise<{
1295
+ id: string;
1296
+ item: string | null;
1297
+ exercise: string | null;
1298
+ setNumber: number | null;
1299
+ level: number | null;
1300
+ target: {
1301
+ reps: number | null;
1302
+ seconds: number | null;
1303
+ load: number | null;
1304
+ };
1305
+ actual: {
1306
+ reps: number | null;
1307
+ seconds: number | null;
1308
+ load: number | null;
1309
+ };
1310
+ rpe: number | null;
1311
+ note: string | null;
1312
+ recordedAs: string | null;
1313
+ recordedByName: string | null;
1314
+ exerciseName: string | null;
1315
+ }>;
1316
+ data: {
1317
+ id: string;
1318
+ item: string | null;
1319
+ exercise: string | null;
1320
+ setNumber: number | null;
1321
+ level: number | null;
1322
+ target: {
1323
+ reps: number | null;
1324
+ seconds: number | null;
1325
+ load: number | null;
1326
+ };
1327
+ actual: {
1328
+ reps: number | null;
1329
+ seconds: number | null;
1330
+ load: number | null;
1331
+ };
1332
+ rpe: number | null;
1333
+ note: string | null;
1334
+ recordedAs: string | null;
1335
+ recordedByName: string | null;
1336
+ exerciseName: string | null;
1337
+ } | undefined;
1338
+ isPending: boolean;
1339
+ error: unknown;
1340
+ };
1341
+ useMarkSession(): {
1342
+ mutate(input: {
1343
+ sessionId: string;
1344
+ state?: "done" | "skipped" | "planned" | undefined;
1345
+ }): void;
1346
+ mutateAsync(input: {
1347
+ sessionId: string;
1348
+ state?: "done" | "skipped" | "planned" | undefined;
1349
+ }): Promise<{
1350
+ changed: boolean;
1351
+ session: {
1352
+ id: string;
1353
+ name: string | null;
1354
+ date: string | null;
1355
+ week: number | null;
1356
+ day: number | null;
1357
+ kind: string | null;
1358
+ classType: string | null;
1359
+ assignment: string | null;
1360
+ programVersion: number | null;
1361
+ programTitle: string | null;
1362
+ classTypeName: string | null;
1363
+ focus: string | null;
1364
+ state: string | null;
1365
+ plan: Record<string, unknown> | null;
1366
+ };
1367
+ }>;
1368
+ data: {
1369
+ changed: boolean;
1370
+ session: {
1371
+ id: string;
1372
+ name: string | null;
1373
+ date: string | null;
1374
+ week: number | null;
1375
+ day: number | null;
1376
+ kind: string | null;
1377
+ classType: string | null;
1378
+ assignment: string | null;
1379
+ programVersion: number | null;
1380
+ programTitle: string | null;
1381
+ classTypeName: string | null;
1382
+ focus: string | null;
1383
+ state: string | null;
1384
+ plan: Record<string, unknown> | null;
1385
+ };
1386
+ } | undefined;
1387
+ isPending: boolean;
1388
+ error: unknown;
1389
+ };
1390
+ useHistory(input: In<"x.programs.history">): {
1391
+ data: {
1392
+ exercise: {
1393
+ id: string;
1394
+ name: string | null;
1395
+ };
1396
+ sets: {
1397
+ id: string;
1398
+ item: string | null;
1399
+ exercise: string | null;
1400
+ setNumber: number | null;
1401
+ level: number | null;
1402
+ target: {
1403
+ reps: number | null;
1404
+ seconds: number | null;
1405
+ load: number | null;
1406
+ };
1407
+ actual: {
1408
+ reps: number | null;
1409
+ seconds: number | null;
1410
+ load: number | null;
1411
+ };
1412
+ rpe: number | null;
1413
+ note: string | null;
1414
+ recordedAs: string | null;
1415
+ recordedByName: string | null;
1416
+ exerciseName: string | null;
1417
+ date: string | null;
1418
+ }[];
1419
+ best: {
1420
+ load: number | null;
1421
+ reps: number | null;
1422
+ seconds: number | null;
1423
+ };
1424
+ capped: boolean;
1425
+ } | undefined;
1426
+ isPending: boolean;
1427
+ error: unknown;
1428
+ refetch?: () => unknown;
1429
+ };
1430
+ useProgress(input?: In<"x.programs.progress">): {
1431
+ data: {
1432
+ exercises: {
1433
+ id: string;
1434
+ name: string | null;
1435
+ sets: number;
1436
+ first: string | null;
1437
+ last: string | null;
1438
+ best: {
1439
+ load: number | null;
1440
+ reps: number | null;
1441
+ seconds: number | null;
1442
+ };
1443
+ }[];
1444
+ assignments: {
1445
+ id: string;
1446
+ title: string | null;
1447
+ sessions: number;
1448
+ done: number;
1449
+ skipped: number;
1450
+ planned: number;
1451
+ }[];
1452
+ capped: boolean;
1453
+ } | undefined;
1454
+ isPending: boolean;
1455
+ error: unknown;
1456
+ refetch?: () => unknown;
1457
+ };
1458
+ /** A client's sessions, newest first (staff): the coach's client view. */
1459
+ useClientSessions(personId: string): {
1460
+ data: Page | undefined;
1461
+ isPending: boolean;
1462
+ error: unknown;
1463
+ refetch?: () => unknown;
1464
+ };
1465
+ /** People whose name contains `search` (staff): whom to assign a program to. */
1466
+ usePeople(search: string): {
1467
+ data: {
1468
+ items: {
1469
+ id: string;
1470
+ displayName?: string | null;
1471
+ }[];
1472
+ nextCursor: string | null;
1473
+ } | undefined;
1474
+ isPending: boolean;
1475
+ error: unknown;
1476
+ refetch?: () => unknown;
1477
+ };
1478
+ /** The class types, for a member choosing their class. */
1479
+ useClassTypes(): {
1480
+ data: Page | undefined;
1481
+ isPending: boolean;
1482
+ error: unknown;
1483
+ refetch?: () => unknown;
1484
+ };
1485
+ useBank(search?: string): {
1486
+ data: Page | undefined;
1487
+ isPending: boolean;
1488
+ error: unknown;
1489
+ refetch?: () => unknown;
1490
+ };
1491
+ /** The bank's exercises with these ids (a program's own, whatever the size of the bank). */
1492
+ useExercises(ids: readonly string[]): {
1493
+ data: Page | undefined;
1494
+ isPending: boolean;
1495
+ error: unknown;
1496
+ refetch?: () => unknown;
1497
+ };
1498
+ useCreateExercise(): {
1499
+ mutate(input: {
1500
+ object: string;
1501
+ values: Record<string, unknown>;
1502
+ }): void;
1503
+ mutateAsync(input: {
1504
+ object: string;
1505
+ values: Record<string, unknown>;
1506
+ }): Promise<RecordOut>;
1507
+ data: RecordOut | undefined;
1508
+ isPending: boolean;
1509
+ error: unknown;
1510
+ };
1511
+ useUpdateExercise(): {
1512
+ mutate(input: {
1513
+ object: string;
1514
+ id: string;
1515
+ values: Record<string, unknown>;
1516
+ }): void;
1517
+ mutateAsync(input: {
1518
+ object: string;
1519
+ id: string;
1520
+ values: Record<string, unknown>;
1521
+ }): Promise<RecordOut>;
1522
+ data: RecordOut | undefined;
1523
+ isPending: boolean;
1524
+ error: unknown;
1525
+ };
1526
+ usePrograms(): {
1527
+ data: Page | undefined;
1528
+ isPending: boolean;
1529
+ error: unknown;
1530
+ refetch?: () => unknown;
1531
+ };
1532
+ useCreateProgram(): {
1533
+ mutate(input: {
1534
+ object: string;
1535
+ values: Record<string, unknown>;
1536
+ }): void;
1537
+ mutateAsync(input: {
1538
+ object: string;
1539
+ values: Record<string, unknown>;
1540
+ }): Promise<RecordOut>;
1541
+ data: RecordOut | undefined;
1542
+ isPending: boolean;
1543
+ error: unknown;
1544
+ };
1545
+ useDraft(): {
1546
+ mutate(input: {
1547
+ brief: string;
1548
+ title?: string | undefined;
1549
+ kind?: "class" | "client" | "course" | undefined;
1550
+ }): void;
1551
+ mutateAsync(input: {
1552
+ brief: string;
1553
+ title?: string | undefined;
1554
+ kind?: "class" | "client" | "course" | undefined;
1555
+ }): Promise<{
1556
+ programId: string;
1557
+ title: string;
1558
+ weeks: number;
1559
+ sessions: number;
1560
+ published: false;
1561
+ exercises: {
1562
+ id: string;
1563
+ name: string;
1564
+ }[];
1565
+ }>;
1566
+ data: {
1567
+ programId: string;
1568
+ title: string;
1569
+ weeks: number;
1570
+ sessions: number;
1571
+ published: false;
1572
+ exercises: {
1573
+ id: string;
1574
+ name: string;
1575
+ }[];
1576
+ } | undefined;
1577
+ isPending: boolean;
1578
+ error: unknown;
1579
+ };
1580
+ useImportText(): {
1581
+ mutate(input: {
1582
+ text: string;
1583
+ title?: string | undefined;
1584
+ kind?: "class" | "client" | "course" | undefined;
1585
+ }): void;
1586
+ mutateAsync(input: {
1587
+ text: string;
1588
+ title?: string | undefined;
1589
+ kind?: "class" | "client" | "course" | undefined;
1590
+ }): Promise<{
1591
+ programId: string;
1592
+ title: string;
1593
+ weeks: number;
1594
+ sessions: number;
1595
+ published: false;
1596
+ items: number;
1597
+ unread: {
1598
+ line: number;
1599
+ text: string;
1600
+ reason: string;
1601
+ }[];
1602
+ }>;
1603
+ data: {
1604
+ programId: string;
1605
+ title: string;
1606
+ weeks: number;
1607
+ sessions: number;
1608
+ published: false;
1609
+ items: number;
1610
+ unread: {
1611
+ line: number;
1612
+ text: string;
1613
+ reason: string;
1614
+ }[];
1615
+ } | undefined;
1616
+ isPending: boolean;
1617
+ error: unknown;
1618
+ };
1619
+ useAssign(): {
1620
+ mutate(input: {
1621
+ programId: string;
1622
+ startDate: string;
1623
+ personId?: string | undefined;
1624
+ classTypeId?: string | undefined;
1625
+ }): void;
1626
+ mutateAsync(input: {
1627
+ programId: string;
1628
+ startDate: string;
1629
+ personId?: string | undefined;
1630
+ classTypeId?: string | undefined;
1631
+ }): Promise<{
1632
+ assignmentId: string;
1633
+ programVersion: number;
1634
+ sessions: number;
1635
+ startDate: string;
1636
+ endDate: string;
1637
+ }>;
1638
+ data: {
1639
+ assignmentId: string;
1640
+ programVersion: number;
1641
+ sessions: number;
1642
+ startDate: string;
1643
+ endDate: string;
1644
+ } | undefined;
1645
+ isPending: boolean;
1646
+ error: unknown;
1647
+ };
1648
+ useVersions(programId: string): {
1649
+ data: {
1650
+ items: VersionSummary[];
1651
+ } | undefined;
1652
+ isPending: boolean;
1653
+ error: unknown;
1654
+ refetch?: () => unknown;
1655
+ };
1656
+ /**
1657
+ * Whether to offer publishing: what `user.me` says the account holds. Only an offer: the host
1658
+ * decides when it is asked (`records:publish`, and a person, never an AI actor).
1659
+ */
1660
+ usePublishOffered(): boolean;
1661
+ usePublish(): {
1662
+ mutate(input: {
1663
+ object: string;
1664
+ id: string;
1665
+ note?: string;
1666
+ }): void;
1667
+ mutateAsync(input: {
1668
+ object: string;
1669
+ id: string;
1670
+ note?: string;
1671
+ }): Promise<VersionSummary>;
1672
+ data: VersionSummary | undefined;
1673
+ isPending: boolean;
1674
+ error: unknown;
1675
+ };
1676
+ useRestoreVersion(): {
1677
+ mutate(input: {
1678
+ object: string;
1679
+ id: string;
1680
+ version: number;
1681
+ }): void;
1682
+ mutateAsync(input: {
1683
+ object: string;
1684
+ id: string;
1685
+ version: number;
1686
+ }): Promise<{
1687
+ record: RecordOut;
1688
+ skipped: string[];
1689
+ }>;
1690
+ data: {
1691
+ record: RecordOut;
1692
+ skipped: string[];
1693
+ } | undefined;
1694
+ isPending: boolean;
1695
+ error: unknown;
1696
+ };
1697
+ /**
1698
+ * The builder's working copy of one program: the layout as the coach edits it, saved to the
1699
+ * host `SAVE_AFTER_MS` after the last edit (and on `saveNow`). Faults the host reports come
1700
+ * back by path (`faults`); the edit stays on screen so the coach fixes it where it is.
1701
+ */
1702
+ useWorkingCopy(programId: string): {
1703
+ program: RecordOut | undefined;
1704
+ isPending: boolean;
1705
+ error: unknown;
1706
+ layout: Layout | null;
1707
+ title: string;
1708
+ guidance: string;
1709
+ state: SaveState;
1710
+ faults: Map<string, string>;
1711
+ message: string | null;
1712
+ /** Applies an edit (one of `layoutEdits`) and saves it shortly after. */
1713
+ change(next: Layout): void;
1714
+ rename(title: string, guidance?: string): void;
1715
+ saveNow(): Promise<void>;
1716
+ /** The working copy as a version had it (after restoring one). */
1717
+ reset(layout: Layout, title?: string): void;
1718
+ };
1719
+ };
1720
+ /** Every hook of this entry, as a client of all its operations gets them. A block takes the ones it calls: `Pick<ProgramsHooks, "useToday">`. */
1721
+ export type ProgramsHooks = ReturnType<typeof allProgramsHooks>;