@instructure/platform-modules 0.3.0 → 1.0.0

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 (108) hide show
  1. package/README.md +3 -2
  2. package/dist/adapters/canvasGraphql/index.d.ts +4 -40
  3. package/dist/adapters/canvasGraphql/index.d.ts.map +1 -1
  4. package/dist/adapters/canvasGraphql/normalize.d.ts +9 -220
  5. package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
  6. package/dist/adapters/canvasGraphql/queries.d.ts +7 -49
  7. package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
  8. package/dist/adapters/inMemory.d.ts +0 -40
  9. package/dist/adapters/inMemory.d.ts.map +1 -1
  10. package/dist/adapters/limits.d.ts +3 -81
  11. package/dist/adapters/limits.d.ts.map +1 -1
  12. package/dist/adapters/types.d.ts +11 -61
  13. package/dist/adapters/types.d.ts.map +1 -1
  14. package/dist/cache/invalidate.d.ts +0 -46
  15. package/dist/cache/invalidate.d.ts.map +1 -1
  16. package/dist/cache/keys.d.ts +3 -55
  17. package/dist/cache/keys.d.ts.map +1 -1
  18. package/dist/components/FilterChips.d.ts +4 -17
  19. package/dist/components/FilterChips.d.ts.map +1 -1
  20. package/dist/components/ModuleCard.d.ts +5 -29
  21. package/dist/components/ModuleCard.d.ts.map +1 -1
  22. package/dist/components/ModuleCard.stories.d.ts +14 -1
  23. package/dist/components/ModuleCard.stories.d.ts.map +1 -1
  24. package/dist/components/ModuleItemRow.d.ts +0 -10
  25. package/dist/components/ModuleItemRow.d.ts.map +1 -1
  26. package/dist/components/ModuleNumberBadge.d.ts +0 -1
  27. package/dist/components/ModuleNumberBadge.d.ts.map +1 -1
  28. package/dist/components/ModulesList.d.ts +2 -54
  29. package/dist/components/ModulesList.d.ts.map +1 -1
  30. package/dist/components/ModulesList.stories.d.ts +11 -128
  31. package/dist/components/ModulesList.stories.d.ts.map +1 -1
  32. package/dist/components/StatusPill.d.ts +4 -6
  33. package/dist/components/StatusPill.d.ts.map +1 -1
  34. package/dist/components/index.d.ts +1 -1
  35. package/dist/components/index.d.ts.map +1 -1
  36. package/dist/components/labels.d.ts +8 -78
  37. package/dist/components/labels.d.ts.map +1 -1
  38. package/dist/components/lightThemeDecorator.d.ts +3 -0
  39. package/dist/components/lightThemeDecorator.d.ts.map +1 -0
  40. package/dist/config/base.d.ts +0 -5
  41. package/dist/config/base.d.ts.map +1 -1
  42. package/dist/config/capabilities.d.ts +8 -0
  43. package/dist/config/capabilities.d.ts.map +1 -0
  44. package/dist/config/context.d.ts +1 -2
  45. package/dist/config/context.d.ts.map +1 -1
  46. package/dist/config/filters.d.ts +15 -0
  47. package/dist/config/filters.d.ts.map +1 -0
  48. package/dist/config/formatters.d.ts +15 -0
  49. package/dist/config/formatters.d.ts.map +1 -0
  50. package/dist/config/index.d.ts +9 -4
  51. package/dist/config/index.d.ts.map +1 -1
  52. package/dist/config/itemMeta.d.ts +5 -0
  53. package/dist/config/itemMeta.d.ts.map +1 -0
  54. package/dist/config/itemTypes.d.ts +4 -0
  55. package/dist/config/itemTypes.d.ts.map +1 -0
  56. package/dist/config/partialModulesConfig.d.ts +0 -1
  57. package/dist/config/partialModulesConfig.d.ts.map +1 -1
  58. package/dist/config/registry.d.ts +2 -30
  59. package/dist/config/registry.d.ts.map +1 -1
  60. package/dist/config/resolve.d.ts +0 -4
  61. package/dist/config/resolve.d.ts.map +1 -1
  62. package/dist/config/schemas.d.ts +37 -7
  63. package/dist/config/schemas.d.ts.map +1 -1
  64. package/dist/config/types.d.ts +8 -14
  65. package/dist/config/types.d.ts.map +1 -1
  66. package/dist/config/useFormatters.d.ts +10 -0
  67. package/dist/config/useFormatters.d.ts.map +1 -0
  68. package/dist/fixtures/generate.d.ts +1 -37
  69. package/dist/fixtures/generate.d.ts.map +1 -1
  70. package/dist/fixtures/index.d.ts +1 -1
  71. package/dist/fixtures/index.d.ts.map +1 -1
  72. package/dist/fixtures/scenarios.d.ts +4 -34
  73. package/dist/fixtures/scenarios.d.ts.map +1 -1
  74. package/dist/hooks/constants.d.ts +6 -40
  75. package/dist/hooks/constants.d.ts.map +1 -1
  76. package/dist/hooks/queryOptions.d.ts +2 -26
  77. package/dist/hooks/queryOptions.d.ts.map +1 -1
  78. package/dist/hooks/useItemsMode.d.ts +3 -84
  79. package/dist/hooks/useItemsMode.d.ts.map +1 -1
  80. package/dist/hooks/useModuleItemQueries.d.ts +1 -45
  81. package/dist/hooks/useModuleItemQueries.d.ts.map +1 -1
  82. package/dist/hooks/useModuleItems.d.ts +0 -16
  83. package/dist/hooks/useModuleItems.d.ts.map +1 -1
  84. package/dist/hooks/useModules.d.ts +3 -24
  85. package/dist/hooks/useModules.d.ts.map +1 -1
  86. package/dist/hooks/useModulesPageData.d.ts +9 -33
  87. package/dist/hooks/useModulesPageData.d.ts.map +1 -1
  88. package/dist/i18n.d.ts +8 -45
  89. package/dist/i18n.d.ts.map +1 -1
  90. package/dist/index.d.ts +5 -12
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +1874 -1344
  93. package/dist/types/domain.d.ts +9 -87
  94. package/dist/types/domain.d.ts.map +1 -1
  95. package/dist/types/enums.d.ts +5 -58
  96. package/dist/types/enums.d.ts.map +1 -1
  97. package/dist/types/extensions.d.ts +0 -43
  98. package/dist/types/extensions.d.ts.map +1 -1
  99. package/dist/types/filterClause.d.ts +18 -0
  100. package/dist/types/filterClause.d.ts.map +1 -0
  101. package/dist/types/index.d.ts +3 -2
  102. package/dist/types/index.d.ts.map +1 -1
  103. package/dist/types/navigation.d.ts +0 -6
  104. package/dist/types/navigation.d.ts.map +1 -1
  105. package/dist/types/schemas.d.ts +2 -28
  106. package/dist/types/schemas.d.ts.map +1 -1
  107. package/locales/en.json +20 -9
  108. package/package.json +35 -31
package/README.md CHANGED
@@ -38,7 +38,7 @@ const adapter = createCanvasGraphqlAdapter({ executeQuery })
38
38
  function ModulesPage({ courseId }: { courseId: string }) {
39
39
  const data = useModulesPageData({ courseId, adapter, view: 'student' })
40
40
  return (
41
- <ModulesI18nProvider translations={translations} locale={locale}>
41
+ <ModulesI18nProvider translations={translations} locale={locale} timezone={timezone}>
42
42
  <ModulesList data={data} courseName={courseName} />
43
43
  </ModulesI18nProvider>
44
44
  )
@@ -182,4 +182,5 @@ pnpm storybook
182
182
  - `docs/adr/` holds the decision records. The decision is append-only: supersede a record, never
183
183
  rewrite one. Filenames, headings and links may be corrected — see `docs/adr/README.md`.
184
184
  - Reasoning local to one file stays in a doc comment there. Start with `adapters/types.ts`,
185
- `adapters/limits.ts`, `hooks/constants.ts`, and `cache/invalidate.ts`.
185
+ `adapters/limits.ts` and `hooks/constants.ts`. Anything spanning files is a record in
186
+ `docs/adr/`.
@@ -1,54 +1,18 @@
1
+ import { FilterCapabilities } from '../../types/filterClause';
1
2
  import { ModulesDataAdapter } from '../types';
2
3
  import { UnsupportedModuleItem } from './normalize';
3
- /**
4
- * The Canvas GraphQL implementation of `ModulesDataAdapter`.
5
- *
6
- * `executeQuery` is injected rather than pulled from `usePlatformUi()`. Two
7
- * reasons, both load-bearing: the adapter stays a plain function that a test
8
- * can drive with `vi.fn()` and no React, and it stays host-agnostic — Canvas
9
- * Career supplies a different `executeQuery` (different endpoint, different
10
- * auth) for the identical documents.
11
- */
12
4
  export type ExecuteQuery = <TResult, TVariables>(query: unknown, variables: TVariables) => Promise<TResult>;
13
5
  export { INLINE_ITEM_LIMIT, INLINE_QUERY_NODE_BUDGET } from '../limits';
14
6
  export interface CanvasGraphqlAdapterOptions {
15
7
  executeQuery: ExecuteQuery;
16
- /** @see INLINE_ITEM_LIMIT */
17
8
  inlineItemLimit?: number;
18
- /** @see INLINE_QUERY_NODE_BUDGET */
19
9
  nodeBudget?: number;
20
- /**
21
- * Notified when an item is dropped for having a content type outside the
22
- * closed domain enum. Unset by default: dropping is the deliberate policy,
23
- * this is the seam for making it visible.
24
- */
25
10
  onUnsupportedItem?: (item: UnsupportedModuleItem) => void;
26
- /**
27
- * The student whose submissions to select, when there is one.
28
- *
29
- * Omit for a teacher, an admin, an observer, or any viewer without a single
30
- * subject. Omitting it is *safe by construction*: the submission field set is
31
- * then not requested at all, so `ModuleItem.status` comes back undefined —
32
- * already the contract's "not fetched" — rather than filled with somebody
33
- * else's data.
34
- *
35
- * Supplying it is what makes per-item status available, and it must be the
36
- * viewer's own id. Canvas's `submissionsConnection` returns *every* visible
37
- * student's submissions to a viewer holding `manage_grades` or
38
- * `view_all_grades`, ordered by `user_id`. @see the `SUBMISSION_FIELDS`
39
- * docstring in `./queries`.
40
- */
41
11
  studentId?: string | null;
42
- /**
43
- * Validate normalized output against the Zod schemas before returning.
44
- *
45
- * On by default. This is the check that keeps the GraphQL and REST adapters
46
- * from drifting, and it is the only place the contract is enforced at
47
- * runtime — turn it off only if a profile says it costs something real.
48
- */
49
12
  validate?: boolean;
13
+ capabilities?: FilterCapabilities;
50
14
  }
51
- export declare function createCanvasGraphqlAdapter({ executeQuery, inlineItemLimit, nodeBudget, onUnsupportedItem, studentId, validate, }: CanvasGraphqlAdapterOptions): ModulesDataAdapter;
15
+ export declare function createCanvasGraphqlAdapter({ executeQuery, inlineItemLimit, nodeBudget, onUnsupportedItem, studentId, validate, capabilities, }: CanvasGraphqlAdapterOptions): ModulesDataAdapter;
52
16
  export { GET_MODULE_ITEMS, GET_MODULES, type GetModuleItemsVariables, type GetModulesVariables, } from './queries';
53
- export { buildStudentContext, deriveModuleItemStatus, deriveModuleProgress, deriveModuleStatus, firstSubmission, type GetModuleItemsResult, type GetModulesResult, type GraphqlCompletionRequirement, type GraphqlModuleConnection, type GraphqlModuleItemConnection, type GraphqlModuleItemContent, type GraphqlModuleItemNode, type GraphqlModuleNode, type GraphqlModuleProgression, type GraphqlModuleStatistics, type GraphqlPageInfo, type GraphqlRequirement, type GraphqlSubmission, type GraphqlSubmissionConnection, type ModuleStudentContext, normalizeItemType, normalizeModule, normalizeModuleItem, normalizeModuleItemsPage, normalizeModulesPage, normalizePageInfo, type NormalizeOptions, PartialCanvasResponseError, type PartialResponseSubject, parseDurationMinutes, type UnsupportedModuleItem, } from './normalize';
17
+ export { buildStudentContext, deriveModuleItemStatus, deriveModuleProgress, firstSubmission, type GetModuleItemsResult, type GetModulesResult, type GraphqlCompletionRequirement, type GraphqlModuleConnection, type GraphqlModuleItemConnection, type GraphqlModuleItemContent, type GraphqlModuleItemNode, type GraphqlModuleNode, type GraphqlModuleProgression, type GraphqlModuleStatistics, type GraphqlPageInfo, type GraphqlRequirement, type GraphqlSubmission, type GraphqlSubmissionConnection, type ModuleStudentContext, normalizeItemType, normalizeModule, normalizeModuleItem, normalizeModuleItemsPage, normalizeModulesPage, normalizePageInfo, type NormalizeOptions, PartialCanvasResponseError, type PartialResponseSubject, parseDurationMinutes, type UnsupportedModuleItem, } from './normalize';
54
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/canvasGraphql/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAwC,kBAAkB,EAAE,MAAM,UAAU,CAAA;AACxF,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAA;AAQpB;;;;;;;;GAQG;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,UAAU,EAC7C,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,UAAU,KAClB,OAAO,CAAC,OAAO,CAAC,CAAA;AAUrB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAEvE,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,YAAY,CAAA;IAC1B,6BAA6B;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACzD;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA6BD,wBAAgB,0BAA0B,CAAC,EACzC,YAAY,EACZ,eAAmC,EACnC,UAAqC,EACrC,iBAAiB,EACjB,SAAS,EACT,QAAe,GAChB,EAAE,2BAA2B,GAAG,kBAAkB,CAgFlD;AAED,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/canvasGraphql/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,0BAA0B,CAAA;AAEhF,OAAO,KAAK,EAAwC,kBAAkB,EAAE,MAAM,UAAU,CAAA;AACxF,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAA;AAUpB,MAAM,MAAM,YAAY,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,EACjB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAA"}
@@ -1,19 +1,4 @@
1
- import { CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemsPage, ModuleItemStatus, ModuleItemType, ModuleProgress, ModulesPage, ModuleStatus, PageInfo } from '../../types/domain';
2
- /**
3
- * GraphQL node → domain model.
4
- *
5
- * Everything transport-shaped stops here. The three normalization rules from
6
- * `types/domain.ts` are enforced in this file and nowhere else:
7
- *
8
- * 1. **Ids are strings.** Canvas hands back `ID`, which the JSON transport
9
- * may render as a number; every id goes through `String()`.
10
- * 2. **`published` is always populated.** On this transport Canvas's resolver
11
- * cannot return null for any viewer, so a null is a partial response and
12
- * throws — see `resolvePublished`, which explains why the REST rule about
13
- * absence meaning "published" does not apply here.
14
- * 3. **One closed item enum.** `__typename` is the discriminator, with
15
- * `Assignment { isNewQuiz: true }` collapsing to `'quiz'`.
16
- */
1
+ import { CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemsPage, ModuleItemStatus, ModuleItemType, ModuleProgress, ModulesPage, PageInfo } from '../../types/domain';
17
2
  export interface GraphqlPageInfo {
18
3
  hasNextPage: boolean;
19
4
  endCursor: string | null;
@@ -24,17 +9,13 @@ export interface GraphqlCompletionRequirement {
24
9
  minScore?: number | null;
25
10
  minPercentage?: number | null;
26
11
  }
27
- /** One row of `submissionsConnection`. Present only for a student viewer. */
28
12
  export interface GraphqlSubmission {
29
13
  _id?: string | number | null;
30
- /** `SubmissionState`: unsubmitted | submitted | pending_review | graded | ungraded | deleted. */
31
14
  state?: string | null;
32
- /** `SubmissionGradingStatus`: needs_grading | needs_review | graded | excused. */
33
15
  gradingStatus?: string | null;
34
16
  submittedAt?: string | null;
35
17
  attempt?: number | null;
36
18
  missing?: boolean | null;
37
- /** Per-student, override-applied due date, denormalized onto the submission. */
38
19
  cachedDueDate?: string | null;
39
20
  }
40
21
  export interface GraphqlSubmissionConnection {
@@ -44,26 +25,24 @@ export interface GraphqlModuleItemContent {
44
25
  __typename?: string | null;
45
26
  isNewQuiz?: boolean | null;
46
27
  dueAt?: string | null;
47
- /** Declared on `ModuleItemInterface`; `null` for content that cannot be graded. */
48
28
  pointsPossible?: number | null;
49
29
  submissionsConnection?: GraphqlSubmissionConnection | null;
50
30
  }
51
- /** A `Requirement` as it appears in `ModuleProgression.requirementsMet`. */
52
31
  export interface GraphqlRequirement {
53
32
  id: string | number;
54
33
  type: string;
55
34
  minScore?: number | null;
56
35
  minPercentage?: number | null;
36
+ score?: number | null;
57
37
  }
58
38
  export interface GraphqlModuleProgression {
59
- /** locked | unlocked | started | completed. */
60
39
  workflowState?: string | null;
61
40
  completed?: boolean | null;
62
41
  locked?: boolean | null;
63
42
  started?: boolean | null;
64
43
  requirementsMet?: (GraphqlRequirement | null)[] | null;
44
+ incompleteRequirements?: (GraphqlRequirement | null)[] | null;
65
45
  }
66
- /** `Module.submissionStatistics`, i.e. Canvas's `ModuleStatistics`. */
67
46
  export interface GraphqlModuleStatistics {
68
47
  latestDueAt?: string | null;
69
48
  missingAssignmentCount?: number | null;
@@ -76,7 +55,6 @@ export interface GraphqlModuleItemNode {
76
55
  position?: number | null;
77
56
  indent?: number | null;
78
57
  published?: boolean | null;
79
- /** ISO 8601 duration, e.g. `PT45M`. Canvas Career only. */
80
58
  estimatedDuration?: string | null;
81
59
  content?: GraphqlModuleItemContent | null;
82
60
  }
@@ -90,22 +68,18 @@ export interface GraphqlModuleNode {
90
68
  position?: number | null;
91
69
  published?: boolean | null;
92
70
  unlockAt?: string | null;
93
- /**
94
- * `Int!` in the Canvas schema, so it is optional here only because a partial
95
- * response can omit it. `normalizeModule` treats that as a hard error rather
96
- * than a zero — see `PartialCanvasResponseError`.
97
- */
98
71
  moduleItemsTotalCount?: number | null;
99
72
  requirementCount?: number | null;
100
73
  requireSequentialProgress?: boolean | null;
101
74
  prerequisites?: ({
102
75
  id: string | number;
76
+ name?: string | null;
103
77
  } | null)[] | null;
104
78
  completionRequirements?: (GraphqlCompletionRequirement | null)[] | null;
105
- /** Absent for a teacher/anonymous viewer, and `null` when Canvas has none. */
106
79
  progression?: GraphqlModuleProgression | null;
107
80
  submissionStatistics?: GraphqlModuleStatistics | null;
108
81
  moduleItemsConnection?: GraphqlModuleItemConnection | null;
82
+ moduleStatus?: string | null;
109
83
  }
110
84
  export interface GraphqlModuleConnection {
111
85
  nodes?: (GraphqlModuleNode | null)[] | null;
@@ -123,222 +97,37 @@ export interface GetModuleItemsResult {
123
97
  moduleItemsConnection?: GraphqlModuleItemConnection | null;
124
98
  } | null;
125
99
  }
126
- /** What a `PartialCanvasResponseError` is about. */
127
100
  export type PartialResponseSubject = 'module' | 'moduleItem';
128
- /**
129
- * A row arrived without a field this adapter cannot responsibly guess.
130
- *
131
- * Thrown rather than defaulted, because in both current cases the
132
- * sensible-looking default is the dangerous one:
133
- *
134
- * - `moduleItemsTotalCount` is `Int!`. Coercing a missing value to `0` makes
135
- * `resolveItemsMode` see an empty course and answer `inline`, so the page
136
- * asks Canvas to inline every item it has — the most expensive transport
137
- * setting, chosen when the response is least trustworthy.
138
- * - `published` is null when the viewer cannot manage the object, which for
139
- * such a viewer means "published". For a viewer who *can* manage, Canvas
140
- * always sends a boolean, so a null contradicts what the host told us and
141
- * the wrong guess renders an unpublished thing as published — to the one
142
- * audience that acts on that badge.
143
- *
144
- * Failing is recoverable in a way silence is not: the hook surfaces the error,
145
- * the host can retry, and `useItemsMode` already falls through to `onDemand` on
146
- * a failed probe rather than deadlocking the page.
147
- */
148
101
  export declare class PartialCanvasResponseError extends Error {
149
102
  readonly subject: PartialResponseSubject;
150
- /** The module or item id, so a host can log which row came back incomplete. */
151
103
  readonly id: string;
152
- /** The field that was missing. */
153
104
  readonly field: string;
154
105
  constructor(subject: PartialResponseSubject, id: string, field: string);
155
106
  }
156
- /** Reported when a `__typename` has no place in the closed domain enum. */
157
107
  export interface UnsupportedModuleItem {
158
- /** The module item id, so a host can look the row up in Canvas. */
159
108
  id: string;
160
- /** The `content.__typename` we could not map, or `null` when content was absent. */
161
109
  typename: string | null;
162
110
  }
163
111
  export interface NormalizeOptions {
164
- /**
165
- * Called for every item dropped because its content type is outside the
166
- * closed enum (`AiExperience`, `PeerReviewSubAssignment`, or content that
167
- * was deleted and came back `null`).
168
- *
169
- * The alternatives were worse: widening the enum makes the shared contract
170
- * chase Canvas's release cadence, and throwing takes the whole page down for
171
- * one unknown row.
172
- *
173
- * Dropping is silent data loss, so it must not *also* be unobservable. This
174
- * defaults to a `console.warn` rather than to nothing — matching
175
- * `platform-datetime` and ~30 other files in the repo — because "a host can log
176
- * it" is only true if the host knows to opt in. Pass a no-op to silence it.
177
- */
178
112
  onUnsupportedItem?: (item: UnsupportedModuleItem) => void;
113
+ submissionsIncluded?: boolean;
179
114
  }
180
- /**
181
- * `__typename` (+ `isNewQuiz`) → domain type, or `null` when unmappable.
182
- *
183
- * A New Quiz is an `Assignment` with an LTI submission type in Canvas's data
184
- * model; every UI that shows it calls it a quiz, so rule 3 collapses it here
185
- * rather than leaving each caller to re-derive it.
186
- */
187
115
  export declare function normalizeItemType(content: GraphqlModuleItemContent | null | undefined): ModuleItemType | null;
188
- /**
189
- * ISO 8601 duration → whole minutes.
190
- *
191
- * Canvas exposes `estimatedDuration` as an `ISO8601Duration` scalar (`PT45M`)
192
- * while the domain model carries minutes, because that is the only unit either
193
- * host's UI renders. Year and month designators are rejected rather than
194
- * guessed at — they are not calendar-independent, and Canvas never emits them
195
- * for this field.
196
- */
197
116
  export declare function parseDurationMinutes(value: string | null | undefined): number | null;
198
- /**
199
- * Wire string → closed enum, with anything unrecognized becoming `'unknown'`.
200
- *
201
- * Unlike an unmappable item `__typename`, an unknown requirement type is not
202
- * dropped: the requirement still exists, the student still has to satisfy it,
203
- * and hiding the row would be a worse lie than labeling it vaguely.
204
- */
205
117
  export declare function normalizeCompletionRequirementType(type: string): CompletionRequirementType;
206
118
  export declare function normalizePageInfo(pageInfo: GraphqlPageInfo | null | undefined): PageInfo;
207
- /**
208
- * The module-level student state every item in that module is read against.
209
- *
210
- * Built once per module and threaded into the item normalizer so the inline and
211
- * on-demand paths derive the identical status for the identical item — which is
212
- * why `GET_MODULE_ITEMS` re-reads `progression` alongside its items.
213
- */
214
119
  export interface ModuleStudentContext {
215
- /** Canvas reports the module locked for this student. */
216
120
  locked: boolean;
217
- /** Raw `ModuleProgression.workflowState`: locked | unlocked | started | completed. */
218
121
  workflowState: string | null;
219
122
  completed: boolean;
220
123
  started: boolean;
221
- /**
222
- * Module *item* ids whose completion requirement the student has satisfied.
223
- *
224
- * `ModuleProgression.requirementsMet` is a list of `Requirement`, and
225
- * `Requirement.id` is the module item id — the same join `completionRequirements`
226
- * uses. The domain model wants a count, so the list collapses here.
227
- */
228
124
  requirementsMetItemIds: ReadonlySet<string>;
125
+ incompleteRequirementItemIds: ReadonlySet<string>;
229
126
  }
230
- /**
231
- * The student's submission for an item, or `null`.
232
- *
233
- * Canvas returns a connection because the field is shared with the teacher view
234
- * (where it is every student's submission); for a student it holds at most one
235
- * row, so the first non-null node is the answer.
236
- */
237
127
  export declare function firstSubmission(content: GraphqlModuleItemContent | null | undefined): GraphqlSubmission | null;
238
- /**
239
- * `progression` → the per-module student context, or `undefined` when there is
240
- * no student. This is the gate described at the top of this block.
241
- *
242
- * `requirementsMet` is filtered against the requirements the module currently
243
- * defines, matching Canvas's own `filterRequirementsMet`: a progression can
244
- * outlive the requirement that produced it, and counting a stale entry would
245
- * show a student 4 of 3. Canvas matches on id, type, `minScore` *and*
246
- * `minPercentage`; we match on id and type only, because the score bounds are
247
- * the part a teacher edits in place and an edited bound should not silently
248
- * un-meet a requirement the student genuinely satisfied.
249
- */
250
128
  export declare function buildStudentContext(progression: GraphqlModuleProgression | null | undefined, completionRequirements: readonly CompletionRequirement[]): ModuleStudentContext | undefined;
251
- /**
252
- * Per-item status. First rule that matches wins:
253
- *
254
- * 1. `locked` — the module is locked for this student. Canvas exposes no
255
- * per-item lock in this field set (`masteryPaths.locked` is
256
- * a host-specific affordance we deliberately do not fetch),
257
- * and a locked module is locked for every item in it.
258
- * 2. `missing` — `submission.missing`. Ahead of `graded` on purpose: this
259
- * is the precedence Canvas's own student pill uses, and a
260
- * teacher entering a zero on a missing submission should
261
- * not make the "Missing" chip stop finding it.
262
- * 3. `graded` — `state === 'graded'`, or `gradingStatus` is `graded`/
263
- * `excused`. Excused counts as graded because there is
264
- * nothing left for the student to do.
265
- * 4. `submitted` — handed in and awaiting a grade: `submittedAt` is set, or
266
- * the state is `submitted`/`pending_review`.
267
- * 5. `in_progress` — the student has engaged but produced nothing gradable:
268
- * either an attempt is open (`attempt > 0` with no
269
- * `submittedAt`), or the item's completion requirement is
270
- * already met with no submission at all — a viewed page, a
271
- * followed link, a contribution to an ungraded discussion.
272
- * 6. `not_started` — everything else.
273
- *
274
- * Rule 5 is the one to argue with. `ModuleItemStatus` has no "complete" member,
275
- * so a satisfied `must_view` requirement has nowhere else to land; the domain
276
- * comment already flags the same gap at module level ("All items complete" is
277
- * not in the designer's list). If the designer adds one, this is the rule to
278
- * change and the only one.
279
- */
280
- export declare function deriveModuleItemStatus(content: GraphqlModuleItemContent | null | undefined, itemId: string, student: ModuleStudentContext): ModuleItemStatus;
281
- /**
282
- * Per-module rollup. First rule that matches wins:
283
- *
284
- * 1. `locked` — `progression.locked` (or `workflowState === 'locked'`).
285
- * 2. `missing` — `submissionStatistics.missingAssignmentCount > 0` and
286
- * the module is not completed. That is the design's
287
- * "1+ item past due", read from the module-level
288
- * statistic rather than from items, so the filter row
289
- * works with nothing expanded.
290
- * 3. `all_graded` — completed, *and* items were fetched, *and* every
291
- * gradable one is `graded`.
292
- * 4. `all_submitted` — completed. The honest floor: `progression.completed`
293
- * means every requirement is met, which is submission,
294
- * not grading. See the caveat below.
295
- * 5. `in_progress` — started, or at least one requirement met.
296
- * 6. `not_started` — everything else.
297
- *
298
- * Caveat on rule 3: Canvas has no module-level "everything is graded" signal —
299
- * `ModuleStatistics` is only `latestDueAt` + `missingAssignmentCount`. So
300
- * `all_graded` is reachable **only in inline mode**, where the items ride along
301
- * with the module in the same response. Upgrading on the evidence we have beats
302
- * claiming a grade we cannot see.
303
- *
304
- * In `onDemand` mode a completed module reports `all_submitted` and stays there,
305
- * even after its items are fetched and every one of them is `graded`. That is a
306
- * real limitation, not a temporary state: `progress` is derived once, from the
307
- * list response, and nothing merges items back into it —
308
- * `normalizeModuleItemsPage` returns `{ items, pageInfo }` and `useModulesPageData`
309
- * never revisits the module. No upgrade to `all_graded` ever happens.
310
- *
311
- * Closing it means either recomputing the module's status in the UI from the items
312
- * it holds — which reintroduces the inline/onDemand asymmetry the module-level
313
- * design exists to avoid — or Canvas exposing the signal. Left open deliberately
314
- * rather than papered over.
315
- */
316
- export declare function deriveModuleStatus(student: ModuleStudentContext, missingCount: number, requirementsMet: number, items: ModuleItem[] | undefined): ModuleStatus;
317
- /**
318
- * The module's `ModuleProgress`, or `undefined` when there is no student.
319
- *
320
- * `requirementCount` is the module's own when Canvas set one and the number of
321
- * completion requirements otherwise — Canvas uses `requirement_count` for
322
- * "complete any N of these", so it is the denominator whenever it is present,
323
- * and the full list is the denominator when it is not. `requirementsMet` is
324
- * clamped to it so the pair can never read "3 of 1", and `percentComplete` is
325
- * derived from that same clamped pair rather than computed independently, so a
326
- * host can never render a bar that disagrees with the fraction beside it.
327
- */
328
- export declare function deriveModuleProgress(node: GraphqlModuleNode, completionRequirements: readonly CompletionRequirement[], student: ModuleStudentContext | undefined, items: ModuleItem[] | undefined): ModuleProgress | undefined;
329
- /**
330
- * A single item, or `null` when its content type is outside the closed enum.
331
- *
332
- * `dueAt` prefers `submission.cachedDueDate` — the per-student, override-applied
333
- * date Canvas denormalizes onto the submission row — and falls back to
334
- * `content.dueAt`. That ordering is what closes the gap a live-Canvas probe
335
- * found: `dueAt` exists on `Assignment` only, `Quiz` has none, and a graded
336
- * `Discussion` keeps its date on the backing assignment, but all three carry a
337
- * submission. The fallback still matters, because a teacher viewer gets an
338
- * assignment's `dueAt` and no submission at all.
339
- *
340
- * `status` is present only when `student` is — see the student-state block.
341
- */
129
+ export declare function deriveModuleItemStatus(content: GraphqlModuleItemContent | null | undefined, itemId: string, student: ModuleStudentContext, submissionsIncluded?: boolean): ModuleItemStatus;
130
+ export declare function deriveModuleProgress(node: GraphqlModuleNode, completionRequirements: readonly CompletionRequirement[], student: ModuleStudentContext | undefined): ModuleProgress | undefined;
342
131
  export declare function normalizeModuleItem(node: GraphqlModuleItemNode, moduleId: string, completionRequirementsByItemId: ReadonlyMap<string, CompletionRequirement>, options?: NormalizeOptions, student?: ModuleStudentContext): ModuleItem | null;
343
132
  export declare function normalizeModule(node: GraphqlModuleNode, options?: NormalizeOptions): Module;
344
133
  export declare function normalizeModulesPage(result: GetModulesResult | null | undefined, options?: NormalizeOptions): ModulesPage;
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/adapters/canvasGraphql/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,QAAQ,EACT,MAAM,oBAAoB,CAAA;AAG3B;;;;;;;;;;;;;;GAcG;AAOH,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,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ACjC,IAAI,EAAE,qBAAqB,EAC3B,QAAQ,EAAE,MAAM,EAChB,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAC1E,OAAO,GAAE,gBAAqB,EAC9B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,UAAU,GAAG,IAAI,CAgCnB;AAwCD,wBAAgB,eAAe,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAkC/F;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAC3C,OAAO,GAAE,gBAAqB,GAC7B,WAAW,CAUb;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,oBAAoB,GAAG,IAAI,GAAG,SAAS,EAC/C,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,GAC7B,eAAe,CAUjB"}
@@ -1,46 +1,5 @@
1
1
  import { DocumentNode } from 'graphql';
2
- /**
3
- * Module list, optionally with each module's items inlined.
4
- *
5
- * `includeItems` is expressed as an `@include` directive on the nested
6
- * `moduleItemsConnection` rather than as a second document. Reasoning:
7
- *
8
- * 1. One document means one operation name, which means one persisted-query
9
- * hash to register with Canvas. Two documents would double that
10
- * registration surface for what is a single conceptual read.
11
- * 2. The directive is evaluated server-side, so `includeItems: false` skips
12
- * resolving every per-item field — the title, content type, points and
13
- * submissions for each row.
14
- *
15
- * What it does *not* skip is the
16
- * `ModuleItemsVisibleLoader`. `moduleItemsTotalCount` and
17
- * `completionRequirements` are selected unconditionally and
18
- * `module_type.rb:137-141,166-169` resolves both through that same loader,
19
- * so it runs whatever `includeItems` is. The saving is per-item field
20
- * resolution, not the visibility query.
21
- * 3. The response type is a single shape with an optional key, which is
22
- * exactly how the domain model already treats it (`items?: ModuleItem[]`,
23
- * where `undefined` means "not fetched"). A second document would force
24
- * the normalizer to branch on which document produced the payload.
25
- *
26
- * `itemsFirst` bounds the inline item fetch. When a module has more items than
27
- * that, the normalizer drops the partial list rather than reporting a
28
- * truncated one — see `normalize.ts`.
29
- */
30
2
  export declare const GET_MODULES: DocumentNode;
31
- /**
32
- * A single module's items, paged on demand.
33
- *
34
- * `completionRequirements` is re-read at the module level here because a
35
- * requirement is stored on the module, keyed by item id — without it, items
36
- * fetched on demand would lose the requirement that items fetched inline keep,
37
- * and the two paths would produce different domain objects for the same item.
38
- *
39
- * `progression` is re-read for the same reason: `ModuleItem.status` depends on
40
- * module-level state (is the module locked for me, which of its requirements
41
- * have I met), so an item fetched on demand would otherwise carry a different
42
- * status from the identical item fetched inline.
43
- */
44
3
  export declare const GET_MODULE_ITEMS: DocumentNode;
45
4
  export interface GetModulesVariables {
46
5
  courseId: string;
@@ -48,17 +7,16 @@ export interface GetModulesVariables {
48
7
  after?: string | null;
49
8
  includeItems: boolean;
50
9
  itemsFirst: number;
51
- /**
52
- * Whether to select per-item submissions at all.
53
- *
54
- * False unless a `studentId` is known. Canvas's `submissionsConnection` is
55
- * *not* self-scoping for a privileged viewer — see the fragment docstring — so
56
- * the safe default is to ask for nothing.
57
- */
58
10
  includeSubmissions: boolean;
59
- /** The student whose submissions to select. Required whenever `includeSubmissions`. */
60
11
  studentId?: string | null;
12
+ filter?: ModuleFilterInput | null;
61
13
  }
14
+ /** The subset of Canvas's `ModuleFilterInput` this adapter compiles to. */
15
+ export interface ModuleFilterInput {
16
+ completionStatus?: ModuleCompletionStatus;
17
+ }
18
+ /** Canvas's `ModuleCompletionStatus`. `INCOMPLETE` includes locked, unlocked and started. */
19
+ export type ModuleCompletionStatus = 'COMPLETED' | 'INCOMPLETE' | 'IN_PROGRESS' | 'NOT_STARTED';
62
20
  export interface GetModuleItemsVariables {
63
21
  moduleId: string;
64
22
  includeSubmissions: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/adapters/canvasGraphql/queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAA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AAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAClC;AAED,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE,sBAAsB,CAAA;CAC1C;AAED,6FAA6F;AAC7F,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,aAAa,CAAA;AAE/F,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB"}
@@ -1,59 +1,19 @@
1
1
  import { Module, ModuleItem } from '../types/domain';
2
2
  import { ModulesDataAdapter } from './types';
3
- /**
4
- * An adapter backed by a plain object instead of a network.
5
- *
6
- * It exists so the hooks can be built and tested without waiting on a real
7
- * adapter, but it is not scaffolding — it stays as the test double for hook
8
- * tests and as the fastest way to render a modules UI in Storybook with no
9
- * server at all.
10
- *
11
- * It is a real implementation of the contract, deliberately: it paginates with
12
- * opaque cursors, honors `AbortSignal`, and declines to inline items for modules
13
- * over `INLINE_ITEM_LIMIT` — so hooks written against it meet the same edges
14
- * Canvas will hand them, including the one Canvas Career gets wrong.
15
- */
16
3
  export { INLINE_ITEM_LIMIT } from './limits';
17
4
  export interface InMemoryFixture {
18
- /**
19
- * The course these modules belong to.
20
- *
21
- * Present so the adapter can *check* it. Without it, `courseId` was
22
- * destructured and dropped, which meant one adapter instance served identical
23
- * modules for every course id in existence — and since `cache/keys.ts` keys the
24
- * query cache by `courseId`, the entire class of bug where it is mis-threaded,
25
- * defaulted or collided across courses was unfalsifiable against the package's
26
- * primary test double. A hook that hardcoded `courseId: '1'` internally would
27
- * have passed every test and every story.
28
- */
29
5
  courseId: string;
30
6
  modules: Module[];
31
7
  itemsByModuleId: Record<string, ModuleItem[]>;
32
8
  }
33
- /** What a served request was for. Handed to `onRequest`. */
34
9
  export interface InMemoryRequest {
35
10
  operation: 'listModules' | 'listModuleItems';
36
11
  courseId: string;
37
- /** Only set for `listModuleItems`. */
38
12
  moduleId?: string;
39
13
  }
40
14
  export interface InMemoryAdapterOptions {
41
- /**
42
- * Invoked once per served request. Test hook for asserting exact request
43
- * counts, which is how the scaling behavior is locked in.
44
- *
45
- * Receives the operation name for the common case, and the full request for
46
- * tests that care *which* course or module was asked for.
47
- */
48
15
  onRequest?: (operation: 'listModules' | 'listModuleItems', request: InMemoryRequest) => void;
49
16
  }
50
- /**
51
- * Thrown when a caller asks this adapter for a course it was not built for.
52
- *
53
- * A real transport would return that other course's data, or 404. Silently
54
- * serving the fixture regardless is the one behavior that could not happen in
55
- * production, so it is the one behavior the test double must not have.
56
- */
57
17
  export declare class InMemoryCourseMismatchError extends Error {
58
18
  readonly expected: string;
59
19
  readonly received: string;
@@ -1 +1 @@
1
- {"version":3,"file":"inMemory.d.ts","sourceRoot":"","sources":["../../src/adapters/inMemory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAgC,MAAM,iBAAiB,CAAA;AAEvF,OAAO,KAAK,EAAwC,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEvF;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE5C,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;CAC9C;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,aAAa,GAAG,iBAAiB,CAAA;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CA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