@instructure/platform-modules 0.3.0 → 0.4.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.
- package/dist/adapters/canvasGraphql/index.d.ts +7 -33
- package/dist/adapters/canvasGraphql/index.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/normalize.d.ts +44 -186
- package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/queries.d.ts +8 -36
- package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
- package/dist/adapters/inMemory.d.ts +1 -25
- package/dist/adapters/inMemory.d.ts.map +1 -1
- package/dist/adapters/limits.d.ts +17 -74
- package/dist/adapters/limits.d.ts.map +1 -1
- package/dist/adapters/types.d.ts +10 -40
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cache/invalidate.d.ts +0 -23
- package/dist/cache/invalidate.d.ts.map +1 -1
- package/dist/cache/keys.d.ts +2 -43
- package/dist/cache/keys.d.ts.map +1 -1
- package/dist/components/FilterChips.d.ts +4 -10
- package/dist/components/FilterChips.d.ts.map +1 -1
- package/dist/components/ModuleCard.d.ts +10 -25
- package/dist/components/ModuleCard.d.ts.map +1 -1
- package/dist/components/ModuleCard.stories.d.ts +15 -0
- package/dist/components/ModuleCard.stories.d.ts.map +1 -1
- package/dist/components/ModuleItemRow.d.ts.map +1 -1
- package/dist/components/ModuleNumberBadge.d.ts.map +1 -1
- package/dist/components/ModulesList.d.ts +2 -23
- package/dist/components/ModulesList.d.ts.map +1 -1
- package/dist/components/ModulesList.stories.d.ts +22 -81
- package/dist/components/ModulesList.stories.d.ts.map +1 -1
- package/dist/components/StatusPill.d.ts +0 -3
- package/dist/components/StatusPill.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/labels.d.ts +26 -43
- package/dist/components/labels.d.ts.map +1 -1
- package/dist/config/context.d.ts +0 -1
- package/dist/config/context.d.ts.map +1 -1
- package/dist/config/registry.d.ts +5 -13
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/types.d.ts +0 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/fixtures/generate.d.ts +6 -17
- package/dist/fixtures/generate.d.ts.map +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fixtures/index.d.ts.map +1 -1
- package/dist/fixtures/scenarios.d.ts +7 -32
- package/dist/fixtures/scenarios.d.ts.map +1 -1
- package/dist/hooks/constants.d.ts +4 -21
- package/dist/hooks/constants.d.ts.map +1 -1
- package/dist/hooks/queryOptions.d.ts +3 -24
- package/dist/hooks/queryOptions.d.ts.map +1 -1
- package/dist/hooks/useItemsMode.d.ts +3 -52
- package/dist/hooks/useItemsMode.d.ts.map +1 -1
- package/dist/hooks/useModuleItemQueries.d.ts +0 -38
- package/dist/hooks/useModuleItemQueries.d.ts.map +1 -1
- package/dist/hooks/useModulesPageData.d.ts +3 -29
- package/dist/hooks/useModulesPageData.d.ts.map +1 -1
- package/dist/i18n.d.ts +13 -20
- package/dist/i18n.d.ts.map +1 -1
- package/dist/index.d.ts +3 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1223 -1076
- package/dist/types/domain.d.ts +25 -80
- package/dist/types/domain.d.ts.map +1 -1
- package/dist/types/enums.d.ts +10 -41
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/extensions.d.ts +0 -21
- package/dist/types/extensions.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +5 -26
- package/dist/types/schemas.d.ts.map +1 -1
- package/locales/en.json +7 -7
- package/package.json +22 -19
package/dist/types/domain.d.ts
CHANGED
|
@@ -1,68 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleItemTypeSchema, ModuleStatusSchema } from './enums';
|
|
3
|
-
/**
|
|
4
|
-
* The normalized domain model shared by every host and every transport.
|
|
5
|
-
*
|
|
6
|
-
* This is deliberately smaller than what either Canvas LMS or Canvas Career
|
|
7
|
-
* fetches today: it is the *intersection* of what both need to render a
|
|
8
|
-
* modules page. Anything host-specific (blueprint locks, mastery paths,
|
|
9
|
-
* assignment overrides) rides in `extensions` rather than widening the model,
|
|
10
|
-
* so a host can never make the shared contract depend on its own UI.
|
|
11
|
-
*
|
|
12
|
-
* Three normalization rules hold at every adapter boundary:
|
|
13
|
-
*
|
|
14
|
-
* 1. Ids are strings. GraphQL hands back `_id`/`id`, REST hands back numbers.
|
|
15
|
-
* 2. `published` is always populated. REST omits the field for students,
|
|
16
|
-
* which means "published"; the adapter resolves that, not the caller.
|
|
17
|
-
* 3. Item types are one closed enum. Canvas GraphQL distinguishes new quizzes
|
|
18
|
-
* with `isNewQuiz`, REST with `quiz_lti`; both collapse to `'quiz'` here.
|
|
19
|
-
* Every enum in this file is inferred from `./enums`, so the type and the
|
|
20
|
-
* runtime validator can never disagree.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Every closed enum below is inferred from its Zod schema in `./enums`, never
|
|
24
|
-
* written out twice. See that file for the members, where they come from, and
|
|
25
|
-
* the runtime crash the single source of truth prevents.
|
|
26
|
-
*/
|
|
27
3
|
export type ModuleItemType = z.infer<typeof ModuleItemTypeSchema>;
|
|
28
|
-
/** Per-item state, from the designer's annotation. @see ./enums */
|
|
29
4
|
export type ModuleItemStatus = z.infer<typeof ModuleItemStatusSchema>;
|
|
30
|
-
/** Per-module rollup, from the designer's annotation. @see ./enums */
|
|
31
5
|
export type ModuleStatus = z.infer<typeof ModuleStatusSchema>;
|
|
32
|
-
/**
|
|
33
|
-
* A student's progress through a module.
|
|
34
|
-
*
|
|
35
|
-
* Optional throughout: teacher and anonymous views have no progression, and
|
|
36
|
-
* an adapter that doesn't fetch it must leave this undefined rather than
|
|
37
|
-
* fabricate zeroes — "0 of 4 requirements met" and "we didn't ask" are
|
|
38
|
-
* different things, and only one of them should render a progress bar.
|
|
39
|
-
*/
|
|
40
6
|
export interface ModuleProgress {
|
|
41
7
|
status: ModuleStatus;
|
|
42
|
-
/** Requirements the student has satisfied. */
|
|
43
8
|
requirementsMet: number;
|
|
44
|
-
/**
|
|
9
|
+
/** Mirrors `Module.requirementCount`. */
|
|
45
10
|
requirementCount: number;
|
|
46
11
|
/** 0–100, precomputed so every host rounds it the same way. */
|
|
47
12
|
percentComplete: number;
|
|
48
|
-
/** Latest due date across the module's items; drives the header byline. */
|
|
49
13
|
latestDueAt?: string | null;
|
|
50
|
-
/** Items past due and unsubmitted.
|
|
14
|
+
/** Items past due and unsubmitted. */
|
|
51
15
|
missingCount: number;
|
|
52
16
|
}
|
|
53
|
-
/** The six types Canvas validates, plus `unknown` for forward compat. @see ./enums */
|
|
54
17
|
export type CompletionRequirementType = z.infer<typeof CompletionRequirementTypeSchema>;
|
|
55
|
-
/** A completion requirement attached to a module item. */
|
|
56
18
|
export interface CompletionRequirement {
|
|
57
|
-
/**
|
|
58
|
-
* Id of the module **item** this requirement applies to — not an id of the
|
|
59
|
-
* requirement itself, which Canvas does not give one.
|
|
60
|
-
*
|
|
61
|
-
* Named `itemId` rather than `id` because that join is the non-obvious part:
|
|
62
|
-
* `ModuleCompletionRequirement.id` on the wire is the content tag id, which is
|
|
63
|
-
* what lets `completionRequirements` be matched against `ModuleItem.id` and
|
|
64
|
-
* against `ModuleProgression.requirementsMet`.
|
|
65
|
-
*/
|
|
19
|
+
/** Canvas's `ModuleCompletionRequirement.id` is the content tag id, i.e. the item id. */
|
|
66
20
|
itemId: string;
|
|
67
21
|
type: CompletionRequirementType;
|
|
68
22
|
minScore?: number | null;
|
|
@@ -75,65 +29,56 @@ export interface ModuleItem {
|
|
|
75
29
|
type: ModuleItemType;
|
|
76
30
|
/** 1-based position within the module, as Canvas reports it. */
|
|
77
31
|
position: number;
|
|
78
|
-
/** Nesting depth used for visual indentation. */
|
|
79
32
|
indent: number;
|
|
80
33
|
published: boolean;
|
|
81
|
-
/** Canvas URL the item navigates to, when it has one. */
|
|
82
34
|
url?: string | null;
|
|
83
35
|
/** Canvas `ContentTag#new_tab`. Absent or null means the item opens in place. */
|
|
84
36
|
newTab?: boolean | null;
|
|
85
37
|
completionRequirement?: CompletionRequirement | null;
|
|
86
38
|
/** ISO 8601. Overrides are already applied by the adapter when applicable. */
|
|
87
39
|
dueAt?: string | null;
|
|
88
|
-
/**
|
|
89
|
-
* Student-view submission state. Undefined when not fetched (teacher view,
|
|
90
|
-
* anonymous, or an adapter that skips it) — distinct from `'not_started'`.
|
|
91
|
-
*/
|
|
40
|
+
/** Undefined when not fetched — distinct from `'not_started'`. */
|
|
92
41
|
status?: ModuleItemStatus;
|
|
93
|
-
/**
|
|
42
|
+
/** Null for types that cannot be graded. */
|
|
94
43
|
pointsPossible?: number | null;
|
|
95
|
-
/**
|
|
96
|
-
* Host-specific fields the shared contract does not model. Opaque to this
|
|
97
|
-
* package: passed through untouched, never merged, never read directly.
|
|
98
|
-
*
|
|
99
|
-
* Read it through the accessors in `types/extensions.ts` rather than by key —
|
|
100
|
-
* they own the `unknown` narrowing and document what is in here.
|
|
101
|
-
*/
|
|
44
|
+
/** Read through the accessors in `types/extensions.ts`, never by bare key. */
|
|
102
45
|
extensions?: Record<string, unknown>;
|
|
103
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* A module listed as a prerequisite of another.
|
|
49
|
+
*
|
|
50
|
+
* Mirrors Canvas's unfiltered `prerequisites` (`not_deleted`), which is a
|
|
51
|
+
* superset of the `active_prerequisites` that actually gate the lock, and is not
|
|
52
|
+
* filtered by viewer. It can name unpublished, unassigned and feature-hidden
|
|
53
|
+
* modules, so it is **not safe to render to a student unfiltered** and it is not
|
|
54
|
+
* the lock reason.
|
|
55
|
+
*/
|
|
56
|
+
export interface PrerequisiteModule {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
}
|
|
104
60
|
export interface Module {
|
|
105
61
|
id: string;
|
|
106
62
|
name: string;
|
|
107
63
|
position: number;
|
|
108
64
|
published: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Total items in the module, independent of how many have been fetched.
|
|
111
|
-
* Drives the items-mode policy and any "showing 10 of 40" affordance.
|
|
112
|
-
*/
|
|
65
|
+
/** Independent of how many have been fetched. */
|
|
113
66
|
itemCount: number;
|
|
114
|
-
/**
|
|
115
|
-
* Present in `inline` mode, absent in `onDemand` mode. An empty array means
|
|
116
|
-
* "fetched, and the module is genuinely empty" — distinct from `undefined`,
|
|
117
|
-
* which means "not fetched yet".
|
|
118
|
-
*/
|
|
67
|
+
/** `[]` is fetched-and-empty; `undefined` is not fetched. */
|
|
119
68
|
items?: ModuleItem[];
|
|
120
69
|
unlockAt?: string | null;
|
|
121
|
-
|
|
70
|
+
/** Unfiltered and not the lock reason — see `PrerequisiteModule`. */
|
|
71
|
+
prerequisiteModules: PrerequisiteModule[];
|
|
122
72
|
requirementCount?: number | null;
|
|
123
73
|
requireSequentialProgress: boolean;
|
|
124
74
|
completionRequirements?: CompletionRequirement[];
|
|
125
75
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* Module-level by design: the status pill, the progress bar, the header due
|
|
129
|
-
* date and every filter chip read from here, so the whole filter row works
|
|
130
|
-
* without any item having been fetched. That is what keeps `onDemand` mode
|
|
131
|
-
* viable on a 120-module course.
|
|
76
|
+
* Module-level by design: the pill, the bar and every filter chip read from here, so the
|
|
77
|
+
* filter row works with no item fetched. That is what keeps `onDemand` viable.
|
|
132
78
|
*/
|
|
133
79
|
progress?: ModuleProgress;
|
|
134
80
|
extensions?: Record<string, unknown>;
|
|
135
81
|
}
|
|
136
|
-
/** Relay-style cursor pagination, normalized across GraphQL and REST. */
|
|
137
82
|
export interface PageInfo {
|
|
138
83
|
hasNextPage: boolean;
|
|
139
84
|
endCursor: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/types/dom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AsB,CAAC,EAAE,qBAAqB,EAAE,CAAA;IAChD;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;CACnB"}
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -1,30 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Every closed enum in the contract, defined **once**, as a Zod schema.
|
|
4
|
-
*
|
|
5
|
-
* The types in `domain.ts` are `z.infer`red from these rather than hand-written
|
|
6
|
-
* beside them. That inversion is the point, and it fixes a trap: when the union
|
|
7
|
-
* and the `z.enum` were two separate lists, the two ways of desynchronizing them
|
|
8
|
-
* behaved differently.
|
|
9
|
-
*
|
|
10
|
-
* - Add a member to the `z.enum` but not the union → compile error. Loud.
|
|
11
|
-
* - Add a member to the union but not the `z.enum` → **compiles clean**. The UI
|
|
12
|
-
* can switch on it, an adapter can return it, tests pass. Then real data
|
|
13
|
-
* arrives, `ModuleItemSchema.parse()` throws "invalid enum value", and the
|
|
14
|
-
* modules page dies in the browser.
|
|
15
|
-
*
|
|
16
|
-
* Not hypothetical: `AiExperience` is a Canvas item type this adapter already
|
|
17
|
-
* drops, so "someone adds `'ai_experience'` to `ModuleItemType`" is plausibly the
|
|
18
|
-
* next change made to this file.
|
|
19
|
-
*
|
|
20
|
-
* They live in their own module, rather than in `schemas.ts`, so that `domain.ts`
|
|
21
|
-
* can derive from them without a cycle — `schemas.ts` imports the object types
|
|
22
|
-
* *from* `domain.ts` for its `z.ZodType<Module>` annotations.
|
|
23
|
-
*
|
|
24
|
-
* The explicit `z.ZodEnum<[...]>` annotations are required by the repo's
|
|
25
|
-
* `isolatedDeclarations`; they duplicate the literals, but a mismatch there is a
|
|
26
|
-
* compile error rather than a runtime one.
|
|
27
|
-
*/
|
|
28
2
|
export declare const ModuleItemTypeSchema: z.ZodEnum<[
|
|
29
3
|
'assignment',
|
|
30
4
|
'quiz',
|
|
@@ -36,18 +10,20 @@ export declare const ModuleItemTypeSchema: z.ZodEnum<[
|
|
|
36
10
|
'sub_header'
|
|
37
11
|
]>;
|
|
38
12
|
/**
|
|
39
|
-
*
|
|
13
|
+
* Derived by the adapter from submission state, not stored on the item in Canvas. `complete`
|
|
14
|
+
* reports a met completion requirement; `excused` is distinct from `graded` because the
|
|
15
|
+
* student was exempted rather than assessed.
|
|
40
16
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* Locked". Derived by the adapter from submission state, not stored on the item
|
|
44
|
-
* in Canvas.
|
|
17
|
+
* No `unknown` member: an unnamed `gradingStatus` falls through to `not_started`, which
|
|
18
|
+
* understates rather than misreports.
|
|
45
19
|
*/
|
|
46
20
|
export declare const ModuleItemStatusSchema: z.ZodEnum<[
|
|
47
21
|
'not_started',
|
|
48
22
|
'in_progress',
|
|
23
|
+
'complete',
|
|
49
24
|
'submitted',
|
|
50
25
|
'graded',
|
|
26
|
+
'excused',
|
|
51
27
|
'missing',
|
|
52
28
|
'locked'
|
|
53
29
|
]>;
|
|
@@ -70,16 +46,9 @@ export declare const ModuleStatusSchema: z.ZodEnum<[
|
|
|
70
46
|
'locked'
|
|
71
47
|
]>;
|
|
72
48
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* Canvas
|
|
76
|
-
* (`app/models/context_module.rb:684,687`), so this is the whole set, not a
|
|
77
|
-
* sample of it.
|
|
78
|
-
*
|
|
79
|
-
* `unknown` is the forward-compatibility member: a seventh type shipping in
|
|
80
|
-
* Canvas must not make this package fail to parse a module. It lands here, the
|
|
81
|
-
* label humanizes it, and nothing downstream has to handle a string it has never
|
|
82
|
-
* heard of.
|
|
49
|
+
* Canvas validates the same six exhaustively on save (`app/models/context_module.rb:684,687`),
|
|
50
|
+
* so this is the whole set. `unknown` is the forward-compatibility member — a seventh type
|
|
51
|
+
* shipping in Canvas must not make this package fail to parse a module.
|
|
83
52
|
*/
|
|
84
53
|
export declare const CompletionRequirementTypeSchema: z.ZodEnum<[
|
|
85
54
|
'must_view',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAC1C;IACE,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,MAAM;IACN,MAAM;IACN,cAAc;IACd,eAAe;IACf,YAAY;CACb,CAUD,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAC5C;IAAC,aAAa;IAAE,aAAa;IAAE,UAAU;IAAE,WAAW;IAAE,QAAQ;IAAE,SAAS;IAAE,SAAS;IAAE,QAAQ;CAAC,CAUjG,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CACxC;IAAC,aAAa;IAAE,aAAa;IAAE,eAAe;IAAE,YAAY;IAAE,SAAS;IAAE,QAAQ;CAAC,CACU,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CACrD;IACE,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,SAAS;CACV,CASD,CAAA"}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { ModuleItem } from './domain';
|
|
2
|
-
/**
|
|
3
|
-
* The `extensions` escape hatch, and the only sanctioned way through it.
|
|
4
|
-
*
|
|
5
|
-
* `Module.extensions` and `ModuleItem.extensions` are `Record<string, unknown>`
|
|
6
|
-
* so a host can carry a field the shared contract does not model. The bag itself
|
|
7
|
-
* is opaque to this package — never read, never merged, passed through as it
|
|
8
|
-
* arrives — which is what stops one host's UI needs from widening the model
|
|
9
|
-
* everyone else consumes.
|
|
10
|
-
*
|
|
11
|
-
* Opaque does not mean untyped at the edges. Every field that rides in here gets
|
|
12
|
-
* a key constant and a reader in this file, so:
|
|
13
|
-
*
|
|
14
|
-
* - the key is spelled once rather than stringly-typed at each use site,
|
|
15
|
-
* - the reader owns the `unknown` → narrow conversion, and a host that writes
|
|
16
|
-
* the wrong shape gets `null` rather than a render crash,
|
|
17
|
-
* - `grep` over this file answers "what is actually in extensions today".
|
|
18
|
-
*
|
|
19
|
-
* Keys are namespaced by the host that owns them. Two hosts adding a field they
|
|
20
|
-
* both call `duration` must not collide, and an unprefixed key would make that
|
|
21
|
-
* collision silent.
|
|
22
|
-
*/
|
|
23
2
|
/**
|
|
24
3
|
* Minutes Canvas Career estimates an item takes.
|
|
25
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/types/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/types/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qCAAqC,oCAAoC,CAAA;AAEtF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,MAAM,GAAG,IAAI,CAI/F;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAGrC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { ModuleItemStatus, ModuleProgress, ModuleStatus, CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemsPage, ModuleItemType, ModulesPage, PageInfo, } from './domain';
|
|
1
|
+
export type { ModuleItemStatus, ModuleProgress, ModuleStatus, CompletionRequirement, CompletionRequirementType, Module, ModuleItem, ModuleItemsPage, ModuleItemType, ModulesPage, PageInfo, PrerequisiteModule, } from './domain';
|
|
2
2
|
export type { ModuleItemNavigation } from './navigation';
|
|
3
|
-
export { CompletionRequirementSchema, CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleProgressSchema, ModuleStatusSchema, ModuleItemSchema, ModuleItemsPageSchema, ModuleItemTypeSchema, ModuleSchema, ModulesPageSchema, PageInfoSchema, } from './schemas';
|
|
3
|
+
export { CompletionRequirementSchema, CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleProgressSchema, ModuleStatusSchema, ModuleItemSchema, ModuleItemsPageSchema, ModuleItemTypeSchema, ModuleSchema, ModulesPageSchema, PageInfoSchema, PrerequisiteModuleSchema, } from './schemas';
|
|
4
4
|
export { EXT_CAREER_ESTIMATED_DURATION_MINUTES, getEstimatedDurationMinutes, withEstimatedDurationMinutes, } from './extensions';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,GACnB,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,cAAc,CAAA"}
|
package/dist/types/schemas.d.ts
CHANGED
|
@@ -1,36 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { CompletionRequirement, Module, ModuleItem, ModuleItemsPage, ModuleProgress, ModulesPage, PageInfo } from './domain';
|
|
2
|
+
import { CompletionRequirement, Module, ModuleItem, ModuleItemsPage, ModuleProgress, ModulesPage, PageInfo, PrerequisiteModule } from './domain';
|
|
3
3
|
export { CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleItemTypeSchema, ModuleStatusSchema, } from './enums';
|
|
4
|
-
/**
|
|
5
|
-
* Runtime schemas for the domain model.
|
|
6
|
-
*
|
|
7
|
-
* These validate at the *adapter boundary*, after normalization — not at the
|
|
8
|
-
* wire. That is deliberate: the wire shapes differ per transport, but every
|
|
9
|
-
* adapter must produce something that satisfies these, which is what makes
|
|
10
|
-
* "one contract, two backends" enforceable rather than aspirational.
|
|
11
|
-
*
|
|
12
|
-
* Canvas LMS ships no response validation today and Canvas Career validates
|
|
13
|
-
* its own REST shapes; neither can catch the case this catches — one adapter
|
|
14
|
-
* quietly drifting from the other.
|
|
15
|
-
*/
|
|
16
4
|
export declare const ModuleProgressSchema: z.ZodType<ModuleProgress>;
|
|
17
5
|
export declare const CompletionRequirementSchema: z.ZodType<CompletionRequirement>;
|
|
18
6
|
export declare const ModuleItemSchema: z.ZodType<ModuleItem>;
|
|
7
|
+
export declare const PrerequisiteModuleSchema: z.ZodType<PrerequisiteModule>;
|
|
19
8
|
export declare const ModuleSchema: z.ZodType<Module>;
|
|
20
9
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* on: the hooks report `hasNextPage` straight off the last page, while paging is
|
|
25
|
-
* driven by `endCursor`, where null means "done" to TanStack Query. That pair
|
|
26
|
-
* therefore renders a "Load more" control that can never load anything — the
|
|
27
|
-
* silent-truncation failure this package exists to prevent, wearing a button.
|
|
28
|
-
*
|
|
29
|
-
* Relay's own spec makes it unreachable for a GraphQL adapter, but a REST
|
|
30
|
-
* adapter parsing an RFC-5988 `Link` header is one plausible bug away from it:
|
|
31
|
-
* see a `rel="next"`, set `hasNextPage`, then fail to extract the cursor from
|
|
32
|
-
* the URL. The refine is what makes it unrepresentable rather than merely
|
|
33
|
-
* unlikely.
|
|
10
|
+
* `hasNextPage: true` with a null `endCursor` type-checks but renders a "Load more" that can
|
|
11
|
+
* never load: paging is driven by `endCursor`, where null means "done" to TanStack Query.
|
|
12
|
+
* Relay makes it unreachable, but a REST adapter parsing a `Link` header is one bug away.
|
|
34
13
|
*/
|
|
35
14
|
export declare const PageInfoSchema: z.ZodType<PageInfo>;
|
|
36
15
|
export declare const ModulesPageSchema: z.ZodType<ModulesPage>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/types/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EACV,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/types/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EACV,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,QAAQ,EACR,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAQjB,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAOzD,CAAA;AAEF,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAKvE,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAejD,CAAA;AAEF,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAGjE,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAczC,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAU3C,CAAA;AAEJ,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAGnD,CAAA;AAEF,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAG3D,CAAA"}
|
package/locales/en.json
CHANGED
|
@@ -24,14 +24,12 @@
|
|
|
24
24
|
"one": "The only module in this course is loaded.",
|
|
25
25
|
"other": "All %{count} modules in this course are loaded."
|
|
26
26
|
},
|
|
27
|
-
|
|
28
27
|
"filterGroupLabel": "Filter",
|
|
29
28
|
"filterAll": "All",
|
|
30
29
|
"filterInProgress": "In progress",
|
|
31
30
|
"filterComplete": "Complete",
|
|
32
31
|
"filterDueThisWeek": "Due this week",
|
|
33
32
|
"filterMissing": "Missing",
|
|
34
|
-
|
|
35
33
|
"lockedByline": "Locked until prerequisites are met",
|
|
36
34
|
"moduleProgressScreenReaderLabel": "%{name} progress",
|
|
37
35
|
"itemsLoadedAnnouncement": {
|
|
@@ -47,21 +45,20 @@
|
|
|
47
45
|
"moduleUnpublishedBadge": "(unpublished)",
|
|
48
46
|
"collapseModule": "Collapse %{name}",
|
|
49
47
|
"expandModule": "Expand %{name}",
|
|
50
|
-
|
|
51
48
|
"moduleStatusNotStarted": "Not started",
|
|
52
49
|
"moduleStatusInProgress": "In progress",
|
|
53
50
|
"moduleStatusAllSubmitted": "All items complete",
|
|
54
51
|
"moduleStatusAllGraded": "All items graded",
|
|
55
52
|
"moduleStatusMissing": "Missing",
|
|
56
53
|
"moduleStatusLocked": "Locked",
|
|
57
|
-
|
|
58
54
|
"itemStatusNotStarted": "Not started",
|
|
59
55
|
"itemStatusInProgress": "In progress",
|
|
56
|
+
"itemStatusComplete": "Complete",
|
|
60
57
|
"itemStatusSubmitted": "Submitted",
|
|
61
58
|
"itemStatusGraded": "Graded",
|
|
59
|
+
"itemStatusExcused": "Excused",
|
|
62
60
|
"itemStatusMissing": "Missing",
|
|
63
61
|
"itemStatusLocked": "Locked",
|
|
64
|
-
|
|
65
62
|
"itemTypeAssignment": "Assignment",
|
|
66
63
|
"itemTypeQuiz": "Quiz",
|
|
67
64
|
"itemTypeDiscussion": "Discussion",
|
|
@@ -70,7 +67,6 @@
|
|
|
70
67
|
"itemTypeExternalUrl": "External URL",
|
|
71
68
|
"itemTypeExternalTool": "External tool",
|
|
72
69
|
"itemTypeSubHeader": "Text header",
|
|
73
|
-
|
|
74
70
|
"requirementMustView": "View the item",
|
|
75
71
|
"requirementMustSubmit": "Submit the assignment",
|
|
76
72
|
"requirementMustContribute": "Contribute to the page",
|
|
@@ -80,11 +76,11 @@
|
|
|
80
76
|
"requirementMinPercentageUnknown": "Score at least the minimum percentage",
|
|
81
77
|
"requirementMinPercentage": "Score at least %{count}%",
|
|
82
78
|
"requirementUnknown": "Complete the requirement",
|
|
83
|
-
|
|
84
79
|
"dateTimeToday": "today, %{time}",
|
|
85
80
|
"dateTimeYesterday": "yesterday, %{time}",
|
|
86
81
|
"dateTimeTomorrow": "tomorrow, %{time}",
|
|
87
82
|
"dateTimeWithDate": "%{date}, %{time}",
|
|
83
|
+
"timeWithZone": "%{time} (%{zone})",
|
|
88
84
|
"dueByline": "Due %{when}",
|
|
89
85
|
"unlockByline": "Will unlock on %{when}",
|
|
90
86
|
"pointsAbbreviated": {
|
|
@@ -95,6 +91,10 @@
|
|
|
95
91
|
"one": "%{percent}% | %{met} of %{count} requirement met",
|
|
96
92
|
"other": "%{percent}% | %{met} of %{count} requirements met"
|
|
97
93
|
},
|
|
94
|
+
"progressScreenReaderValue": {
|
|
95
|
+
"one": "%{percent}% complete, %{met} of %{count} requirement met",
|
|
96
|
+
"other": "%{percent}% complete, %{met} of %{count} requirements met"
|
|
97
|
+
},
|
|
98
98
|
"durationMinutes": "%{count} min",
|
|
99
99
|
"itemUnpublishedLabel": "Unpublished",
|
|
100
100
|
"itemUntitled": "Untitled item",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/platform-modules",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"@instructure/ui-link": "^11.0.0",
|
|
27
27
|
"@instructure/ui-menu": "^11.0.0",
|
|
28
28
|
"@instructure/ui-pill": "^11.0.0",
|
|
29
|
-
"@instructure/ui-progress": "^11.
|
|
29
|
+
"@instructure/ui-progress": "^11.7.0",
|
|
30
|
+
"@instructure/ui-responsive": "^11.0.0",
|
|
30
31
|
"@instructure/ui-spinner": "^11.0.0",
|
|
31
32
|
"@instructure/ui-text": "^11.0.0",
|
|
32
33
|
"@instructure/ui-text-input": "^11.0.0",
|
|
@@ -40,25 +41,27 @@
|
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"graphql-tag": "^2.12.6",
|
|
42
43
|
"p-limit": "^6.1.0",
|
|
43
|
-
"@instructure/platform-instui-bindings": "0.6.4"
|
|
44
|
+
"@instructure/platform-instui-bindings": "0.6.4",
|
|
45
|
+
"@instructure/platform-with-breakpoints": "0.3.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@instructure/emotion": "11.
|
|
47
|
-
"@instructure/ui-a11y-content": "11.
|
|
48
|
-
"@instructure/ui-alerts": "11.
|
|
49
|
-
"@instructure/ui-buttons": "11.
|
|
50
|
-
"@instructure/ui-flex": "11.
|
|
51
|
-
"@instructure/ui-heading": "11.
|
|
52
|
-
"@instructure/ui-icons": "11.
|
|
53
|
-
"@instructure/ui-link": "11.
|
|
54
|
-
"@instructure/ui-menu": "11.
|
|
55
|
-
"@instructure/ui-pill": "11.
|
|
56
|
-
"@instructure/ui-progress": "11.
|
|
57
|
-
"@instructure/ui-
|
|
58
|
-
"@instructure/ui-
|
|
59
|
-
"@instructure/ui-text
|
|
60
|
-
"@instructure/ui-
|
|
61
|
-
"@instructure/ui-
|
|
48
|
+
"@instructure/emotion": "11.7.4",
|
|
49
|
+
"@instructure/ui-a11y-content": "11.7.4",
|
|
50
|
+
"@instructure/ui-alerts": "11.7.4",
|
|
51
|
+
"@instructure/ui-buttons": "11.7.4",
|
|
52
|
+
"@instructure/ui-flex": "11.7.4",
|
|
53
|
+
"@instructure/ui-heading": "11.7.4",
|
|
54
|
+
"@instructure/ui-icons": "11.7.4",
|
|
55
|
+
"@instructure/ui-link": "11.7.4",
|
|
56
|
+
"@instructure/ui-menu": "11.7.4",
|
|
57
|
+
"@instructure/ui-pill": "11.7.4",
|
|
58
|
+
"@instructure/ui-progress": "11.7.4",
|
|
59
|
+
"@instructure/ui-responsive": "11.7.4",
|
|
60
|
+
"@instructure/ui-spinner": "11.7.4",
|
|
61
|
+
"@instructure/ui-text": "11.7.4",
|
|
62
|
+
"@instructure/ui-text-input": "11.7.4",
|
|
63
|
+
"@instructure/ui-themes": "11.7.4",
|
|
64
|
+
"@instructure/ui-view": "11.7.4",
|
|
62
65
|
"@storybook/react": "^10.0.8",
|
|
63
66
|
"@testing-library/jest-dom": "^6.9.1",
|
|
64
67
|
"@testing-library/react": "^16.0.0",
|