@oaknational/oak-curriculum-schema-v2 0.0.4-alpha → 0.0.5-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 +11 -24
- package/cjs/index.cjs +9 -9
- package/cjs/index.cjs.map +1 -1
- package/esm/index.js +9 -9
- package/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -6
- package/types.d.ts +176 -4003
- 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,40 +15,27 @@ pnpm add @oaknational/oak-curriculum-schema-v2 drizzle-orm zod
|
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
lessonPublishedSchema,
|
|
21
|
-
type Lesson,
|
|
22
|
-
type LessonInsert,
|
|
23
|
-
type LessonPublished,
|
|
18
|
+
draftLessonWithStatusSelectSchema,
|
|
19
|
+
type DraftLessonWithStatus,
|
|
24
20
|
} from "@oaknational/oak-curriculum-schema-v2";
|
|
25
21
|
|
|
26
|
-
// Validate a
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
// Validate a row before inserting
|
|
30
|
-
const newLesson = lessonInsertSchema.parse(payload);
|
|
31
|
-
|
|
32
|
-
// A schema extended from the derived base to narrow to published rows
|
|
33
|
-
const publishedLesson = lessonPublishedSchema.parse(row);
|
|
22
|
+
// Validate a row selected from the draft_lesson_with_status view
|
|
23
|
+
const draftLesson = draftLessonWithStatusSelectSchema.parse(row);
|
|
34
24
|
```
|
|
35
25
|
|
|
26
|
+
Raw table schemas are not exported. Schemas for tables live with the
|
|
27
|
+
service that uses them (for example `mutation-api`).
|
|
28
|
+
|
|
36
29
|
## Row types
|
|
37
30
|
|
|
38
31
|
The schema declarations in `types.d.ts` are built by `drizzle-zod` and are
|
|
39
|
-
hard to read. To see a
|
|
32
|
+
hard to read. To see a view's fields, hover (or go to definition on) the
|
|
40
33
|
matching row type, which is `z.infer` of the schema and resolves to a flat
|
|
41
34
|
list of columns.
|
|
42
35
|
|
|
43
|
-
| Schema | Select type |
|
|
44
|
-
| --- | --- |
|
|
45
|
-
| `
|
|
46
|
-
| `documentSelectSchema` | `Document` | `DocumentInsert` |
|
|
47
|
-
| `gdriveFileSelectSchema` | `GdriveFile` | `GdriveFileInsert` |
|
|
48
|
-
| `lessonComponentStatusSelectSchema` | `LessonComponentStatus` | `LessonComponentStatusInsert` |
|
|
49
|
-
| `mediaStatusSelectSchema` | `MediaStatus` | `MediaStatusInsert` |
|
|
50
|
-
| `contentGuidanceSelectSchema` | `ContentGuidance` | `ContentGuidanceInsert` |
|
|
51
|
-
| `draftLessonWithStatusSelectSchema` | `DraftLessonWithStatus` | n/a (view) |
|
|
36
|
+
| Schema | Select type |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `draftLessonWithStatusSelectSchema` | `DraftLessonWithStatus` |
|
|
52
39
|
|
|
53
40
|
## Links
|
|
54
41
|
|