@composable-os/pack-programs 0.1.0-beta.11 → 0.1.0-beta.14
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/authoring.d.ts +4 -1
- package/dist/authoring.js +65 -5
- package/dist/blocks/programs-builder/program-builder.d.ts +12 -3
- package/dist/blocks/programs-builder/program-builder.js +16 -3
- package/dist/blocks/programs-class-today/class-today.d.ts +1 -1
- package/dist/blocks/programs-coach-client/coach-client.d.ts +1 -1
- package/dist/blocks/programs-history/history.d.ts +11 -0
- package/dist/blocks/programs-history/history.js +84 -0
- package/dist/blocks/programs-native-class-today/class-today-screen.js +3 -2
- package/dist/blocks/programs-native-coach-client/coach-client-screen.js +2 -2
- package/dist/blocks/programs-native-history/history-screen.d.ts +11 -0
- package/dist/blocks/programs-native-history/history-screen.js +98 -0
- package/dist/blocks/programs-native-progress/progress-screen.js +4 -4
- package/dist/blocks/programs-native-session/session-screen.d.ts +6 -2
- package/dist/blocks/programs-native-session/session-screen.js +214 -88
- package/dist/blocks/programs-native-today/today-screen.d.ts +1 -1
- package/dist/blocks/programs-native-today/today-screen.js +22 -3
- package/dist/blocks/programs-session/session-view.d.ts +7 -3
- package/dist/blocks/programs-session/session-view.js +139 -81
- package/dist/blocks/programs-today/today.d.ts +1 -1
- package/dist/client/index.d.ts +367 -12
- package/dist/client/index.js +393 -12
- package/dist/client/logging.d.ts +289 -0
- package/dist/client/logging.js +558 -0
- package/dist/index.d.ts +152 -6
- package/dist/index.js +141 -6
- package/dist/layout.d.ts +3 -1
- package/dist/layout.js +10 -2
- package/dist/tools.d.ts +25 -2
- package/dist/tools.js +269 -37
- package/package.json +3 -3
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ClientHolding, type PackClient } from "@composable-os/client";
|
|
2
2
|
import type { z } from "@composable-os/sdk";
|
|
3
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";
|
|
4
|
+
import type { assign, classToday, draft, history, importText, logAdd, logRemove, logUpdate, progress, sessionComplete, sessionGet, today } from "../tools.ts";
|
|
5
|
+
import { type SessionLog } from "./logging.ts";
|
|
6
|
+
export * from "./logging.ts";
|
|
5
7
|
export type { Block, Item, Layout, Level, Note, Prescription, Session, SetTarget };
|
|
6
8
|
type Io<T extends {
|
|
7
9
|
input: z.ZodType;
|
|
@@ -59,6 +61,9 @@ export type ProgramsOperations = {
|
|
|
59
61
|
"x.programs.logUpdate": {
|
|
60
62
|
kind: "mutation";
|
|
61
63
|
} & Io<typeof logUpdate>;
|
|
64
|
+
"x.programs.logRemove": {
|
|
65
|
+
kind: "mutation";
|
|
66
|
+
} & Io<typeof logRemove>;
|
|
62
67
|
"x.programs.sessionComplete": {
|
|
63
68
|
kind: "mutation";
|
|
64
69
|
} & Io<typeof sessionComplete>;
|
|
@@ -87,6 +92,12 @@ export type ProgramsOperations = {
|
|
|
87
92
|
input: ListInput;
|
|
88
93
|
output: Page;
|
|
89
94
|
};
|
|
95
|
+
/** A customer's read of what they may see (the class types, ADR 0447). */
|
|
96
|
+
"my.list": {
|
|
97
|
+
kind: "query";
|
|
98
|
+
input: ListInput;
|
|
99
|
+
output: Page;
|
|
100
|
+
};
|
|
90
101
|
"record.create": {
|
|
91
102
|
kind: "mutation";
|
|
92
103
|
input: {
|
|
@@ -198,6 +209,104 @@ export declare function levelLabel(level: Level): string;
|
|
|
198
209
|
export declare function loggedFor(logged: readonly LoggedSet[], item: string, exercise: string, setNumber: number): LoggedSet | undefined;
|
|
199
210
|
/** A number typed in a field, or undefined when it is empty or not one. */
|
|
200
211
|
export declare function numberFrom(text: string): number | undefined;
|
|
212
|
+
/** One past session as the history lists it: when, what, and how many of its sets were logged. */
|
|
213
|
+
export interface PastSession {
|
|
214
|
+
id: string;
|
|
215
|
+
date: string | null;
|
|
216
|
+
name: string | null;
|
|
217
|
+
programTitle: string | null;
|
|
218
|
+
focus: string | null;
|
|
219
|
+
state: string | null;
|
|
220
|
+
/** Sets logged on it. */
|
|
221
|
+
setsDone: number;
|
|
222
|
+
/** Sets its plan asks of this person (for an item with levels, the level they took). */
|
|
223
|
+
setsPlanned: number;
|
|
224
|
+
}
|
|
225
|
+
/** A page of past sessions, newest first: pass `nextCursor` back for older ones. */
|
|
226
|
+
export interface PastSessionsPage {
|
|
227
|
+
sessions: PastSession[];
|
|
228
|
+
nextCursor: string | null;
|
|
229
|
+
}
|
|
230
|
+
/** Sessions a page of the history lists. Their ids go in one `in` filter on the sets. */
|
|
231
|
+
export declare const PAST_SESSIONS_PAGE = 20;
|
|
232
|
+
/** What a set logged on a session says about where it was, as `sessionSets` reads it. */
|
|
233
|
+
export interface SetPlace {
|
|
234
|
+
item: string | null;
|
|
235
|
+
exercise: string | null;
|
|
236
|
+
level: number | null;
|
|
237
|
+
setNumber?: number | null;
|
|
238
|
+
}
|
|
239
|
+
/** One set of a session as its history shows it: the plan's target and what was logged. */
|
|
240
|
+
export interface SessionSet<L extends SetPlace> {
|
|
241
|
+
block: string;
|
|
242
|
+
item: string;
|
|
243
|
+
exercise: string;
|
|
244
|
+
level: number | null;
|
|
245
|
+
setNumber: number;
|
|
246
|
+
/** The plan's target, or null for a set logged beyond the plan's. */
|
|
247
|
+
target: SetTarget | null;
|
|
248
|
+
logged: L | undefined;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The sets of a session for one person, in the plan's order, each with what they logged. An item
|
|
252
|
+
* for everyone has every exercise's sets; an item with levels the level they logged at (or its
|
|
253
|
+
* first level when they logged none of it); alternatives the one they did (or the first, when
|
|
254
|
+
* they did none). A set logged beyond the plan's sets follows its exercise's, with no target.
|
|
255
|
+
* Warm-ups are not logged and not listed. An item with levels and exercises for everyone has
|
|
256
|
+
* everyone's first, then the level's. A session with no plan (one imported from before) has the
|
|
257
|
+
* sets logged on it, as they were, with no targets.
|
|
258
|
+
*/
|
|
259
|
+
export declare function sessionSets<L extends SetPlace>(plan: Session | null | undefined, logged: readonly L[]): SessionSet<L>[];
|
|
260
|
+
/** How many sets a session's plan asks of one person, given what they logged (`sessionSets`). */
|
|
261
|
+
export declare function plannedSets(plan: Session | null | undefined, logged: readonly SetPlace[]): number;
|
|
262
|
+
/** Past sessions from their records and the sets logged on them (any order). */
|
|
263
|
+
export declare function pastSessionsOf(sessions: readonly RecordOut[], sets: readonly RecordOut[]): PastSession[];
|
|
264
|
+
/**
|
|
265
|
+
* One page of a person's past sessions (their own, dated `until` or before), newest first, each
|
|
266
|
+
* with its sets logged and planned. A member reads their own through the seam (`my.list`: never a
|
|
267
|
+
* class's sessions, never another person's sets); a coach names the client (`record.list`). Two
|
|
268
|
+
* reads for a page of sessions, and a few more only for a page with very many sets.
|
|
269
|
+
*/
|
|
270
|
+
export declare function loadPastSessions(read: (input: ListInput) => Promise<Page>, options: {
|
|
271
|
+
personId?: string;
|
|
272
|
+
until: string;
|
|
273
|
+
cursor?: string;
|
|
274
|
+
}): Promise<PastSessionsPage>;
|
|
275
|
+
/** What was done in a logged set, in words: "8 reps @ 20 kg · RPE 7". */
|
|
276
|
+
export declare function describeDone(set: LoggedSet): string;
|
|
277
|
+
/**
|
|
278
|
+
* A correction to a logged set from what was typed: only what changed, as `x.programs.logUpdate`
|
|
279
|
+
* takes it (the numbers done, effort, the note), or null when nothing did. An emptied note clears
|
|
280
|
+
* it; an emptied number is left as it was. The target, the exercise and who recorded it are not
|
|
281
|
+
* the person's to change; the host keeps them and bounds the numbers.
|
|
282
|
+
*/
|
|
283
|
+
export declare function correctionOf(set: LoggedSet, typed: {
|
|
284
|
+
count: string;
|
|
285
|
+
load: string;
|
|
286
|
+
rpe: string;
|
|
287
|
+
note: string;
|
|
288
|
+
}, timed: boolean): {
|
|
289
|
+
logId: string;
|
|
290
|
+
actual?: {
|
|
291
|
+
reps?: number;
|
|
292
|
+
seconds?: number;
|
|
293
|
+
load?: number;
|
|
294
|
+
};
|
|
295
|
+
rpe?: number;
|
|
296
|
+
note?: string | null;
|
|
297
|
+
} | null;
|
|
298
|
+
/** The hooks a history block may be given: a member's (`usePastSessions`) or a coach's. */
|
|
299
|
+
export type PastSessionsHooks = Partial<Pick<ProgramsHooks, "usePastSessions" | "useClientPastSessions">>;
|
|
300
|
+
/**
|
|
301
|
+
* The hook a history block lists past sessions with: a coach's client's when `personId` is given
|
|
302
|
+
* (the staff client's `useClientPastSessions`), else the member's own (`usePastSessions`). A
|
|
303
|
+
* block's hooks and person are fixed for its life, so the hook it calls never changes between
|
|
304
|
+
* renders: `const usePage = pastSessionsHook(programs, personId); const page = usePage({})`.
|
|
305
|
+
*/
|
|
306
|
+
export declare function pastSessionsHook(programs: PastSessionsHooks, personId: string | undefined): (options: {
|
|
307
|
+
until?: string;
|
|
308
|
+
cursor?: string;
|
|
309
|
+
}) => ReturnType<ProgramsHooks["usePastSessions"]>;
|
|
201
310
|
/**
|
|
202
311
|
* The faults the host reported for a layout, by path: `weeks.0.sessions.1.day` → "At most 7". The
|
|
203
312
|
* builder shows each beside the part it names, and a part's own faults and those inside it
|
|
@@ -214,6 +323,8 @@ export interface At {
|
|
|
214
323
|
block?: number;
|
|
215
324
|
item?: number;
|
|
216
325
|
level?: number;
|
|
326
|
+
/** An item with levels: its exercises for everyone, beside the levels. */
|
|
327
|
+
everyone?: boolean;
|
|
217
328
|
exercise?: number;
|
|
218
329
|
set?: number;
|
|
219
330
|
}
|
|
@@ -225,7 +336,7 @@ export declare function newSet(measure?: string | null): SetTarget;
|
|
|
225
336
|
export declare function newPrescription(exercise: string, measure?: string | null, sets?: number): Prescription;
|
|
226
337
|
/** The next free label in a list: A, B, C… for blocks; A1, A2… for a block's items. */
|
|
227
338
|
export declare function nextLabel(taken: readonly string[], prefix?: string): string;
|
|
228
|
-
/** The prescription at `at`: an "all" item's `exercise`, or a level's. */
|
|
339
|
+
/** The prescription at `at`: an "all" item's `exercise`, everyone's beside levels, or a level's. */
|
|
229
340
|
export declare function prescriptionAt(layout: Layout, at: At): Prescription;
|
|
230
341
|
/** Moves an entry of a list from one place to another (drag and drop, or a key). */
|
|
231
342
|
export declare function move<T>(list: readonly T[], from: number, to: number): T[];
|
|
@@ -266,7 +377,7 @@ export declare const layoutEdits: {
|
|
|
266
377
|
setLevelNumber: (layout: Layout, at: At, number: number) => Layout;
|
|
267
378
|
/** One, together or alternatives: a level's exercises kept, its shape changed. */
|
|
268
379
|
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). */
|
|
380
|
+
/** Another exercise beside the ones at `at` (an "all" item's, everyone's, or a level's). */
|
|
270
381
|
addExercise: (layout: Layout, at: At, exercise: string, measure?: string | null) => Layout;
|
|
271
382
|
removeExercise: (layout: Layout, at: At) => Layout;
|
|
272
383
|
/** The exercise at `at` replaced by another of the bank, keeping its sets and note. */
|
|
@@ -335,11 +446,17 @@ export declare const PROGRAMS_HOOKS_CALL: {
|
|
|
335
446
|
readonly useLogSet: readonly ["x.programs.logAdd"];
|
|
336
447
|
readonly useUpdateSet: readonly ["x.programs.logUpdate"];
|
|
337
448
|
readonly useMarkSession: readonly ["x.programs.sessionComplete"];
|
|
449
|
+
readonly useSessionLog: readonly ["x.programs.sessionGet", "x.programs.logAdd", "x.programs.logRemove"];
|
|
450
|
+
readonly useUnsavedSets: readonly [];
|
|
338
451
|
readonly useHistory: readonly ["x.programs.history"];
|
|
339
452
|
readonly useProgress: readonly ["x.programs.progress"];
|
|
340
453
|
readonly useClientSessions: readonly ["record.list"];
|
|
454
|
+
readonly usePastSessions: readonly ["my.list"];
|
|
455
|
+
readonly useClientPastSessions: readonly ["record.list"];
|
|
341
456
|
readonly usePeople: readonly ["person.list"];
|
|
342
|
-
readonly useClassTypes:
|
|
457
|
+
readonly useClassTypes: {
|
|
458
|
+
readonly anyOf: readonly [readonly ["record.list"], readonly ["my.list"]];
|
|
459
|
+
};
|
|
343
460
|
readonly useBank: readonly ["record.list"];
|
|
344
461
|
readonly useExercises: readonly ["record.list"];
|
|
345
462
|
readonly useCreateExercise: readonly ["record.create"];
|
|
@@ -699,6 +816,82 @@ export declare function createProgramsHooks<C extends ClientHolding>(react: Prog
|
|
|
699
816
|
isPending: boolean;
|
|
700
817
|
error: unknown;
|
|
701
818
|
};
|
|
819
|
+
/**
|
|
820
|
+
* Logging a session set by set (`./logging.ts`): the session from the host, and its log, a
|
|
821
|
+
* queue that shows every tick and key press at once and saves them in order, one at a time,
|
|
822
|
+
* retrying what fails. The log outlives the screen: leaving it drops nothing, and `flush`
|
|
823
|
+
* sends what waits (the app going to the background, finishing). A coach names the client.
|
|
824
|
+
*/
|
|
825
|
+
useSessionLog(input: In<"x.programs.sessionGet">): {
|
|
826
|
+
detail: {
|
|
827
|
+
data: {
|
|
828
|
+
session: {
|
|
829
|
+
id: string;
|
|
830
|
+
name: string | null;
|
|
831
|
+
date: string | null;
|
|
832
|
+
week: number | null;
|
|
833
|
+
day: number | null;
|
|
834
|
+
kind: string | null;
|
|
835
|
+
classType: string | null;
|
|
836
|
+
assignment: string | null;
|
|
837
|
+
programVersion: number | null;
|
|
838
|
+
programTitle: string | null;
|
|
839
|
+
classTypeName: string | null;
|
|
840
|
+
focus: string | null;
|
|
841
|
+
state: string | null;
|
|
842
|
+
plan: Record<string, unknown> | null;
|
|
843
|
+
};
|
|
844
|
+
exercises: {
|
|
845
|
+
id: string;
|
|
846
|
+
name: string | null;
|
|
847
|
+
video: string | null;
|
|
848
|
+
cues: string | null;
|
|
849
|
+
measure: string | null;
|
|
850
|
+
last: {
|
|
851
|
+
date: string | null;
|
|
852
|
+
reps: number | null;
|
|
853
|
+
seconds: number | null;
|
|
854
|
+
load: number | null;
|
|
855
|
+
rpe: number | null;
|
|
856
|
+
level: number | null;
|
|
857
|
+
}[];
|
|
858
|
+
}[];
|
|
859
|
+
logged: {
|
|
860
|
+
id: string;
|
|
861
|
+
item: string | null;
|
|
862
|
+
exercise: string | null;
|
|
863
|
+
setNumber: number | null;
|
|
864
|
+
level: number | null;
|
|
865
|
+
target: {
|
|
866
|
+
reps: number | null;
|
|
867
|
+
seconds: number | null;
|
|
868
|
+
load: number | null;
|
|
869
|
+
};
|
|
870
|
+
actual: {
|
|
871
|
+
reps: number | null;
|
|
872
|
+
seconds: number | null;
|
|
873
|
+
load: number | null;
|
|
874
|
+
};
|
|
875
|
+
rpe: number | null;
|
|
876
|
+
note: string | null;
|
|
877
|
+
recordedAs: string | null;
|
|
878
|
+
recordedByName: string | null;
|
|
879
|
+
exerciseName: string | null;
|
|
880
|
+
}[];
|
|
881
|
+
} | undefined;
|
|
882
|
+
isPending: boolean;
|
|
883
|
+
error: unknown;
|
|
884
|
+
refetch?: () => unknown;
|
|
885
|
+
};
|
|
886
|
+
log: SessionLog;
|
|
887
|
+
state: import("./logging.ts").LogState;
|
|
888
|
+
};
|
|
889
|
+
/** The sets not yet saved in every session's log, and a flush of them all (Today, the app). */
|
|
890
|
+
useUnsavedSets(): {
|
|
891
|
+
count: number;
|
|
892
|
+
failure: string | null;
|
|
893
|
+
flush: (timeoutMs?: number) => Promise<boolean>;
|
|
894
|
+
};
|
|
702
895
|
useHistory(input: In<"x.programs.history">): {
|
|
703
896
|
data: {
|
|
704
897
|
exercise: {
|
|
@@ -774,6 +967,29 @@ export declare function createProgramsHooks<C extends ClientHolding>(react: Prog
|
|
|
774
967
|
error: unknown;
|
|
775
968
|
refetch?: () => unknown;
|
|
776
969
|
};
|
|
970
|
+
/**
|
|
971
|
+
* A member's own past sessions, newest first (`loadPastSessions`): dated `until` (the
|
|
972
|
+
* person's local date; default today, UTC) or before. Pass a page's `nextCursor` for older.
|
|
973
|
+
*/
|
|
974
|
+
usePastSessions(options?: {
|
|
975
|
+
until?: string;
|
|
976
|
+
cursor?: string;
|
|
977
|
+
}): {
|
|
978
|
+
data: PastSessionsPage | undefined;
|
|
979
|
+
isPending: boolean;
|
|
980
|
+
error: unknown;
|
|
981
|
+
refetch?: () => unknown;
|
|
982
|
+
};
|
|
983
|
+
/** A client's past sessions, newest first (staff): as `usePastSessions`, naming the client. */
|
|
984
|
+
useClientPastSessions(personId: string, options?: {
|
|
985
|
+
until?: string;
|
|
986
|
+
cursor?: string;
|
|
987
|
+
}): {
|
|
988
|
+
data: PastSessionsPage | undefined;
|
|
989
|
+
isPending: boolean;
|
|
990
|
+
error: unknown;
|
|
991
|
+
refetch?: () => unknown;
|
|
992
|
+
};
|
|
777
993
|
/** People whose name contains `search` (staff): whom to assign a program to. */
|
|
778
994
|
usePeople(search: string): {
|
|
779
995
|
data: {
|
|
@@ -787,7 +1003,10 @@ export declare function createProgramsHooks<C extends ClientHolding>(react: Prog
|
|
|
787
1003
|
error: unknown;
|
|
788
1004
|
refetch?: () => unknown;
|
|
789
1005
|
};
|
|
790
|
-
/**
|
|
1006
|
+
/**
|
|
1007
|
+
* The class types, for a member choosing their class (`my.list`) or a coach assigning one
|
|
1008
|
+
* (`record.list`): whichever read the client holds, staff's first.
|
|
1009
|
+
*/
|
|
791
1010
|
useClassTypes(): {
|
|
792
1011
|
data: Page | undefined;
|
|
793
1012
|
isPending: boolean;
|
|
@@ -894,36 +1113,50 @@ export declare function createProgramsHooks<C extends ClientHolding>(react: Prog
|
|
|
894
1113
|
text: string;
|
|
895
1114
|
title?: string | undefined;
|
|
896
1115
|
kind?: "class" | "client" | "course" | undefined;
|
|
1116
|
+
key?: string | undefined;
|
|
1117
|
+
dryRun?: boolean | undefined;
|
|
897
1118
|
}): void;
|
|
898
1119
|
mutateAsync(input: {
|
|
899
1120
|
text: string;
|
|
900
1121
|
title?: string | undefined;
|
|
901
1122
|
kind?: "class" | "client" | "course" | undefined;
|
|
1123
|
+
key?: string | undefined;
|
|
1124
|
+
dryRun?: boolean | undefined;
|
|
902
1125
|
}): Promise<{
|
|
903
|
-
programId: string;
|
|
904
1126
|
title: string;
|
|
905
1127
|
weeks: number;
|
|
906
1128
|
sessions: number;
|
|
907
1129
|
published: false;
|
|
1130
|
+
programId: string | null;
|
|
1131
|
+
outcome: "created" | "updated" | "unchanged" | "conflict" | "invalid";
|
|
908
1132
|
items: number;
|
|
909
1133
|
unread: {
|
|
910
1134
|
line: number;
|
|
911
1135
|
text: string;
|
|
912
1136
|
reason: string;
|
|
913
1137
|
}[];
|
|
1138
|
+
faults: {
|
|
1139
|
+
path: string;
|
|
1140
|
+
message: string;
|
|
1141
|
+
}[];
|
|
914
1142
|
}>;
|
|
915
1143
|
data: {
|
|
916
|
-
programId: string;
|
|
917
1144
|
title: string;
|
|
918
1145
|
weeks: number;
|
|
919
1146
|
sessions: number;
|
|
920
1147
|
published: false;
|
|
1148
|
+
programId: string | null;
|
|
1149
|
+
outcome: "created" | "updated" | "unchanged" | "conflict" | "invalid";
|
|
921
1150
|
items: number;
|
|
922
1151
|
unread: {
|
|
923
1152
|
line: number;
|
|
924
1153
|
text: string;
|
|
925
1154
|
reason: string;
|
|
926
1155
|
}[];
|
|
1156
|
+
faults: {
|
|
1157
|
+
path: string;
|
|
1158
|
+
message: string;
|
|
1159
|
+
}[];
|
|
927
1160
|
} | undefined;
|
|
928
1161
|
isPending: boolean;
|
|
929
1162
|
error: unknown;
|
|
@@ -1036,11 +1269,17 @@ export declare function createProgramsHooks<C extends ClientHolding>(react: Prog
|
|
|
1036
1269
|
readonly useLogSet: readonly ["x.programs.logAdd"];
|
|
1037
1270
|
readonly useUpdateSet: readonly ["x.programs.logUpdate"];
|
|
1038
1271
|
readonly useMarkSession: readonly ["x.programs.sessionComplete"];
|
|
1272
|
+
readonly useSessionLog: readonly ["x.programs.sessionGet", "x.programs.logAdd", "x.programs.logRemove"];
|
|
1273
|
+
readonly useUnsavedSets: readonly [];
|
|
1039
1274
|
readonly useHistory: readonly ["x.programs.history"];
|
|
1040
1275
|
readonly useProgress: readonly ["x.programs.progress"];
|
|
1041
1276
|
readonly useClientSessions: readonly ["record.list"];
|
|
1277
|
+
readonly usePastSessions: readonly ["my.list"];
|
|
1278
|
+
readonly useClientPastSessions: readonly ["record.list"];
|
|
1042
1279
|
readonly usePeople: readonly ["person.list"];
|
|
1043
|
-
readonly useClassTypes:
|
|
1280
|
+
readonly useClassTypes: {
|
|
1281
|
+
readonly anyOf: readonly [readonly ["record.list"], readonly ["my.list"]];
|
|
1282
|
+
};
|
|
1044
1283
|
readonly useBank: readonly ["record.list"];
|
|
1045
1284
|
readonly useExercises: readonly ["record.list"];
|
|
1046
1285
|
readonly useCreateExercise: readonly ["record.create"];
|
|
@@ -1056,7 +1295,7 @@ export declare function createProgramsHooks<C extends ClientHolding>(react: Prog
|
|
|
1056
1295
|
readonly useRestoreVersion: readonly ["record.restoreVersion"];
|
|
1057
1296
|
readonly useWorkingCopy: readonly ["record.get", "record.update"];
|
|
1058
1297
|
}, import("@composable-os/client").OperationsOf<C>>;
|
|
1059
|
-
declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient): {
|
|
1298
|
+
declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient, holds?: (operation: Name) => boolean): {
|
|
1060
1299
|
useToday(input?: In<"x.programs.today">): {
|
|
1061
1300
|
data: {
|
|
1062
1301
|
date: string;
|
|
@@ -1388,6 +1627,82 @@ declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient): {
|
|
|
1388
1627
|
isPending: boolean;
|
|
1389
1628
|
error: unknown;
|
|
1390
1629
|
};
|
|
1630
|
+
/**
|
|
1631
|
+
* Logging a session set by set (`./logging.ts`): the session from the host, and its log, a
|
|
1632
|
+
* queue that shows every tick and key press at once and saves them in order, one at a time,
|
|
1633
|
+
* retrying what fails. The log outlives the screen: leaving it drops nothing, and `flush`
|
|
1634
|
+
* sends what waits (the app going to the background, finishing). A coach names the client.
|
|
1635
|
+
*/
|
|
1636
|
+
useSessionLog(input: In<"x.programs.sessionGet">): {
|
|
1637
|
+
detail: {
|
|
1638
|
+
data: {
|
|
1639
|
+
session: {
|
|
1640
|
+
id: string;
|
|
1641
|
+
name: string | null;
|
|
1642
|
+
date: string | null;
|
|
1643
|
+
week: number | null;
|
|
1644
|
+
day: number | null;
|
|
1645
|
+
kind: string | null;
|
|
1646
|
+
classType: string | null;
|
|
1647
|
+
assignment: string | null;
|
|
1648
|
+
programVersion: number | null;
|
|
1649
|
+
programTitle: string | null;
|
|
1650
|
+
classTypeName: string | null;
|
|
1651
|
+
focus: string | null;
|
|
1652
|
+
state: string | null;
|
|
1653
|
+
plan: Record<string, unknown> | null;
|
|
1654
|
+
};
|
|
1655
|
+
exercises: {
|
|
1656
|
+
id: string;
|
|
1657
|
+
name: string | null;
|
|
1658
|
+
video: string | null;
|
|
1659
|
+
cues: string | null;
|
|
1660
|
+
measure: string | null;
|
|
1661
|
+
last: {
|
|
1662
|
+
date: string | null;
|
|
1663
|
+
reps: number | null;
|
|
1664
|
+
seconds: number | null;
|
|
1665
|
+
load: number | null;
|
|
1666
|
+
rpe: number | null;
|
|
1667
|
+
level: number | null;
|
|
1668
|
+
}[];
|
|
1669
|
+
}[];
|
|
1670
|
+
logged: {
|
|
1671
|
+
id: string;
|
|
1672
|
+
item: string | null;
|
|
1673
|
+
exercise: string | null;
|
|
1674
|
+
setNumber: number | null;
|
|
1675
|
+
level: number | null;
|
|
1676
|
+
target: {
|
|
1677
|
+
reps: number | null;
|
|
1678
|
+
seconds: number | null;
|
|
1679
|
+
load: number | null;
|
|
1680
|
+
};
|
|
1681
|
+
actual: {
|
|
1682
|
+
reps: number | null;
|
|
1683
|
+
seconds: number | null;
|
|
1684
|
+
load: number | null;
|
|
1685
|
+
};
|
|
1686
|
+
rpe: number | null;
|
|
1687
|
+
note: string | null;
|
|
1688
|
+
recordedAs: string | null;
|
|
1689
|
+
recordedByName: string | null;
|
|
1690
|
+
exerciseName: string | null;
|
|
1691
|
+
}[];
|
|
1692
|
+
} | undefined;
|
|
1693
|
+
isPending: boolean;
|
|
1694
|
+
error: unknown;
|
|
1695
|
+
refetch?: () => unknown;
|
|
1696
|
+
};
|
|
1697
|
+
log: SessionLog;
|
|
1698
|
+
state: import("./logging.ts").LogState;
|
|
1699
|
+
};
|
|
1700
|
+
/** The sets not yet saved in every session's log, and a flush of them all (Today, the app). */
|
|
1701
|
+
useUnsavedSets(): {
|
|
1702
|
+
count: number;
|
|
1703
|
+
failure: string | null;
|
|
1704
|
+
flush: (timeoutMs?: number) => Promise<boolean>;
|
|
1705
|
+
};
|
|
1391
1706
|
useHistory(input: In<"x.programs.history">): {
|
|
1392
1707
|
data: {
|
|
1393
1708
|
exercise: {
|
|
@@ -1463,6 +1778,29 @@ declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient): {
|
|
|
1463
1778
|
error: unknown;
|
|
1464
1779
|
refetch?: () => unknown;
|
|
1465
1780
|
};
|
|
1781
|
+
/**
|
|
1782
|
+
* A member's own past sessions, newest first (`loadPastSessions`): dated `until` (the
|
|
1783
|
+
* person's local date; default today, UTC) or before. Pass a page's `nextCursor` for older.
|
|
1784
|
+
*/
|
|
1785
|
+
usePastSessions(options?: {
|
|
1786
|
+
until?: string;
|
|
1787
|
+
cursor?: string;
|
|
1788
|
+
}): {
|
|
1789
|
+
data: PastSessionsPage | undefined;
|
|
1790
|
+
isPending: boolean;
|
|
1791
|
+
error: unknown;
|
|
1792
|
+
refetch?: () => unknown;
|
|
1793
|
+
};
|
|
1794
|
+
/** A client's past sessions, newest first (staff): as `usePastSessions`, naming the client. */
|
|
1795
|
+
useClientPastSessions(personId: string, options?: {
|
|
1796
|
+
until?: string;
|
|
1797
|
+
cursor?: string;
|
|
1798
|
+
}): {
|
|
1799
|
+
data: PastSessionsPage | undefined;
|
|
1800
|
+
isPending: boolean;
|
|
1801
|
+
error: unknown;
|
|
1802
|
+
refetch?: () => unknown;
|
|
1803
|
+
};
|
|
1466
1804
|
/** People whose name contains `search` (staff): whom to assign a program to. */
|
|
1467
1805
|
usePeople(search: string): {
|
|
1468
1806
|
data: {
|
|
@@ -1476,7 +1814,10 @@ declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient): {
|
|
|
1476
1814
|
error: unknown;
|
|
1477
1815
|
refetch?: () => unknown;
|
|
1478
1816
|
};
|
|
1479
|
-
/**
|
|
1817
|
+
/**
|
|
1818
|
+
* The class types, for a member choosing their class (`my.list`) or a coach assigning one
|
|
1819
|
+
* (`record.list`): whichever read the client holds, staff's first.
|
|
1820
|
+
*/
|
|
1480
1821
|
useClassTypes(): {
|
|
1481
1822
|
data: Page | undefined;
|
|
1482
1823
|
isPending: boolean;
|
|
@@ -1583,36 +1924,50 @@ declare function allProgramsHooks(react: ProgramsReact, api: ProgramsClient): {
|
|
|
1583
1924
|
text: string;
|
|
1584
1925
|
title?: string | undefined;
|
|
1585
1926
|
kind?: "class" | "client" | "course" | undefined;
|
|
1927
|
+
key?: string | undefined;
|
|
1928
|
+
dryRun?: boolean | undefined;
|
|
1586
1929
|
}): void;
|
|
1587
1930
|
mutateAsync(input: {
|
|
1588
1931
|
text: string;
|
|
1589
1932
|
title?: string | undefined;
|
|
1590
1933
|
kind?: "class" | "client" | "course" | undefined;
|
|
1934
|
+
key?: string | undefined;
|
|
1935
|
+
dryRun?: boolean | undefined;
|
|
1591
1936
|
}): Promise<{
|
|
1592
|
-
programId: string;
|
|
1593
1937
|
title: string;
|
|
1594
1938
|
weeks: number;
|
|
1595
1939
|
sessions: number;
|
|
1596
1940
|
published: false;
|
|
1941
|
+
programId: string | null;
|
|
1942
|
+
outcome: "created" | "updated" | "unchanged" | "conflict" | "invalid";
|
|
1597
1943
|
items: number;
|
|
1598
1944
|
unread: {
|
|
1599
1945
|
line: number;
|
|
1600
1946
|
text: string;
|
|
1601
1947
|
reason: string;
|
|
1602
1948
|
}[];
|
|
1949
|
+
faults: {
|
|
1950
|
+
path: string;
|
|
1951
|
+
message: string;
|
|
1952
|
+
}[];
|
|
1603
1953
|
}>;
|
|
1604
1954
|
data: {
|
|
1605
|
-
programId: string;
|
|
1606
1955
|
title: string;
|
|
1607
1956
|
weeks: number;
|
|
1608
1957
|
sessions: number;
|
|
1609
1958
|
published: false;
|
|
1959
|
+
programId: string | null;
|
|
1960
|
+
outcome: "created" | "updated" | "unchanged" | "conflict" | "invalid";
|
|
1610
1961
|
items: number;
|
|
1611
1962
|
unread: {
|
|
1612
1963
|
line: number;
|
|
1613
1964
|
text: string;
|
|
1614
1965
|
reason: string;
|
|
1615
1966
|
}[];
|
|
1967
|
+
faults: {
|
|
1968
|
+
path: string;
|
|
1969
|
+
message: string;
|
|
1970
|
+
}[];
|
|
1616
1971
|
} | undefined;
|
|
1617
1972
|
isPending: boolean;
|
|
1618
1973
|
error: unknown;
|