@instructure/platform-modules 0.2.0 → 0.3.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/README.md +5 -5
- package/dist/adapters/canvasGraphql/index.d.ts +1 -1
- package/dist/adapters/canvasGraphql/normalize.d.ts +6 -6
- package/dist/adapters/canvasGraphql/queries.d.ts +2 -2
- package/dist/adapters/inMemory.d.ts +4 -4
- package/dist/adapters/limits.d.ts +4 -4
- package/dist/adapters/types.d.ts +6 -6
- package/dist/cache/keys.d.ts +1 -1
- package/dist/components/FilterChips.d.ts +10 -8
- package/dist/components/FilterChips.d.ts.map +1 -1
- package/dist/components/ModuleCard.d.ts +1 -1
- package/dist/components/ModuleItemRow.d.ts +1 -1
- package/dist/components/ModulesList.d.ts.map +1 -1
- package/dist/components/ModulesList.stories.d.ts +9 -9
- package/dist/components/ModulesList.stories.d.ts.map +1 -1
- package/dist/components/labels.d.ts +3 -3
- package/dist/fixtures/generate.d.ts +1 -1
- package/dist/hooks/constants.d.ts +1 -1
- package/dist/hooks/queryOptions.d.ts +1 -1
- package/dist/hooks/useModuleItemQueries.d.ts +1 -1
- package/dist/hooks/useModuleItems.d.ts +1 -1
- package/dist/hooks/useModules.d.ts +1 -1
- package/dist/i18n.d.ts +2 -2
- package/dist/index.js +760 -770
- package/dist/types/domain.d.ts +3 -3
- package/dist/types/enums.d.ts +2 -2
- package/dist/types/navigation.d.ts +1 -1
- package/dist/types/schemas.d.ts +1 -1
- package/locales/en.json +0 -1
- package/package.json +1 -1
package/dist/types/domain.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleItemTypeSchema, ModuleStatusSchema } from './enums';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
4
|
+
* The normalized domain model shared by every host and every transport.
|
|
5
5
|
*
|
|
6
6
|
* This is deliberately smaller than what either Canvas LMS or Canvas Career
|
|
7
7
|
* fetches today: it is the *intersection* of what both need to render a
|
|
@@ -9,7 +9,7 @@ import { CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleItemType
|
|
|
9
9
|
* assignment overrides) rides in `extensions` rather than widening the model,
|
|
10
10
|
* so a host can never make the shared contract depend on its own UI.
|
|
11
11
|
*
|
|
12
|
-
* Three
|
|
12
|
+
* Three normalization rules hold at every adapter boundary:
|
|
13
13
|
*
|
|
14
14
|
* 1. Ids are strings. GraphQL hands back `_id`/`id`, REST hands back numbers.
|
|
15
15
|
* 2. `published` is always populated. REST omits the field for students,
|
|
@@ -133,7 +133,7 @@ export interface Module {
|
|
|
133
133
|
progress?: ModuleProgress;
|
|
134
134
|
extensions?: Record<string, unknown>;
|
|
135
135
|
}
|
|
136
|
-
/** Relay-style cursor pagination,
|
|
136
|
+
/** Relay-style cursor pagination, normalized across GraphQL and REST. */
|
|
137
137
|
export interface PageInfo {
|
|
138
138
|
hasNextPage: boolean;
|
|
139
139
|
endCursor: string | null;
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
*
|
|
5
5
|
* The types in `domain.ts` are `z.infer`red from these rather than hand-written
|
|
6
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
|
|
7
|
+
* and the `z.enum` were two separate lists, the two ways of desynchronizing them
|
|
8
8
|
* behaved differently.
|
|
9
9
|
*
|
|
10
10
|
* - Add a member to the `z.enum` but not the union → compile error. Loud.
|
|
@@ -78,7 +78,7 @@ export declare const ModuleStatusSchema: z.ZodEnum<[
|
|
|
78
78
|
*
|
|
79
79
|
* `unknown` is the forward-compatibility member: a seventh type shipping in
|
|
80
80
|
* Canvas must not make this package fail to parse a module. It lands here, the
|
|
81
|
-
* label
|
|
81
|
+
* label humanizes it, and nothing downstream has to handle a string it has never
|
|
82
82
|
* heard of.
|
|
83
83
|
*/
|
|
84
84
|
export declare const CompletionRequirementTypeSchema: z.ZodEnum<[
|
|
@@ -2,7 +2,7 @@ import { MouseEvent } from 'react';
|
|
|
2
2
|
import { ModuleItem } from './domain';
|
|
3
3
|
/**
|
|
4
4
|
* Optional host navigation for item rows. Titles link to `ModuleItem.url`
|
|
5
|
-
* without it. Pass a stable reference: `ModuleItemRow` is
|
|
5
|
+
* without it. Pass a stable reference: `ModuleItemRow` is memoized.
|
|
6
6
|
*/
|
|
7
7
|
export interface ModuleItemNavigation {
|
|
8
8
|
/** Rewrite an item's href. Falls back to `item.url` when it returns nullish. */
|
package/dist/types/schemas.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { CompletionRequirementTypeSchema, ModuleItemStatusSchema, ModuleItemType
|
|
|
4
4
|
/**
|
|
5
5
|
* Runtime schemas for the domain model.
|
|
6
6
|
*
|
|
7
|
-
* These validate at the *adapter boundary*, after
|
|
7
|
+
* These validate at the *adapter boundary*, after normalization — not at the
|
|
8
8
|
* wire. That is deliberate: the wire shapes differ per transport, but every
|
|
9
9
|
* adapter must produce something that satisfies these, which is what makes
|
|
10
10
|
* "one contract, two backends" enforceable rather than aspirational.
|
package/locales/en.json
CHANGED