@nikthegeek/dreamsforlittles-shared 0.18.1 → 0.18.2

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.
@@ -13,6 +13,8 @@ export declare const coachTodayNeedSchema: z.ZodObject<{
13
13
  invitationMethod: z.ZodNullable<z.ZodEnum<["email", "code"]>>;
14
14
  submittedAt: z.ZodNullable<z.ZodString>;
15
15
  questionnaireUpdatedAt: z.ZodNullable<z.ZodString>;
16
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ answerCount: z.ZodOptional<z.ZodNumber>;
16
18
  }, "strip", z.ZodTypeAny, {
17
19
  id: string;
18
20
  name: string;
@@ -27,6 +29,8 @@ export declare const coachTodayNeedSchema: z.ZodObject<{
27
29
  invitationMethod: "code" | "email" | null;
28
30
  submittedAt: string | null;
29
31
  questionnaireUpdatedAt: string | null;
32
+ leadId?: string | null | undefined;
33
+ answerCount?: number | undefined;
30
34
  }, {
31
35
  id: string;
32
36
  name: string;
@@ -41,7 +45,63 @@ export declare const coachTodayNeedSchema: z.ZodObject<{
41
45
  invitationMethod: "code" | "email" | null;
42
46
  submittedAt: string | null;
43
47
  questionnaireUpdatedAt: string | null;
48
+ leadId?: string | null | undefined;
49
+ answerCount?: number | undefined;
44
50
  }>;
51
+ export declare const coachTodayPlanNeedSchema: z.ZodObject<{
52
+ id: z.ZodString;
53
+ name: z.ZodString;
54
+ detail: z.ZodString;
55
+ organizationId: z.ZodString;
56
+ familyUserId: z.ZodNullable<z.ZodString>;
57
+ babyId: z.ZodNullable<z.ZodString>;
58
+ bookingId: z.ZodNullable<z.ZodString>;
59
+ questionnaireId: z.ZodNullable<z.ZodString>;
60
+ invitationId: z.ZodNullable<z.ZodString>;
61
+ invitationMethod: z.ZodNullable<z.ZodEnum<["email", "code"]>>;
62
+ submittedAt: z.ZodNullable<z.ZodString>;
63
+ questionnaireUpdatedAt: z.ZodNullable<z.ZodString>;
64
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ answerCount: z.ZodOptional<z.ZodNumber>;
66
+ } & {
67
+ kind: z.ZodLiteral<"plan">;
68
+ sleepPlanId: z.ZodString;
69
+ }, "strip", z.ZodTypeAny, {
70
+ id: string;
71
+ name: string;
72
+ organizationId: string;
73
+ familyUserId: string | null;
74
+ kind: "plan";
75
+ babyId: string | null;
76
+ detail: string;
77
+ bookingId: string | null;
78
+ questionnaireId: string | null;
79
+ invitationId: string | null;
80
+ invitationMethod: "code" | "email" | null;
81
+ submittedAt: string | null;
82
+ questionnaireUpdatedAt: string | null;
83
+ sleepPlanId: string;
84
+ leadId?: string | null | undefined;
85
+ answerCount?: number | undefined;
86
+ }, {
87
+ id: string;
88
+ name: string;
89
+ organizationId: string;
90
+ familyUserId: string | null;
91
+ kind: "plan";
92
+ babyId: string | null;
93
+ detail: string;
94
+ bookingId: string | null;
95
+ questionnaireId: string | null;
96
+ invitationId: string | null;
97
+ invitationMethod: "code" | "email" | null;
98
+ submittedAt: string | null;
99
+ questionnaireUpdatedAt: string | null;
100
+ sleepPlanId: string;
101
+ leadId?: string | null | undefined;
102
+ answerCount?: number | undefined;
103
+ }>;
104
+ export type CoachTodayPlanNeed = z.infer<typeof coachTodayPlanNeedSchema>;
45
105
  export declare const coachTodayCallSchema: z.ZodObject<{
46
106
  id: z.ZodString;
47
107
  organizationId: z.ZodString;
@@ -50,6 +110,8 @@ export declare const coachTodayCallSchema: z.ZodObject<{
50
110
  startsAt: z.ZodString;
51
111
  endsAt: z.ZodString;
52
112
  timeZone: z.ZodString;
113
+ familyUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
115
  }, "strip", z.ZodTypeAny, {
54
116
  id: string;
55
117
  name: string;
@@ -58,6 +120,8 @@ export declare const coachTodayCallSchema: z.ZodObject<{
58
120
  startsAt: string;
59
121
  endsAt: string;
60
122
  serviceName: string;
123
+ familyUserId?: string | null | undefined;
124
+ leadId?: string | null | undefined;
61
125
  }, {
62
126
  id: string;
63
127
  name: string;
@@ -66,7 +130,79 @@ export declare const coachTodayCallSchema: z.ZodObject<{
66
130
  startsAt: string;
67
131
  endsAt: string;
68
132
  serviceName: string;
133
+ familyUserId?: string | null | undefined;
134
+ leadId?: string | null | undefined;
135
+ }>;
136
+ export declare const coachTodaySummarySchema: z.ZodObject<{
137
+ timeZone: z.ZodString;
138
+ weekStartDate: z.ZodString;
139
+ activeStartedThisWeek: z.ZodNumber;
140
+ endingThisWeek: z.ZodNumber;
141
+ nextEnding: z.ZodNullable<z.ZodObject<{
142
+ familyName: z.ZodString;
143
+ daysLeft: z.ZodNumber;
144
+ }, "strip", z.ZodTypeAny, {
145
+ familyName: string;
146
+ daysLeft: number;
147
+ }, {
148
+ familyName: string;
149
+ daysLeft: number;
150
+ }>>;
151
+ enquiriesSinceYesterday: z.ZodNullable<z.ZodNumber>;
152
+ callsThisWeek: z.ZodNullable<z.ZodNumber>;
153
+ callsToday: z.ZodNullable<z.ZodNumber>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ timeZone: string;
156
+ weekStartDate: string;
157
+ activeStartedThisWeek: number;
158
+ endingThisWeek: number;
159
+ nextEnding: {
160
+ familyName: string;
161
+ daysLeft: number;
162
+ } | null;
163
+ enquiriesSinceYesterday: number | null;
164
+ callsThisWeek: number | null;
165
+ callsToday: number | null;
166
+ }, {
167
+ timeZone: string;
168
+ weekStartDate: string;
169
+ activeStartedThisWeek: number;
170
+ endingThisWeek: number;
171
+ nextEnding: {
172
+ familyName: string;
173
+ daysLeft: number;
174
+ } | null;
175
+ enquiriesSinceYesterday: number | null;
176
+ callsThisWeek: number | null;
177
+ callsToday: number | null;
178
+ }>;
179
+ export type CoachTodaySummary = z.infer<typeof coachTodaySummarySchema>;
180
+ export declare const coachTodayLastNightSchema: z.ZodObject<{
181
+ familyUserId: z.ZodString;
182
+ babyId: z.ZodString;
183
+ dateKey: z.ZodString;
184
+ timeZone: z.ZodString;
185
+ sleepMinutes: z.ZodNullable<z.ZodNumber>;
186
+ wakeCount: z.ZodNullable<z.ZodNumber>;
187
+ lastActivityAt: z.ZodNullable<z.ZodString>;
188
+ }, "strip", z.ZodTypeAny, {
189
+ timeZone: string;
190
+ familyUserId: string;
191
+ lastActivityAt: string | null;
192
+ babyId: string;
193
+ dateKey: string;
194
+ sleepMinutes: number | null;
195
+ wakeCount: number | null;
196
+ }, {
197
+ timeZone: string;
198
+ familyUserId: string;
199
+ lastActivityAt: string | null;
200
+ babyId: string;
201
+ dateKey: string;
202
+ sleepMinutes: number | null;
203
+ wakeCount: number | null;
69
204
  }>;
205
+ export type CoachTodayLastNight = z.infer<typeof coachTodayLastNightSchema>;
70
206
  export declare const coachTodayResponseSchema: z.ZodObject<{
71
207
  generatedAt: z.ZodString;
72
208
  needs: z.ZodArray<z.ZodObject<{
@@ -83,6 +219,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
83
219
  invitationMethod: z.ZodNullable<z.ZodEnum<["email", "code"]>>;
84
220
  submittedAt: z.ZodNullable<z.ZodString>;
85
221
  questionnaireUpdatedAt: z.ZodNullable<z.ZodString>;
222
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
+ answerCount: z.ZodOptional<z.ZodNumber>;
86
224
  }, "strip", z.ZodTypeAny, {
87
225
  id: string;
88
226
  name: string;
@@ -97,6 +235,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
97
235
  invitationMethod: "code" | "email" | null;
98
236
  submittedAt: string | null;
99
237
  questionnaireUpdatedAt: string | null;
238
+ leadId?: string | null | undefined;
239
+ answerCount?: number | undefined;
100
240
  }, {
101
241
  id: string;
102
242
  name: string;
@@ -111,6 +251,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
111
251
  invitationMethod: "code" | "email" | null;
112
252
  submittedAt: string | null;
113
253
  questionnaireUpdatedAt: string | null;
254
+ leadId?: string | null | undefined;
255
+ answerCount?: number | undefined;
114
256
  }>, "many">;
115
257
  calls: z.ZodArray<z.ZodObject<{
116
258
  id: z.ZodString;
@@ -120,6 +262,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
120
262
  startsAt: z.ZodString;
121
263
  endsAt: z.ZodString;
122
264
  timeZone: z.ZodString;
265
+ familyUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
266
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
267
  }, "strip", z.ZodTypeAny, {
124
268
  id: string;
125
269
  name: string;
@@ -128,6 +272,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
128
272
  startsAt: string;
129
273
  endsAt: string;
130
274
  serviceName: string;
275
+ familyUserId?: string | null | undefined;
276
+ leadId?: string | null | undefined;
131
277
  }, {
132
278
  id: string;
133
279
  name: string;
@@ -136,7 +282,130 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
136
282
  startsAt: string;
137
283
  endsAt: string;
138
284
  serviceName: string;
285
+ familyUserId?: string | null | undefined;
286
+ leadId?: string | null | undefined;
139
287
  }>, "many">;
288
+ summary: z.ZodOptional<z.ZodObject<{
289
+ timeZone: z.ZodString;
290
+ weekStartDate: z.ZodString;
291
+ activeStartedThisWeek: z.ZodNumber;
292
+ endingThisWeek: z.ZodNumber;
293
+ nextEnding: z.ZodNullable<z.ZodObject<{
294
+ familyName: z.ZodString;
295
+ daysLeft: z.ZodNumber;
296
+ }, "strip", z.ZodTypeAny, {
297
+ familyName: string;
298
+ daysLeft: number;
299
+ }, {
300
+ familyName: string;
301
+ daysLeft: number;
302
+ }>>;
303
+ enquiriesSinceYesterday: z.ZodNullable<z.ZodNumber>;
304
+ callsThisWeek: z.ZodNullable<z.ZodNumber>;
305
+ callsToday: z.ZodNullable<z.ZodNumber>;
306
+ }, "strip", z.ZodTypeAny, {
307
+ timeZone: string;
308
+ weekStartDate: string;
309
+ activeStartedThisWeek: number;
310
+ endingThisWeek: number;
311
+ nextEnding: {
312
+ familyName: string;
313
+ daysLeft: number;
314
+ } | null;
315
+ enquiriesSinceYesterday: number | null;
316
+ callsThisWeek: number | null;
317
+ callsToday: number | null;
318
+ }, {
319
+ timeZone: string;
320
+ weekStartDate: string;
321
+ activeStartedThisWeek: number;
322
+ endingThisWeek: number;
323
+ nextEnding: {
324
+ familyName: string;
325
+ daysLeft: number;
326
+ } | null;
327
+ enquiriesSinceYesterday: number | null;
328
+ callsThisWeek: number | null;
329
+ callsToday: number | null;
330
+ }>>;
331
+ planNeeds: z.ZodOptional<z.ZodArray<z.ZodObject<{
332
+ id: z.ZodString;
333
+ name: z.ZodString;
334
+ detail: z.ZodString;
335
+ organizationId: z.ZodString;
336
+ familyUserId: z.ZodNullable<z.ZodString>;
337
+ babyId: z.ZodNullable<z.ZodString>;
338
+ bookingId: z.ZodNullable<z.ZodString>;
339
+ questionnaireId: z.ZodNullable<z.ZodString>;
340
+ invitationId: z.ZodNullable<z.ZodString>;
341
+ invitationMethod: z.ZodNullable<z.ZodEnum<["email", "code"]>>;
342
+ submittedAt: z.ZodNullable<z.ZodString>;
343
+ questionnaireUpdatedAt: z.ZodNullable<z.ZodString>;
344
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
345
+ answerCount: z.ZodOptional<z.ZodNumber>;
346
+ } & {
347
+ kind: z.ZodLiteral<"plan">;
348
+ sleepPlanId: z.ZodString;
349
+ }, "strip", z.ZodTypeAny, {
350
+ id: string;
351
+ name: string;
352
+ organizationId: string;
353
+ familyUserId: string | null;
354
+ kind: "plan";
355
+ babyId: string | null;
356
+ detail: string;
357
+ bookingId: string | null;
358
+ questionnaireId: string | null;
359
+ invitationId: string | null;
360
+ invitationMethod: "code" | "email" | null;
361
+ submittedAt: string | null;
362
+ questionnaireUpdatedAt: string | null;
363
+ sleepPlanId: string;
364
+ leadId?: string | null | undefined;
365
+ answerCount?: number | undefined;
366
+ }, {
367
+ id: string;
368
+ name: string;
369
+ organizationId: string;
370
+ familyUserId: string | null;
371
+ kind: "plan";
372
+ babyId: string | null;
373
+ detail: string;
374
+ bookingId: string | null;
375
+ questionnaireId: string | null;
376
+ invitationId: string | null;
377
+ invitationMethod: "code" | "email" | null;
378
+ submittedAt: string | null;
379
+ questionnaireUpdatedAt: string | null;
380
+ sleepPlanId: string;
381
+ leadId?: string | null | undefined;
382
+ answerCount?: number | undefined;
383
+ }>, "many">>;
384
+ lastNight: z.ZodOptional<z.ZodArray<z.ZodObject<{
385
+ familyUserId: z.ZodString;
386
+ babyId: z.ZodString;
387
+ dateKey: z.ZodString;
388
+ timeZone: z.ZodString;
389
+ sleepMinutes: z.ZodNullable<z.ZodNumber>;
390
+ wakeCount: z.ZodNullable<z.ZodNumber>;
391
+ lastActivityAt: z.ZodNullable<z.ZodString>;
392
+ }, "strip", z.ZodTypeAny, {
393
+ timeZone: string;
394
+ familyUserId: string;
395
+ lastActivityAt: string | null;
396
+ babyId: string;
397
+ dateKey: string;
398
+ sleepMinutes: number | null;
399
+ wakeCount: number | null;
400
+ }, {
401
+ timeZone: string;
402
+ familyUserId: string;
403
+ lastActivityAt: string | null;
404
+ babyId: string;
405
+ dateKey: string;
406
+ sleepMinutes: number | null;
407
+ wakeCount: number | null;
408
+ }>, "many">>;
140
409
  }, "strip", z.ZodTypeAny, {
141
410
  generatedAt: string;
142
411
  needs: {
@@ -153,6 +422,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
153
422
  invitationMethod: "code" | "email" | null;
154
423
  submittedAt: string | null;
155
424
  questionnaireUpdatedAt: string | null;
425
+ leadId?: string | null | undefined;
426
+ answerCount?: number | undefined;
156
427
  }[];
157
428
  calls: {
158
429
  id: string;
@@ -162,7 +433,49 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
162
433
  startsAt: string;
163
434
  endsAt: string;
164
435
  serviceName: string;
436
+ familyUserId?: string | null | undefined;
437
+ leadId?: string | null | undefined;
165
438
  }[];
439
+ summary?: {
440
+ timeZone: string;
441
+ weekStartDate: string;
442
+ activeStartedThisWeek: number;
443
+ endingThisWeek: number;
444
+ nextEnding: {
445
+ familyName: string;
446
+ daysLeft: number;
447
+ } | null;
448
+ enquiriesSinceYesterday: number | null;
449
+ callsThisWeek: number | null;
450
+ callsToday: number | null;
451
+ } | undefined;
452
+ planNeeds?: {
453
+ id: string;
454
+ name: string;
455
+ organizationId: string;
456
+ familyUserId: string | null;
457
+ kind: "plan";
458
+ babyId: string | null;
459
+ detail: string;
460
+ bookingId: string | null;
461
+ questionnaireId: string | null;
462
+ invitationId: string | null;
463
+ invitationMethod: "code" | "email" | null;
464
+ submittedAt: string | null;
465
+ questionnaireUpdatedAt: string | null;
466
+ sleepPlanId: string;
467
+ leadId?: string | null | undefined;
468
+ answerCount?: number | undefined;
469
+ }[] | undefined;
470
+ lastNight?: {
471
+ timeZone: string;
472
+ familyUserId: string;
473
+ lastActivityAt: string | null;
474
+ babyId: string;
475
+ dateKey: string;
476
+ sleepMinutes: number | null;
477
+ wakeCount: number | null;
478
+ }[] | undefined;
166
479
  }, {
167
480
  generatedAt: string;
168
481
  needs: {
@@ -179,6 +492,8 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
179
492
  invitationMethod: "code" | "email" | null;
180
493
  submittedAt: string | null;
181
494
  questionnaireUpdatedAt: string | null;
495
+ leadId?: string | null | undefined;
496
+ answerCount?: number | undefined;
182
497
  }[];
183
498
  calls: {
184
499
  id: string;
@@ -188,7 +503,49 @@ export declare const coachTodayResponseSchema: z.ZodObject<{
188
503
  startsAt: string;
189
504
  endsAt: string;
190
505
  serviceName: string;
506
+ familyUserId?: string | null | undefined;
507
+ leadId?: string | null | undefined;
191
508
  }[];
509
+ summary?: {
510
+ timeZone: string;
511
+ weekStartDate: string;
512
+ activeStartedThisWeek: number;
513
+ endingThisWeek: number;
514
+ nextEnding: {
515
+ familyName: string;
516
+ daysLeft: number;
517
+ } | null;
518
+ enquiriesSinceYesterday: number | null;
519
+ callsThisWeek: number | null;
520
+ callsToday: number | null;
521
+ } | undefined;
522
+ planNeeds?: {
523
+ id: string;
524
+ name: string;
525
+ organizationId: string;
526
+ familyUserId: string | null;
527
+ kind: "plan";
528
+ babyId: string | null;
529
+ detail: string;
530
+ bookingId: string | null;
531
+ questionnaireId: string | null;
532
+ invitationId: string | null;
533
+ invitationMethod: "code" | "email" | null;
534
+ submittedAt: string | null;
535
+ questionnaireUpdatedAt: string | null;
536
+ sleepPlanId: string;
537
+ leadId?: string | null | undefined;
538
+ answerCount?: number | undefined;
539
+ }[] | undefined;
540
+ lastNight?: {
541
+ timeZone: string;
542
+ familyUserId: string;
543
+ lastActivityAt: string | null;
544
+ babyId: string;
545
+ dateKey: string;
546
+ sleepMinutes: number | null;
547
+ wakeCount: number | null;
548
+ }[] | undefined;
192
549
  }>;
193
550
  export declare const coachQuestionnaireOpenedRequestSchema: z.ZodObject<{
194
551
  submittedAt: z.ZodString;
@@ -13,7 +13,13 @@ export const coachTodayNeedSchema = z.object({
13
13
  invitationId: idSchema.nullable(),
14
14
  invitationMethod: z.enum(["email", "code"]).nullable(),
15
15
  submittedAt: isoDateStringSchema.nullable(),
16
- questionnaireUpdatedAt: isoDateStringSchema.nullable()
16
+ questionnaireUpdatedAt: isoDateStringSchema.nullable(),
17
+ leadId: idSchema.nullable().optional(),
18
+ answerCount: z.number().int().nonnegative().optional()
19
+ });
20
+ // Separate optional collection: legacy phone parsers retain their four-kind queue.
21
+ export const coachTodayPlanNeedSchema = coachTodayNeedSchema.extend({
22
+ kind: z.literal("plan"), sleepPlanId: idSchema
17
23
  });
18
24
  export const coachTodayCallSchema = z.object({
19
25
  id: idSchema,
@@ -22,12 +28,32 @@ export const coachTodayCallSchema = z.object({
22
28
  serviceName: z.string(),
23
29
  startsAt: isoDateStringSchema,
24
30
  endsAt: isoDateStringSchema,
25
- timeZone: z.string()
31
+ timeZone: z.string(),
32
+ familyUserId: idSchema.nullable().optional(),
33
+ leadId: idSchema.nullable().optional()
34
+ });
35
+ export const coachTodaySummarySchema = z.object({
36
+ timeZone: z.string().min(1), weekStartDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
37
+ activeStartedThisWeek: z.number().int().nonnegative(),
38
+ endingThisWeek: z.number().int().nonnegative(),
39
+ nextEnding: z.object({ familyName: z.string(), daysLeft: z.number().int().min(0).max(6) }).nullable(),
40
+ enquiriesSinceYesterday: z.number().int().nonnegative().nullable(),
41
+ callsThisWeek: z.number().int().nonnegative().nullable(),
42
+ callsToday: z.number().int().nonnegative().nullable()
43
+ });
44
+ export const coachTodayLastNightSchema = z.object({
45
+ familyUserId: idSchema, babyId: idSchema,
46
+ dateKey: z.string().regex(/^\d{4}-\d{2}-\d{2}$/), timeZone: z.string().min(1),
47
+ sleepMinutes: z.number().nonnegative().nullable(), wakeCount: z.number().int().nonnegative().nullable(),
48
+ lastActivityAt: isoDateStringSchema.nullable()
26
49
  });
27
50
  export const coachTodayResponseSchema = z.object({
28
51
  generatedAt: isoDateStringSchema,
29
52
  needs: z.array(coachTodayNeedSchema),
30
- calls: z.array(coachTodayCallSchema)
53
+ calls: z.array(coachTodayCallSchema),
54
+ summary: coachTodaySummarySchema.optional(),
55
+ planNeeds: z.array(coachTodayPlanNeedSchema).optional(),
56
+ lastNight: z.array(coachTodayLastNightSchema).optional()
31
57
  });
32
58
  export const coachQuestionnaireOpenedRequestSchema = z.object({ submittedAt: isoDateStringSchema, updatedAt: isoDateStringSchema }).strict();
33
59
  //# sourceMappingURL=coach-today.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coach-today.js","sourceRoot":"","sources":["../src/coach-today.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,C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E,CAAC,CAAC,MAAM,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { coachTodayCallSchema, coachTodayResponseSchema, coachTodayNeedSchema } from "./coach-today.js";
3
+ const base = { generatedAt: "2026-11-02T10:00:00.000Z", needs: [], calls: [] };
4
+ const summary = { timeZone: "Europe/Athens", weekStartDate: "2026-11-02", activeStartedThisWeek: 2,
5
+ endingThisWeek: 3, nextEnding: { familyName: "Hannah", daysLeft: 1 }, enquiriesSinceYesterday: 2, callsThisWeek: 4, callsToday: 2 };
6
+ describe("Coach Today additive summary", () => {
7
+ it("keeps last-night child facts optional, with zero distinct from unknown", () => {
8
+ const child = { familyUserId: "f", babyId: "b", dateKey: "2026-11-01", timeZone: "UTC", sleepMinutes: 60, wakeCount: 0, lastActivityAt: null };
9
+ expect(coachTodayResponseSchema.parse({ ...base, lastNight: [child] }).lastNight).toEqual([child]);
10
+ expect(coachTodayResponseSchema.safeParse({ ...base, lastNight: [{ ...child, wakeCount: -1 }] }).success).toBe(false);
11
+ expect(coachTodayResponseSchema.omit({ lastNight: true }).parse({ ...base, lastNight: [child] })).toEqual(base);
12
+ });
13
+ it("retains the existing response contract when summary is absent", () => expect(coachTodayResponseSchema.parse(base)).toEqual(base));
14
+ it("accepts known zero and disabled/unknown counters separately", () => {
15
+ expect(coachTodayResponseSchema.parse({ ...base, summary: { ...summary, callsThisWeek: 0, enquiriesSinceYesterday: null } }).summary)
16
+ .toMatchObject({ callsThisWeek: 0, enquiriesSinceYesterday: null });
17
+ });
18
+ it("rejects negative counts and ending dates outside the current week", () => {
19
+ expect(coachTodayResponseSchema.safeParse({ ...base, summary: { ...summary, callsThisWeek: -1 } }).success).toBe(false);
20
+ expect(coachTodayResponseSchema.safeParse({ ...base, summary: { ...summary, nextEnding: { familyName: "Hannah", daysLeft: 7 } } }).success).toBe(false);
21
+ });
22
+ it("keeps plan tasks outside the legacy kind enum and optional for old clients", () => {
23
+ const oldNeed = { id: "plan:1", kind: "plan", name: "Family", detail: "Sleep plan drafted, not shared", organizationId: "org",
24
+ familyUserId: "family", babyId: "child", bookingId: null, questionnaireId: null, invitationId: null,
25
+ invitationMethod: null, submittedAt: null, questionnaireUpdatedAt: null, sleepPlanId: "plan" };
26
+ expect(coachTodayNeedSchema.safeParse(oldNeed).success).toBe(false);
27
+ expect(coachTodayResponseSchema.parse({ ...base, planNeeds: [oldNeed] }).planNeeds).toHaveLength(1);
28
+ expect(coachTodayResponseSchema.omit({ planNeeds: true }).parse({ ...base, planNeeds: [oldNeed] })).toEqual(base);
29
+ });
30
+ it("keeps call identities optional and older call parsers can discard them", () => {
31
+ const call = { id: "booking", organizationId: "org", name: "Family", serviceName: "Review",
32
+ startsAt: base.generatedAt, endsAt: "2026-11-02T10:30:00.000Z", timeZone: "UTC" };
33
+ expect(coachTodayResponseSchema.parse({ ...base, calls: [call] }).calls).toEqual([call]);
34
+ expect(coachTodayResponseSchema.parse({ ...base, calls: [{ ...call, familyUserId: "family", leadId: null }] }).calls[0])
35
+ .toMatchObject({ familyUserId: "family", leadId: null });
36
+ expect(coachTodayCallSchema.omit({ familyUserId: true, leadId: true })
37
+ .parse({ ...call, familyUserId: "family", leadId: "lead" })).toEqual(call);
38
+ });
39
+ });
40
+ //# sourceMappingURL=coach-today.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coach-today.test.js","sourceRoot":"","sources":["../src/coach-today.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxG,MAAM,IAAI,GAAG,EAAE,WAAW,EAAE,0BAA0B,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC/E,MAAM,OAAO,GAAG,EAAE,QAAQ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EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aACrH,aAAa,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;aACnE,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nikthegeek/dreamsforlittles-shared",
3
3
  "private": false,
4
- "version": "0.18.1",
4
+ "version": "0.18.2",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",