@oaknational/oak-curriculum-schema-v2 0.0.7 → 0.0.8-alpha
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 +36 -13
- package/cjs/index.cjs +345 -54
- package/cjs/index.cjs.map +1 -1
- package/esm/index.js +345 -54
- package/esm/index.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +8 -6
- package/src/schema/components/deprecated-fields.ts +5 -0
- package/src/schema/components/equipment-and-resource.ts +7 -0
- package/src/schema/components/key-learning-point.ts +7 -0
- package/src/schema/components/keyword.ts +8 -0
- package/src/schema/components/lesson-outline-item.ts +5 -0
- package/src/schema/components/misconception-and-common-mistake.ts +10 -0
- package/src/schema/components/teacher-tip.ts +5 -0
- package/src/schema/draft-documents-with-status-by-lesson.ts +18 -0
- package/src/schema/draft-lesson-with-status.ts +35 -0
- package/src/schema/published-document-with-release-by-lesson-and-document-type.ts +17 -0
- package/src/schema/published-documents-with-release-by-lesson.ts +18 -0
- package/src/schema/published-lesson-video-with-release-by-lesson.ts +24 -0
- package/src/schema/published-lesson-with-release.ts +36 -0
- package/src/schema/unit-contexts-by-unit.ts +14 -0
- package/src/schema/units-by-lesson.ts +10 -0
- package/types.d.ts +13706 -1604
- package/src/schema/content-guidance.ts +0 -35
- package/src/schema/document.ts +0 -9
- package/src/schema/gdrive-file.ts +0 -9
- package/src/schema/lesson-component-status.ts +0 -15
- package/src/schema/lesson.ts +0 -14
- package/src/schema/media-status.ts +0 -9
package/README.md
CHANGED
|
@@ -15,24 +15,47 @@ pnpm add @oaknational/oak-curriculum-schema-v2 drizzle-orm zod
|
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
type
|
|
22
|
-
type LessonInsert,
|
|
23
|
-
type LessonPublished,
|
|
18
|
+
draftLessonWithStatusSchema,
|
|
19
|
+
draftLessonWithStatusCamelSchema,
|
|
20
|
+
type DraftLessonWithStatusType,
|
|
21
|
+
type DraftLessonWithStatusCamelType,
|
|
24
22
|
} from "@oaknational/oak-curriculum-schema-v2";
|
|
25
23
|
|
|
26
|
-
// Validate a
|
|
27
|
-
const
|
|
24
|
+
// Validate a snake_case row selected from the draft_lesson_with_status view
|
|
25
|
+
const draftLesson = draftLessonWithStatusSchema.parse(row);
|
|
28
26
|
|
|
29
|
-
//
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
// A schema extended from the derived base to narrow to published rows
|
|
33
|
-
const publishedLesson = lessonPublishedSchema.parse(row);
|
|
27
|
+
// Parse the same snake_case row and get camelCase keys back
|
|
28
|
+
const draftLessonCamel = draftLessonWithStatusCamelSchema.parse(row);
|
|
34
29
|
```
|
|
35
30
|
|
|
31
|
+
Raw table schemas are not exported. Schemas for tables live with the
|
|
32
|
+
service that uses them (for example `mutation-api`).
|
|
33
|
+
|
|
34
|
+
## Naming
|
|
35
|
+
|
|
36
|
+
- Schemas are camelCase with a `Schema` suffix, for example
|
|
37
|
+
`draftLessonWithStatusSchema`.
|
|
38
|
+
- camelCase-key schemas use the suffix `CamelSchema`.
|
|
39
|
+
- Types are PascalCase with a `Type` suffix, or `CamelType` for the
|
|
40
|
+
camelCase-key type.
|
|
41
|
+
|
|
42
|
+
## Row types
|
|
43
|
+
|
|
44
|
+
The schema declarations in `types.d.ts` are built by `drizzle-zod` and are
|
|
45
|
+
hard to read. To see a view's fields, hover (or go to definition on) the
|
|
46
|
+
matching row type, which is `z.infer` of the schema and resolves to a flat
|
|
47
|
+
list of columns.
|
|
48
|
+
|
|
49
|
+
| Schema | Type | Camel schema | Camel type |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| `draftLessonWithStatusSchema` | `DraftLessonWithStatusType` | `draftLessonWithStatusCamelSchema` | `DraftLessonWithStatusCamelType` |
|
|
52
|
+
| `draftDocumentsWithStatusByLessonSchema` | `DraftDocumentsWithStatusByLessonType` | `draftDocumentsWithStatusByLessonCamelSchema` | `DraftDocumentsWithStatusByLessonCamelType` |
|
|
53
|
+
| `publishedDocumentWithReleaseByLessonAndDocumentTypeSchema` | `PublishedDocumentWithReleaseByLessonAndDocumentTypeType` | `publishedDocumentWithReleaseByLessonAndDocumentTypeCamelSchema` | `PublishedDocumentWithReleaseByLessonAndDocumentTypeCamelType` |
|
|
54
|
+
| `publishedDocumentsWithReleaseByLessonSchema` | `PublishedDocumentsWithReleaseByLessonType` | `publishedDocumentsWithReleaseByLessonCamelSchema` | `PublishedDocumentsWithReleaseByLessonCamelType` |
|
|
55
|
+
| `publishedLessonVideoWithReleaseByLessonSchema` | `PublishedLessonVideoWithReleaseByLessonType` | `publishedLessonVideoWithReleaseByLessonCamelSchema` | `PublishedLessonVideoWithReleaseByLessonCamelType` |
|
|
56
|
+
| `unitContextsByUnitSchema` | `UnitContextsByUnitType` | `unitContextsByUnitCamelSchema` | `UnitContextsByUnitCamelType` |
|
|
57
|
+
| `unitsByLessonSchema` | `UnitsByLessonType` | `unitsByLessonCamelSchema` | `UnitsByLessonCamelType` |
|
|
58
|
+
|
|
36
59
|
## Links
|
|
37
60
|
|
|
38
61
|
- [npm package](https://www.npmjs.com/package/@oaknational/oak-curriculum-schema-v2)
|