@milobedini/shared-types 1.0.44 → 1.0.46

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 (2) hide show
  1. package/dist/types.d.ts +52 -0
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -83,6 +83,7 @@ export type Module = {
83
83
  createdAt: string;
84
84
  updatedAt: string;
85
85
  enrolled?: string[];
86
+ accessPolicy: 'open' | 'enrolled' | 'assigned';
86
87
  };
87
88
  export type Choice = {
88
89
  text: string;
@@ -191,6 +192,11 @@ export type ModuleDetailResponse = {
191
192
  module: Module;
192
193
  questions: Question[];
193
194
  scoreBands: ScoreBand[];
195
+ meta?: {
196
+ canStart?: boolean;
197
+ canStartReason?: 'ok' | 'not_enrolled' | 'requires_assignment' | 'unauthenticated';
198
+ activeAssignmentId?: string;
199
+ };
194
200
  };
195
201
  export type StartAttemptResponse = {
196
202
  success: boolean;
@@ -219,6 +225,7 @@ export type MyAttemptsQuery = {
219
225
  moduleId?: string;
220
226
  limit?: number;
221
227
  cursor?: Cursor;
228
+ status?: 'submitted' | 'active';
222
229
  };
223
230
  export type MyAttemptsResponse = {
224
231
  success: boolean;
@@ -273,6 +280,7 @@ export type CreateModuleInput = {
273
280
  program: string;
274
281
  disclaimer?: string;
275
282
  imageUrl?: string;
283
+ accessPolicy?: 'open' | 'enrolled' | 'assigned';
276
284
  };
277
285
  export type CreateQuestionInput = {
278
286
  moduleId: string;
@@ -295,3 +303,47 @@ export type EnrolResponse = {
295
303
  success: boolean;
296
304
  message: string;
297
305
  };
306
+ export type AvailableSourceTag = 'open' | 'enrolled' | 'assigned';
307
+ export type AvailableModulesItem = {
308
+ module: Module;
309
+ meta: {
310
+ canStart: boolean;
311
+ canStartReason: 'ok' | 'not_enrolled' | 'requires_assignment';
312
+ source: AvailableSourceTag[];
313
+ activeAssignmentId?: string;
314
+ assignmentStatus?: 'assigned' | 'in_progress';
315
+ dueAt?: string;
316
+ };
317
+ };
318
+ export type AvailableModulesResponse = {
319
+ success: boolean;
320
+ items: AvailableModulesItem[];
321
+ };
322
+ export type AssignmentLatestAttemptPreview = {
323
+ _id: string;
324
+ completedAt?: string;
325
+ totalScore?: number;
326
+ scoreBandLabel?: string;
327
+ };
328
+ export type ModulePreviewForAssignment = Pick<Module, '_id' | 'title' | 'type' | 'accessPolicy'> & {
329
+ program?: never;
330
+ };
331
+ export type ProgramPreviewForAssignment = Pick<Program, '_id' | 'title'>;
332
+ export type MyAssignmentView = {
333
+ _id: string;
334
+ user: string;
335
+ therapist: string;
336
+ status: AssignmentStatus;
337
+ dueAt?: string;
338
+ recurrence?: AssignmentRecurrence;
339
+ notes?: string;
340
+ module: ModulePreviewForAssignment;
341
+ program: ProgramPreviewForAssignment;
342
+ latestAttempt?: AssignmentLatestAttemptPreview;
343
+ createdAt: string;
344
+ updatedAt: string;
345
+ };
346
+ export type MyAssignmentsResponse = {
347
+ success: boolean;
348
+ assignments: MyAssignmentView[];
349
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milobedini/shared-types",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [