@twreporter-academy/api-types 0.0.16 → 0.0.18
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/api-variables.d.ts +6 -0
- package/dist/api-variables.d.ts.map +1 -1
- package/dist/api-variables.js +2 -1
- package/dist/api-variables.js.map +1 -1
- package/dist/schemas/course.d.ts +64 -7
- package/dist/schemas/course.d.ts.map +1 -1
- package/dist/schemas/course.js +3 -3
- package/dist/schemas/course.js.map +1 -1
- package/dist/schemas/home.d.ts +62 -14
- package/dist/schemas/home.d.ts.map +1 -1
- package/dist/schemas/home.js +8 -7
- package/dist/schemas/home.js.map +1 -1
- package/dist/schemas/tag.d.ts +139 -0
- package/dist/schemas/tag.d.ts.map +1 -1
- package/dist/schemas/tag.js +125 -1
- package/dist/schemas/tag.js.map +1 -1
- package/package.json +1 -1
package/dist/api-variables.d.ts
CHANGED
|
@@ -11,4 +11,10 @@ export declare const V1TagCoursesRequestSchema: z.ZodObject<{
|
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
export type V1TagCoursesRequest = z.infer<typeof V1TagCoursesRequestSchema>;
|
|
13
13
|
export type V1TagMetaRequest = z.infer<typeof V1TagSlugPathParamsSchema>;
|
|
14
|
+
export declare const V1TagPostsRequestSchema: z.ZodObject<{
|
|
15
|
+
slug: z.ZodString;
|
|
16
|
+
take: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
17
|
+
skip: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type V1TagPostsRequest = z.infer<typeof V1TagPostsRequestSchema>;
|
|
14
20
|
//# sourceMappingURL=api-variables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-variables.d.ts","sourceRoot":"","sources":["../src/api-variables.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"api-variables.d.ts","sourceRoot":"","sources":["../src/api-variables.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,EAGL,yBAAyB,EAC1B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,yBAAyB;;;;iBAErC,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAExE,eAAO,MAAM,uBAAuB;;;;iBAEnC,CAAA;AACD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
package/dist/api-variables.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Inferred from Zod schemas — single source of truth for api/ and content-api layers.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { V1TagBySlugCoursesQuerySchema, V1TagSlugPathParamsSchema } from './schemas/tag.js';
|
|
6
|
+
import { V1TagBySlugCoursesQuerySchema, V1TagBySlugPostsQuerySchema, V1TagSlugPathParamsSchema } from './schemas/tag.js';
|
|
7
7
|
export const V1TagCoursesRequestSchema = V1TagSlugPathParamsSchema.merge(V1TagBySlugCoursesQuerySchema);
|
|
8
|
+
export const V1TagPostsRequestSchema = V1TagSlugPathParamsSchema.merge(V1TagBySlugPostsQuerySchema);
|
|
8
9
|
//# sourceMappingURL=api-variables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-variables.js","names":["V1TagBySlugCoursesQuerySchema","V1TagSlugPathParamsSchema","V1TagCoursesRequestSchema","merge"],"sources":["../src/api-variables.ts"],"sourcesContent":["/**\n * Request variable types (path params, query strings, bodies, client composites).\n * Inferred from Zod schemas — single source of truth for api/ and content-api layers.\n */\nimport type { z } from 'zod'\n\nimport {\n V1TagBySlugCoursesQuerySchema,\n V1TagSlugPathParamsSchema,\n} from './schemas/tag.js'\n\nexport const V1TagCoursesRequestSchema = V1TagSlugPathParamsSchema.merge(\n V1TagBySlugCoursesQuerySchema\n)\nexport type V1TagCoursesRequest = z.infer<typeof V1TagCoursesRequestSchema>\n\nexport type V1TagMetaRequest = z.infer<typeof V1TagSlugPathParamsSchema>\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA,SACEA,6BAA6B,EAC7BC,yBAAyB,QACpB,kBAAkB;AAEzB,OAAO,MAAMC,yBAAyB,GAAGD,yBAAyB,CAACE,KAAK,
|
|
1
|
+
{"version":3,"file":"api-variables.js","names":["V1TagBySlugCoursesQuerySchema","V1TagBySlugPostsQuerySchema","V1TagSlugPathParamsSchema","V1TagCoursesRequestSchema","merge","V1TagPostsRequestSchema"],"sources":["../src/api-variables.ts"],"sourcesContent":["/**\n * Request variable types (path params, query strings, bodies, client composites).\n * Inferred from Zod schemas — single source of truth for api/ and content-api layers.\n */\nimport type { z } from 'zod'\n\nimport {\n V1TagBySlugCoursesQuerySchema,\n V1TagBySlugPostsQuerySchema,\n V1TagSlugPathParamsSchema,\n} from './schemas/tag.js'\n\nexport const V1TagCoursesRequestSchema = V1TagSlugPathParamsSchema.merge(\n V1TagBySlugCoursesQuerySchema\n)\nexport type V1TagCoursesRequest = z.infer<typeof V1TagCoursesRequestSchema>\n\nexport type V1TagMetaRequest = z.infer<typeof V1TagSlugPathParamsSchema>\n\nexport const V1TagPostsRequestSchema = V1TagSlugPathParamsSchema.merge(\n V1TagBySlugPostsQuerySchema\n)\nexport type V1TagPostsRequest = z.infer<typeof V1TagPostsRequestSchema>\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA,SACEA,6BAA6B,EAC7BC,2BAA2B,EAC3BC,yBAAyB,QACpB,kBAAkB;AAEzB,OAAO,MAAMC,yBAAyB,GAAGD,yBAAyB,CAACE,KAAK,CACtEJ,6BACF,CAAC;AAKD,OAAO,MAAMK,uBAAuB,GAAGH,yBAAyB,CAACE,KAAK,CACpEH,2BACF,CAAC","ignoreList":[]}
|
package/dist/schemas/course.d.ts
CHANGED
|
@@ -40,7 +40,15 @@ export declare const V1CourseInstructorSchema: z.ZodObject<{
|
|
|
40
40
|
name: z.ZodString;
|
|
41
41
|
title: z.ZodString;
|
|
42
42
|
bio: z.ZodString;
|
|
43
|
-
|
|
43
|
+
avatar: z.ZodNullable<z.ZodObject<{
|
|
44
|
+
title: z.ZodString;
|
|
45
|
+
resized: z.ZodObject<{
|
|
46
|
+
tiny: z.ZodString;
|
|
47
|
+
small: z.ZodString;
|
|
48
|
+
medium: z.ZodString;
|
|
49
|
+
large: z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
44
52
|
}, z.core.$strip>;
|
|
45
53
|
export declare const V1CourseResourceSchema: z.ZodObject<{
|
|
46
54
|
id: z.ZodString;
|
|
@@ -52,13 +60,22 @@ export declare const V1CourseFurtherReadingSchema: z.ZodObject<{
|
|
|
52
60
|
id: z.ZodString;
|
|
53
61
|
title: z.ZodString;
|
|
54
62
|
excerpt: z.ZodString;
|
|
55
|
-
|
|
63
|
+
thumbnail: z.ZodNullable<z.ZodObject<{
|
|
64
|
+
title: z.ZodString;
|
|
65
|
+
resized: z.ZodObject<{
|
|
66
|
+
tiny: z.ZodString;
|
|
67
|
+
small: z.ZodString;
|
|
68
|
+
medium: z.ZodString;
|
|
69
|
+
large: z.ZodString;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
56
72
|
url: z.ZodString;
|
|
57
73
|
}, z.core.$strip>;
|
|
58
74
|
export declare const V1CourseStatusSchema: z.ZodEnum<{
|
|
59
75
|
published: "published";
|
|
60
76
|
coming_soon: "coming_soon";
|
|
61
77
|
}>;
|
|
78
|
+
export type V1CourseStatus = z.infer<typeof V1CourseStatusSchema>;
|
|
62
79
|
export declare const V1HeaderCourseBadgeSchema: z.ZodEnum<{
|
|
63
80
|
new: "new";
|
|
64
81
|
wip: "wip";
|
|
@@ -88,7 +105,15 @@ export declare const V1LearningCourseBadgeSchema: z.ZodLiteral<"new">;
|
|
|
88
105
|
export declare const V1LearningCourseItemSchema: z.ZodObject<{
|
|
89
106
|
slug: z.ZodString;
|
|
90
107
|
title: z.ZodString;
|
|
91
|
-
|
|
108
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
109
|
+
title: z.ZodString;
|
|
110
|
+
resized: z.ZodObject<{
|
|
111
|
+
tiny: z.ZodString;
|
|
112
|
+
small: z.ZodString;
|
|
113
|
+
medium: z.ZodString;
|
|
114
|
+
large: z.ZodString;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
}, z.core.$strip>>;
|
|
92
117
|
badge: z.ZodOptional<z.ZodLiteral<"new">>;
|
|
93
118
|
launchAt: z.ZodNullable<z.ZodISODateTime>;
|
|
94
119
|
completedLessons: z.ZodNumber;
|
|
@@ -100,7 +125,15 @@ export declare const V1CoursesLearningListResponseSchema: z.ZodObject<{
|
|
|
100
125
|
courses: z.ZodArray<z.ZodObject<{
|
|
101
126
|
slug: z.ZodString;
|
|
102
127
|
title: z.ZodString;
|
|
103
|
-
|
|
128
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
129
|
+
title: z.ZodString;
|
|
130
|
+
resized: z.ZodObject<{
|
|
131
|
+
tiny: z.ZodString;
|
|
132
|
+
small: z.ZodString;
|
|
133
|
+
medium: z.ZodString;
|
|
134
|
+
large: z.ZodString;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
104
137
|
badge: z.ZodOptional<z.ZodLiteral<"new">>;
|
|
105
138
|
launchAt: z.ZodNullable<z.ZodISODateTime>;
|
|
106
139
|
completedLessons: z.ZodNumber;
|
|
@@ -147,7 +180,15 @@ export declare const V1ClassroomBySlugResponseSchema: z.ZodObject<{
|
|
|
147
180
|
name: z.ZodString;
|
|
148
181
|
title: z.ZodString;
|
|
149
182
|
bio: z.ZodString;
|
|
150
|
-
|
|
183
|
+
avatar: z.ZodNullable<z.ZodObject<{
|
|
184
|
+
title: z.ZodString;
|
|
185
|
+
resized: z.ZodObject<{
|
|
186
|
+
tiny: z.ZodString;
|
|
187
|
+
small: z.ZodString;
|
|
188
|
+
medium: z.ZodString;
|
|
189
|
+
large: z.ZodString;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
}, z.core.$strip>>;
|
|
151
192
|
}, z.core.$strip>>;
|
|
152
193
|
resources: z.ZodArray<z.ZodObject<{
|
|
153
194
|
id: z.ZodString;
|
|
@@ -159,7 +200,15 @@ export declare const V1ClassroomBySlugResponseSchema: z.ZodObject<{
|
|
|
159
200
|
id: z.ZodString;
|
|
160
201
|
title: z.ZodString;
|
|
161
202
|
excerpt: z.ZodString;
|
|
162
|
-
|
|
203
|
+
thumbnail: z.ZodNullable<z.ZodObject<{
|
|
204
|
+
title: z.ZodString;
|
|
205
|
+
resized: z.ZodObject<{
|
|
206
|
+
tiny: z.ZodString;
|
|
207
|
+
small: z.ZodString;
|
|
208
|
+
medium: z.ZodString;
|
|
209
|
+
large: z.ZodString;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
163
212
|
url: z.ZodString;
|
|
164
213
|
}, z.core.$strip>>;
|
|
165
214
|
}, z.core.$strip>;
|
|
@@ -193,7 +242,15 @@ export declare const V1CourseBySlugResponseSchema: z.ZodObject<{
|
|
|
193
242
|
name: z.ZodString;
|
|
194
243
|
title: z.ZodString;
|
|
195
244
|
bio: z.ZodString;
|
|
196
|
-
|
|
245
|
+
avatar: z.ZodNullable<z.ZodObject<{
|
|
246
|
+
title: z.ZodString;
|
|
247
|
+
resized: z.ZodObject<{
|
|
248
|
+
tiny: z.ZodString;
|
|
249
|
+
small: z.ZodString;
|
|
250
|
+
medium: z.ZodString;
|
|
251
|
+
large: z.ZodString;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
}, z.core.$strip>>;
|
|
197
254
|
}, z.core.$strip>>;
|
|
198
255
|
heroImageVideo: z.ZodNullable<z.ZodObject<{
|
|
199
256
|
title: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"course.d.ts","sourceRoot":"","sources":["../../src/schemas/course.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,OAAO,EAAE,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3B,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAO/C,CAAA;AAEF,eAAO,MAAM,4BAA4B;;iBAEvC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;iBAI3C,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAcP,CAAA;AAE1B,eAAO,MAAM,wBAAwB;;;;iBAOP,CAAA;AAE9B,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"course.d.ts","sourceRoot":"","sources":["../../src/schemas/course.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,OAAO,EAAE,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3B,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAO/C,CAAA;AAEF,eAAO,MAAM,4BAA4B;;iBAEvC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;iBAI3C,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAcP,CAAA;AAE1B,eAAO,MAAM,wBAAwB;;;;iBAOP,CAAA;AAE9B,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;iBASP,CAAA;AAE9B,eAAO,MAAM,sBAAsB;;;;;iBAQP,CAAA;AAE5B,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;iBAQP,CAAA;AAElC,eAAO,MAAM,oBAAoB;;;EAAuC,CAAA;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,yBAAyB;;;EAAyB,CAAA;AAE/D,eAAO,MAAM,wBAAwB;;;;;;;;iBAOP,CAAA;AAE9B,eAAO,MAAM,2BAA2B;;;;;;;;;;iBAIP,CAAA;AAEjC,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,qBAAmB,CAAA;AAE3D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;iBAiBP,CAAA;AAEhC,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;iBAIP,CAAA;AAEzC,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBf,CAAA;AAE7B,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBf,CAAA"}
|
package/dist/schemas/course.js
CHANGED
|
@@ -40,7 +40,7 @@ export const V1CourseInstructorSchema = z.object({
|
|
|
40
40
|
name: z.string(),
|
|
41
41
|
title: z.string(),
|
|
42
42
|
bio: z.string(),
|
|
43
|
-
|
|
43
|
+
avatar: PhotoSchema.nullable()
|
|
44
44
|
}).openapi('CourseInstructor');
|
|
45
45
|
export const V1CourseResourceSchema = z.object({
|
|
46
46
|
id: z.string(),
|
|
@@ -53,7 +53,7 @@ export const V1CourseFurtherReadingSchema = z.object({
|
|
|
53
53
|
id: z.string(),
|
|
54
54
|
title: z.string(),
|
|
55
55
|
excerpt: z.string(),
|
|
56
|
-
|
|
56
|
+
thumbnail: PhotoSchema.nullable(),
|
|
57
57
|
url: z.string()
|
|
58
58
|
}).openapi('CourseFurtherReading');
|
|
59
59
|
export const V1CourseStatusSchema = z.enum(['published', 'coming_soon']);
|
|
@@ -73,7 +73,7 @@ export const V1LearningCourseBadgeSchema = z.literal('new');
|
|
|
73
73
|
export const V1LearningCourseItemSchema = z.object({
|
|
74
74
|
slug: z.string(),
|
|
75
75
|
title: z.string(),
|
|
76
|
-
|
|
76
|
+
image: PhotoSchema.nullable(),
|
|
77
77
|
badge: V1LearningCourseBadgeSchema.optional(),
|
|
78
78
|
launchAt: z.iso.datetime().nullable(),
|
|
79
79
|
completedLessons: z.number().int().nonnegative(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"course.js","names":["z","internalServerErrorResponse","RestErrorBodySchema","CloudflareStreamVideoSchema","V1LessonProgressSchema","PhotoSchema","registry","CourseThumbnailSchema","JsonValueSchema","union","string","number","boolean","null","array","unknown","record","V1CourseSlugPathParamsSchema","object","slug","min","max","V1CourseBySlugMetaResponseSchema","ogTitle","ogDescription","ogImage","nullable","V1CourseLessonSchema","id","order","int","title","startSeconds","endSeconds","durationSeconds","progress","optional","openapi","V1CourseLessonMetaSchema","duration","V1CourseInstructorSchema","name","bio","avatarUrl","V1CourseResourceSchema","description","downloadUrl","V1CourseFurtherReadingSchema","excerpt","thumbnailUrl","url","V1CourseStatusSchema","enum","V1HeaderCourseBadgeSchema","V1HeaderCourseItemSchema","subtitle","badge","V1CoursesListResponseSchema","courses","V1LearningCourseBadgeSchema","literal","V1LearningCourseItemSchema","imageUrl","launchAt","iso","datetime","completedLessons","nonnegative","totalLessons","progressPercent","unitTitle","describe","V1CoursesLearningListResponseSchema","V1CourseTagSchema","V1ClassroomBySlugResponseSchema","summary","status","tags","previewVideoId","videoId","lessons","instructors","resources","furtherReading","V1CourseBySlugResponseSchema","trialVideos","lessonsMeta","heroImageVideo","heroImage","registerPath","method","path","responses","content","schema","request","params"],"sources":["../../src/schemas/course.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { internalServerErrorResponse } from '../responses.js'\nimport { RestErrorBodySchema } from '../rest.js'\nimport { CloudflareStreamVideoSchema } from './cloudflare-stream.js'\nimport { V1LessonProgressSchema } from './lesson-progress.js'\nimport { PhotoSchema } from './photo.js'\nimport { registry } from './registry.js'\nimport { CourseThumbnailSchema } from './tag.js'\n\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | unknown[]\n | Record<string, unknown>\n\nexport const JsonValueSchema: z.ZodType<JsonValue> = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n])\n\nexport const V1CourseSlugPathParamsSchema = z.object({\n slug: z.string().min(1).max(200),\n})\n\nexport const V1CourseBySlugMetaResponseSchema = z.object({\n ogTitle: z.string(),\n ogDescription: z.string(),\n ogImage: CourseThumbnailSchema.nullable(),\n})\n\nexport const V1CourseLessonSchema = z\n .object({\n id: z.string(),\n order: z.number().int(),\n title: z.string(),\n /** Segment start in the course video (seconds) */\n startSeconds: z.number().int(),\n /** Segment end in the course video (seconds) */\n endSeconds: z.number().int(),\n /** Derived segment length: max(0, endSeconds - startSeconds) */\n durationSeconds: z.number().int(),\n /** Present when request includes a valid member JWT; null when no progress record */\n progress: V1LessonProgressSchema.nullable().optional(),\n })\n .openapi('CourseLesson')\n\nexport const V1CourseLessonMetaSchema = z\n .object({\n order: z.number().int().nullable(),\n title: z.string(),\n /** Derived segment length: max(0, endSeconds - startSeconds) */\n duration: z.number().int(),\n })\n .openapi('CourseLessonMeta')\n\nexport const V1CourseInstructorSchema = z\n .object({\n id: z.string(),\n slug: z.string(),\n name: z.string(),\n title: z.string(),\n bio: z.string(),\n avatarUrl: z.string().nullable(),\n })\n .openapi('CourseInstructor')\n\nexport const V1CourseResourceSchema = z\n .object({\n id: z.string(),\n title: z.string(),\n description: z.string(),\n /** GCS file URL; empty when no PDF uploaded */\n downloadUrl: z.string(),\n })\n .openapi('CourseResource')\n\nexport const V1CourseFurtherReadingSchema = z\n .object({\n id: z.string(),\n title: z.string(),\n excerpt: z.string(),\n thumbnailUrl: z.string().nullable(),\n url: z.string(),\n })\n .openapi('CourseFurtherReading')\n\nexport const V1CourseStatusSchema = z.enum(['published', 'coming_soon'])\n\nexport const V1HeaderCourseBadgeSchema = z.enum(['new', 'wip'])\n\nexport const V1HeaderCourseItemSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n badge: V1HeaderCourseBadgeSchema.optional(),\n })\n .openapi('HeaderCourseItem')\n\nexport const V1CoursesListResponseSchema = z\n .object({\n courses: z.array(V1HeaderCourseItemSchema),\n })\n .openapi('CoursesListResponse')\n\n/** Learning badge is only `new`; `wip` / coming_soon courses are excluded from this list. */\nexport const V1LearningCourseBadgeSchema = z.literal('new')\n\nexport const V1LearningCourseItemSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n imageUrl: z.string().nullable(),\n badge: V1LearningCourseBadgeSchema.optional(),\n launchAt: z.iso.datetime().nullable(),\n completedLessons: z.number().int().nonnegative(),\n totalLessons: z.number().int().nonnegative(),\n progressPercent: z.number().int().min(0).max(100),\n /** Title of the next incomplete lesson; last lesson title when every lesson is complete. */\n unitTitle: z\n .string()\n .describe(\n 'Title of the next incomplete lesson; last lesson title when every lesson is complete.'\n ),\n })\n .openapi('LearningCourseItem')\n\nexport const V1CoursesLearningListResponseSchema = z\n .object({\n courses: z.array(V1LearningCourseItemSchema),\n })\n .openapi('CoursesLearningListResponse')\n\nexport const V1CourseTagSchema = z.object({\n slug: z.string(),\n name: z.string(),\n})\n\nexport const V1ClassroomBySlugResponseSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n summary: z.string(),\n /** published: full payload; coming_soon: lessons/resources/furtherReading/previewVideoId stripped */\n status: V1CourseStatusSchema,\n tags: z.array(V1CourseTagSchema),\n /** Trial/preview stream only; null when unconfigured or course is coming_soon */\n previewVideoId: z.string().nullable(),\n /** Course video Cloudflare stream id; null when unpaid or not set */\n videoId: z.string().nullable(),\n lessons: z.array(V1CourseLessonSchema),\n instructors: z.array(V1CourseInstructorSchema),\n resources: z.array(V1CourseResourceSchema),\n furtherReading: z.array(V1CourseFurtherReadingSchema),\n })\n .openapi('ClassroomDetail')\n\nexport const V1CourseBySlugResponseSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n summary: z.string(),\n launchAt: z.iso.datetime().nullable(),\n description: JsonValueSchema.nullable(),\n /** published: full payload; coming_soon: lessons/resources/furtherReading/previewVideoId stripped */\n status: V1CourseStatusSchema,\n tags: z.array(V1CourseTagSchema),\n /** Trial/preview stream only; null when unconfigured or course is coming_soon */\n trialVideos: z.array(CloudflareStreamVideoSchema).nullable(),\n lessonsMeta: z.array(V1CourseLessonMetaSchema),\n instructors: z.array(V1CourseInstructorSchema),\n heroImageVideo: CloudflareStreamVideoSchema.nullable(),\n heroImage: PhotoSchema.nullable(),\n })\n .openapi('CourseDetail')\n\n// --- OpenAPI path registration ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/courses',\n tags: ['Courses'],\n description: 'Header course list.',\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CoursesListResponseSchema },\n },\n },\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/courses/{slug}/meta',\n tags: ['Courses'],\n description: 'OG metadata for a course page.',\n request: { params: V1CourseSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CourseBySlugMetaResponseSchema },\n },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 404: {\n description: 'Course not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/courses/{slug}',\n tags: ['Courses'],\n description:\n 'Full course detail for the classroom page. When status is coming_soon, lessons, resources, furtherReading, and previewVideoId are empty/null while title, description, tags, and instructors remain visible.',\n request: { params: V1CourseSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CourseBySlugResponseSchema },\n },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 404: {\n description: 'Course not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,SAASC,2BAA2B,QAAQ,iBAAiB;AAC7D,SAASC,mBAAmB,QAAQ,YAAY;AAChD,SAASC,2BAA2B,QAAQ,wBAAwB;AACpE,SAASC,sBAAsB,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,QAAQ,YAAY;AACxC,SAASC,QAAQ,QAAQ,eAAe;AACxC,SAASC,qBAAqB,QAAQ,UAAU;AAUhD,OAAO,MAAMC,eAAqC,GAAGR,CAAC,CAACS,KAAK,CAAC,CAC3DT,CAAC,CAACU,MAAM,CAAC,CAAC,EACVV,CAAC,CAACW,MAAM,CAAC,CAAC,EACVX,CAAC,CAACY,OAAO,CAAC,CAAC,EACXZ,CAAC,CAACa,IAAI,CAAC,CAAC,EACRb,CAAC,CAACc,KAAK,CAACd,CAAC,CAACe,OAAO,CAAC,CAAC,CAAC,EACpBf,CAAC,CAACgB,MAAM,CAAChB,CAAC,CAACU,MAAM,CAAC,CAAC,EAAEV,CAAC,CAACe,OAAO,CAAC,CAAC,CAAC,CAClC,CAAC;AAEF,OAAO,MAAME,4BAA4B,GAAGjB,CAAC,CAACkB,MAAM,CAAC;EACnDC,IAAI,EAAEnB,CAAC,CAACU,MAAM,CAAC,CAAC,CAACU,GAAG,CAAC,C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,EAAE;IACT,GAAG,EAAE;MACH/C,WAAW,EAAE,SAAS;MACtBgD,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAEV;QAA6B;MAC7D;IACF,CAAC;IACD,GAAG,EAAE;MACHvC,WAAW,EAAE,aAAa;MAC1BgD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACH2C,WAAW,EAAE,kBAAkB;MAC/BgD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"course.js","names":["z","internalServerErrorResponse","RestErrorBodySchema","CloudflareStreamVideoSchema","V1LessonProgressSchema","PhotoSchema","registry","CourseThumbnailSchema","JsonValueSchema","union","string","number","boolean","null","array","unknown","record","V1CourseSlugPathParamsSchema","object","slug","min","max","V1CourseBySlugMetaResponseSchema","ogTitle","ogDescription","ogImage","nullable","V1CourseLessonSchema","id","order","int","title","startSeconds","endSeconds","durationSeconds","progress","optional","openapi","V1CourseLessonMetaSchema","duration","V1CourseInstructorSchema","name","bio","avatar","V1CourseResourceSchema","description","downloadUrl","V1CourseFurtherReadingSchema","excerpt","thumbnail","url","V1CourseStatusSchema","enum","V1HeaderCourseBadgeSchema","V1HeaderCourseItemSchema","subtitle","badge","V1CoursesListResponseSchema","courses","V1LearningCourseBadgeSchema","literal","V1LearningCourseItemSchema","image","launchAt","iso","datetime","completedLessons","nonnegative","totalLessons","progressPercent","unitTitle","describe","V1CoursesLearningListResponseSchema","V1CourseTagSchema","V1ClassroomBySlugResponseSchema","summary","status","tags","previewVideoId","videoId","lessons","instructors","resources","furtherReading","V1CourseBySlugResponseSchema","trialVideos","lessonsMeta","heroImageVideo","heroImage","registerPath","method","path","responses","content","schema","request","params"],"sources":["../../src/schemas/course.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { internalServerErrorResponse } from '../responses.js'\nimport { RestErrorBodySchema } from '../rest.js'\nimport { CloudflareStreamVideoSchema } from './cloudflare-stream.js'\nimport { V1LessonProgressSchema } from './lesson-progress.js'\nimport { PhotoSchema } from './photo.js'\nimport { registry } from './registry.js'\nimport { CourseThumbnailSchema } from './tag.js'\n\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | unknown[]\n | Record<string, unknown>\n\nexport const JsonValueSchema: z.ZodType<JsonValue> = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n])\n\nexport const V1CourseSlugPathParamsSchema = z.object({\n slug: z.string().min(1).max(200),\n})\n\nexport const V1CourseBySlugMetaResponseSchema = z.object({\n ogTitle: z.string(),\n ogDescription: z.string(),\n ogImage: CourseThumbnailSchema.nullable(),\n})\n\nexport const V1CourseLessonSchema = z\n .object({\n id: z.string(),\n order: z.number().int(),\n title: z.string(),\n /** Segment start in the course video (seconds) */\n startSeconds: z.number().int(),\n /** Segment end in the course video (seconds) */\n endSeconds: z.number().int(),\n /** Derived segment length: max(0, endSeconds - startSeconds) */\n durationSeconds: z.number().int(),\n /** Present when request includes a valid member JWT; null when no progress record */\n progress: V1LessonProgressSchema.nullable().optional(),\n })\n .openapi('CourseLesson')\n\nexport const V1CourseLessonMetaSchema = z\n .object({\n order: z.number().int().nullable(),\n title: z.string(),\n /** Derived segment length: max(0, endSeconds - startSeconds) */\n duration: z.number().int(),\n })\n .openapi('CourseLessonMeta')\n\nexport const V1CourseInstructorSchema = z\n .object({\n id: z.string(),\n slug: z.string(),\n name: z.string(),\n title: z.string(),\n bio: z.string(),\n avatar: PhotoSchema.nullable(),\n })\n .openapi('CourseInstructor')\n\nexport const V1CourseResourceSchema = z\n .object({\n id: z.string(),\n title: z.string(),\n description: z.string(),\n /** GCS file URL; empty when no PDF uploaded */\n downloadUrl: z.string(),\n })\n .openapi('CourseResource')\n\nexport const V1CourseFurtherReadingSchema = z\n .object({\n id: z.string(),\n title: z.string(),\n excerpt: z.string(),\n thumbnail: PhotoSchema.nullable(),\n url: z.string(),\n })\n .openapi('CourseFurtherReading')\n\nexport const V1CourseStatusSchema = z.enum(['published', 'coming_soon'])\nexport type V1CourseStatus = z.infer<typeof V1CourseStatusSchema>\n\nexport const V1HeaderCourseBadgeSchema = z.enum(['new', 'wip'])\n\nexport const V1HeaderCourseItemSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n badge: V1HeaderCourseBadgeSchema.optional(),\n })\n .openapi('HeaderCourseItem')\n\nexport const V1CoursesListResponseSchema = z\n .object({\n courses: z.array(V1HeaderCourseItemSchema),\n })\n .openapi('CoursesListResponse')\n\n/** Learning badge is only `new`; `wip` / coming_soon courses are excluded from this list. */\nexport const V1LearningCourseBadgeSchema = z.literal('new')\n\nexport const V1LearningCourseItemSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n image: PhotoSchema.nullable(),\n badge: V1LearningCourseBadgeSchema.optional(),\n launchAt: z.iso.datetime().nullable(),\n completedLessons: z.number().int().nonnegative(),\n totalLessons: z.number().int().nonnegative(),\n progressPercent: z.number().int().min(0).max(100),\n /** Title of the next incomplete lesson; last lesson title when every lesson is complete. */\n unitTitle: z\n .string()\n .describe(\n 'Title of the next incomplete lesson; last lesson title when every lesson is complete.'\n ),\n })\n .openapi('LearningCourseItem')\n\nexport const V1CoursesLearningListResponseSchema = z\n .object({\n courses: z.array(V1LearningCourseItemSchema),\n })\n .openapi('CoursesLearningListResponse')\n\nexport const V1CourseTagSchema = z.object({\n slug: z.string(),\n name: z.string(),\n})\n\nexport const V1ClassroomBySlugResponseSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n summary: z.string(),\n /** published: full payload; coming_soon: lessons/resources/furtherReading/previewVideoId stripped */\n status: V1CourseStatusSchema,\n tags: z.array(V1CourseTagSchema),\n /** Trial/preview stream only; null when unconfigured or course is coming_soon */\n previewVideoId: z.string().nullable(),\n /** Course video Cloudflare stream id; null when unpaid or not set */\n videoId: z.string().nullable(),\n lessons: z.array(V1CourseLessonSchema),\n instructors: z.array(V1CourseInstructorSchema),\n resources: z.array(V1CourseResourceSchema),\n furtherReading: z.array(V1CourseFurtherReadingSchema),\n })\n .openapi('ClassroomDetail')\n\nexport const V1CourseBySlugResponseSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n summary: z.string(),\n launchAt: z.iso.datetime().nullable(),\n description: JsonValueSchema.nullable(),\n /** published: full payload; coming_soon: lessons/resources/furtherReading/previewVideoId stripped */\n status: V1CourseStatusSchema,\n tags: z.array(V1CourseTagSchema),\n /** Trial/preview stream only; null when unconfigured or course is coming_soon */\n trialVideos: z.array(CloudflareStreamVideoSchema).nullable(),\n lessonsMeta: z.array(V1CourseLessonMetaSchema),\n instructors: z.array(V1CourseInstructorSchema),\n heroImageVideo: CloudflareStreamVideoSchema.nullable(),\n heroImage: PhotoSchema.nullable(),\n })\n .openapi('CourseDetail')\n\n// --- OpenAPI path registration ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/courses',\n tags: ['Courses'],\n description: 'Header course list.',\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CoursesListResponseSchema },\n },\n },\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/courses/{slug}/meta',\n tags: ['Courses'],\n description: 'OG metadata for a course page.',\n request: { params: V1CourseSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CourseBySlugMetaResponseSchema },\n },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 404: {\n description: 'Course not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/courses/{slug}',\n tags: ['Courses'],\n description:\n 'Full course detail for the classroom page. When status is coming_soon, lessons, resources, furtherReading, and previewVideoId are empty/null while title, description, tags, and instructors remain visible.',\n request: { params: V1CourseSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CourseBySlugResponseSchema },\n },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 404: {\n description: 'Course not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,SAASC,2BAA2B,QAAQ,iBAAiB;AAC7D,SAASC,mBAAmB,QAAQ,YAAY;AAChD,SAASC,2BAA2B,QAAQ,wBAAwB;AACpE,SAASC,sBAAsB,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,QAAQ,YAAY;AACxC,SAASC,QAAQ,QAAQ,eAAe;AACxC,SAASC,qBAAqB,QAAQ,UAAU;AAUhD,OAAO,MAAMC,eAAqC,GAAGR,CAAC,CAACS,KAAK,CAAC,CAC3DT,CAAC,CAACU,MAAM,CAAC,CAAC,EACVV,CAAC,CAACW,MAAM,CAAC,CAAC,EACVX,CAAC,CAACY,OAAO,CAAC,CAAC,EACXZ,CAAC,CAACa,IAAI,CAAC,CAAC,EACRb,CAAC,CAACc,KAAK,CAACd,CAAC,CAACe,OAAO,CAAC,CAAC,CAAC,EACpBf,CAAC,CAACgB,MAAM,CAAChB,CAAC,CAACU,MAAM,CAAC,CAAC,EAAEV,CAAC,CAACe,OAAO,CAAC,CAAC,CAAC,CAClC,CAAC;AAEF,OAAO,MAAME,4BAA4B,GAAGjB,CAAC,CAACkB,MAAM,CAAC;EACnDC,IAAI,EAAEnB,CAAC,CAACU,MAAM,CAAC,CAAC,CAACU,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG;AACjC,CAAC,CAAC;AAEF,OAAO,MAAMC,gCAAgC,GAAGtB,CAAC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EAAE,aAAa;MAC1BgD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACH2C,WAAW,EAAE,kBAAkB;MAC/BgD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
package/dist/schemas/home.d.ts
CHANGED
|
@@ -3,13 +3,29 @@ export declare const V1HomePostCardSchema: z.ZodObject<{
|
|
|
3
3
|
title: z.ZodString;
|
|
4
4
|
description: z.ZodString;
|
|
5
5
|
link: z.ZodString;
|
|
6
|
-
|
|
6
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
7
|
+
title: z.ZodString;
|
|
8
|
+
resized: z.ZodObject<{
|
|
9
|
+
tiny: z.ZodString;
|
|
10
|
+
small: z.ZodString;
|
|
11
|
+
medium: z.ZodString;
|
|
12
|
+
large: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
7
15
|
}, z.core.$strip>;
|
|
8
16
|
export declare const V1HomeActivityCardSchema: z.ZodObject<{
|
|
9
17
|
title: z.ZodString;
|
|
10
18
|
description: z.ZodString;
|
|
11
19
|
link: z.ZodString;
|
|
12
|
-
|
|
20
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
21
|
+
title: z.ZodString;
|
|
22
|
+
resized: z.ZodObject<{
|
|
23
|
+
tiny: z.ZodString;
|
|
24
|
+
small: z.ZodString;
|
|
25
|
+
medium: z.ZodString;
|
|
26
|
+
large: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
13
29
|
badgeText: z.ZodString;
|
|
14
30
|
buttonText: z.ZodString;
|
|
15
31
|
}, z.core.$strip>;
|
|
@@ -17,7 +33,15 @@ export declare const V1HomeCourseCardSchema: z.ZodObject<{
|
|
|
17
33
|
title: z.ZodString;
|
|
18
34
|
description: z.ZodString;
|
|
19
35
|
slug: z.ZodString;
|
|
20
|
-
|
|
36
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
37
|
+
title: z.ZodString;
|
|
38
|
+
resized: z.ZodObject<{
|
|
39
|
+
tiny: z.ZodString;
|
|
40
|
+
small: z.ZodString;
|
|
41
|
+
medium: z.ZodString;
|
|
42
|
+
large: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
21
45
|
instructors: z.ZodArray<z.ZodObject<{
|
|
22
46
|
name: z.ZodString;
|
|
23
47
|
}, z.core.$strip>>;
|
|
@@ -26,10 +50,10 @@ export declare const V1HomeCourseCardSchema: z.ZodObject<{
|
|
|
26
50
|
name: z.ZodString;
|
|
27
51
|
ogTitle: z.ZodString;
|
|
28
52
|
ogDescription: z.ZodString;
|
|
29
|
-
homePageImageXL: z.ZodString
|
|
30
|
-
homePageImageL: z.ZodString
|
|
31
|
-
homePageImageM: z.ZodString
|
|
32
|
-
homePageImageS: z.ZodString
|
|
53
|
+
homePageImageXL: z.ZodNullable<z.ZodString>;
|
|
54
|
+
homePageImageL: z.ZodNullable<z.ZodString>;
|
|
55
|
+
homePageImageM: z.ZodNullable<z.ZodString>;
|
|
56
|
+
homePageImageS: z.ZodNullable<z.ZodString>;
|
|
33
57
|
}, z.core.$strip>>;
|
|
34
58
|
status: z.ZodEnum<{
|
|
35
59
|
published: "published";
|
|
@@ -42,13 +66,29 @@ export declare const V1HomePageResponseSchema: z.ZodObject<{
|
|
|
42
66
|
title: z.ZodString;
|
|
43
67
|
description: z.ZodString;
|
|
44
68
|
link: z.ZodString;
|
|
45
|
-
|
|
69
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
70
|
+
title: z.ZodString;
|
|
71
|
+
resized: z.ZodObject<{
|
|
72
|
+
tiny: z.ZodString;
|
|
73
|
+
small: z.ZodString;
|
|
74
|
+
medium: z.ZodString;
|
|
75
|
+
large: z.ZodString;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
46
78
|
}, z.core.$strip>>;
|
|
47
79
|
activities: z.ZodArray<z.ZodObject<{
|
|
48
80
|
title: z.ZodString;
|
|
49
81
|
description: z.ZodString;
|
|
50
82
|
link: z.ZodString;
|
|
51
|
-
|
|
83
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
84
|
+
title: z.ZodString;
|
|
85
|
+
resized: z.ZodObject<{
|
|
86
|
+
tiny: z.ZodString;
|
|
87
|
+
small: z.ZodString;
|
|
88
|
+
medium: z.ZodString;
|
|
89
|
+
large: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
}, z.core.$strip>>;
|
|
52
92
|
badgeText: z.ZodString;
|
|
53
93
|
buttonText: z.ZodString;
|
|
54
94
|
}, z.core.$strip>>;
|
|
@@ -56,7 +96,15 @@ export declare const V1HomePageResponseSchema: z.ZodObject<{
|
|
|
56
96
|
title: z.ZodString;
|
|
57
97
|
description: z.ZodString;
|
|
58
98
|
slug: z.ZodString;
|
|
59
|
-
|
|
99
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
100
|
+
title: z.ZodString;
|
|
101
|
+
resized: z.ZodObject<{
|
|
102
|
+
tiny: z.ZodString;
|
|
103
|
+
small: z.ZodString;
|
|
104
|
+
medium: z.ZodString;
|
|
105
|
+
large: z.ZodString;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
60
108
|
instructors: z.ZodArray<z.ZodObject<{
|
|
61
109
|
name: z.ZodString;
|
|
62
110
|
}, z.core.$strip>>;
|
|
@@ -65,10 +113,10 @@ export declare const V1HomePageResponseSchema: z.ZodObject<{
|
|
|
65
113
|
name: z.ZodString;
|
|
66
114
|
ogTitle: z.ZodString;
|
|
67
115
|
ogDescription: z.ZodString;
|
|
68
|
-
homePageImageXL: z.ZodString
|
|
69
|
-
homePageImageL: z.ZodString
|
|
70
|
-
homePageImageM: z.ZodString
|
|
71
|
-
homePageImageS: z.ZodString
|
|
116
|
+
homePageImageXL: z.ZodNullable<z.ZodString>;
|
|
117
|
+
homePageImageL: z.ZodNullable<z.ZodString>;
|
|
118
|
+
homePageImageM: z.ZodNullable<z.ZodString>;
|
|
119
|
+
homePageImageS: z.ZodNullable<z.ZodString>;
|
|
72
120
|
}, z.core.$strip>>;
|
|
73
121
|
status: z.ZodEnum<{
|
|
74
122
|
published: "published";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/schemas/home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/schemas/home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;iBAOX,CAAA;AAEtB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;iBASX,CAAA;AAE1B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsBX,CAAA;AAExB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMP,CAAA"}
|
package/dist/schemas/home.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { internalServerErrorResponse } from '../responses.js';
|
|
3
3
|
import { V1CourseStatusSchema } from './course.js';
|
|
4
|
+
import { PhotoSchema } from './photo.js';
|
|
4
5
|
// TODO: import registry from global registry file instead of from tag.js
|
|
5
6
|
import { registry } from './registry.js';
|
|
6
7
|
export const V1HomePostCardSchema = z.object({
|
|
7
8
|
title: z.string(),
|
|
8
9
|
description: z.string(),
|
|
9
10
|
link: z.string(),
|
|
10
|
-
|
|
11
|
+
image: PhotoSchema.nullable()
|
|
11
12
|
}).openapi('PostCard');
|
|
12
13
|
export const V1HomeActivityCardSchema = z.object({
|
|
13
14
|
title: z.string(),
|
|
14
15
|
description: z.string(),
|
|
15
16
|
link: z.string(),
|
|
16
|
-
|
|
17
|
+
image: PhotoSchema.nullable(),
|
|
17
18
|
badgeText: z.string(),
|
|
18
19
|
buttonText: z.string()
|
|
19
20
|
}).openapi('ActivityCard');
|
|
@@ -21,7 +22,7 @@ export const V1HomeCourseCardSchema = z.object({
|
|
|
21
22
|
title: z.string(),
|
|
22
23
|
description: z.string(),
|
|
23
24
|
slug: z.string(),
|
|
24
|
-
|
|
25
|
+
image: PhotoSchema.nullable(),
|
|
25
26
|
instructors: z.array(z.object({
|
|
26
27
|
name: z.string()
|
|
27
28
|
})),
|
|
@@ -30,10 +31,10 @@ export const V1HomeCourseCardSchema = z.object({
|
|
|
30
31
|
name: z.string(),
|
|
31
32
|
ogTitle: z.string(),
|
|
32
33
|
ogDescription: z.string(),
|
|
33
|
-
homePageImageXL: z.string(),
|
|
34
|
-
homePageImageL: z.string(),
|
|
35
|
-
homePageImageM: z.string(),
|
|
36
|
-
homePageImageS: z.string()
|
|
34
|
+
homePageImageXL: z.string().nullable(),
|
|
35
|
+
homePageImageL: z.string().nullable(),
|
|
36
|
+
homePageImageM: z.string().nullable(),
|
|
37
|
+
homePageImageS: z.string().nullable()
|
|
37
38
|
})),
|
|
38
39
|
status: V1CourseStatusSchema,
|
|
39
40
|
launchAt: z.union([z.iso.datetime(), z.null()])
|
package/dist/schemas/home.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"home.js","names":["z","internalServerErrorResponse","V1CourseStatusSchema","registry","V1HomePostCardSchema","object","title","string","description","link","
|
|
1
|
+
{"version":3,"file":"home.js","names":["z","internalServerErrorResponse","V1CourseStatusSchema","PhotoSchema","registry","V1HomePostCardSchema","object","title","string","description","link","image","nullable","openapi","V1HomeActivityCardSchema","badgeText","buttonText","V1HomeCourseCardSchema","slug","instructors","array","name","tags","ogTitle","ogDescription","homePageImageXL","homePageImageL","homePageImageM","homePageImageS","status","launchAt","union","iso","datetime","null","V1HomePageResponseSchema","posts","activities","courses","registerPath","method","path","responses","content","schema"],"sources":["../../src/schemas/home.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { internalServerErrorResponse } from '../responses.js'\nimport { V1CourseStatusSchema } from './course.js'\nimport { PhotoSchema } from './photo.js'\n// TODO: import registry from global registry file instead of from tag.js\nimport { registry } from './registry.js'\n\nexport const V1HomePostCardSchema = z\n .object({\n title: z.string(),\n description: z.string(),\n link: z.string(),\n image: PhotoSchema.nullable(),\n })\n .openapi('PostCard')\n\nexport const V1HomeActivityCardSchema = z\n .object({\n title: z.string(),\n description: z.string(),\n link: z.string(),\n image: PhotoSchema.nullable(),\n badgeText: z.string(),\n buttonText: z.string(),\n })\n .openapi('ActivityCard')\n\nexport const V1HomeCourseCardSchema = z\n .object({\n title: z.string(),\n description: z.string(),\n slug: z.string(),\n image: PhotoSchema.nullable(),\n instructors: z.array(z.object({ name: z.string() })),\n tags: z.array(\n z.object({\n slug: z.string(),\n name: z.string(),\n ogTitle: z.string(),\n ogDescription: z.string(),\n homePageImageXL: z.string().nullable(),\n homePageImageL: z.string().nullable(),\n homePageImageM: z.string().nullable(),\n homePageImageS: z.string().nullable(),\n })\n ),\n status: V1CourseStatusSchema,\n launchAt: z.union([z.iso.datetime(), z.null()]),\n })\n .openapi('CourseCard')\n\nexport const V1HomePageResponseSchema = z\n .object({\n posts: z.array(V1HomePostCardSchema),\n activities: z.array(V1HomeActivityCardSchema),\n courses: z.array(V1HomeCourseCardSchema),\n })\n .openapi('HomePageResponse')\n\n// --- OpenAPI path registration ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/home',\n tags: ['Home'],\n description: 'Get home page data.',\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1HomePageResponseSchema },\n },\n },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AAkB,CAAC;;AAE9B;;AAEAT,QAAQ,CAACmC,YAAY,CAAC;EACpBC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,UAAU;EAChBnB,IAAI,EAAE,CAAC,MAAM,CAAC;EACdb,WAAW,EAAE,qBAAqB;EAClCiC,SAAS,EAAE;IACT,GAAG,EAAE;MACHjC,WAAW,EAAE,SAAS;MACtBkC,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAET;QAAyB;MACzD;IACF,CAAC;IACD,GAAGlC;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
package/dist/schemas/tag.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const CourseThumbnailSchema: z.ZodObject<{
|
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export declare const V1TagBySlugMetaResponseSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
14
15
|
ogTitle: z.ZodString;
|
|
15
16
|
ogDescription: z.ZodString;
|
|
16
17
|
ogImage: z.ZodNullable<z.ZodObject<{
|
|
@@ -58,4 +59,142 @@ export declare const V1TagBySlugCoursesResponseSchema: z.ZodObject<{
|
|
|
58
59
|
}, z.core.$strip>>;
|
|
59
60
|
}, z.core.$strip>>;
|
|
60
61
|
}, z.core.$strip>;
|
|
62
|
+
export declare const V1TagRelatedTagSchema: z.ZodObject<{
|
|
63
|
+
slug: z.ZodString;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export declare const V1TagPostCardSchema: z.ZodObject<{
|
|
67
|
+
title: z.ZodString;
|
|
68
|
+
description: z.ZodString;
|
|
69
|
+
link: z.ZodString;
|
|
70
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
71
|
+
title: z.ZodString;
|
|
72
|
+
resized: z.ZodObject<{
|
|
73
|
+
tiny: z.ZodString;
|
|
74
|
+
small: z.ZodString;
|
|
75
|
+
medium: z.ZodString;
|
|
76
|
+
large: z.ZodString;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export declare const V1TagActivityCardSchema: z.ZodObject<{
|
|
81
|
+
title: z.ZodString;
|
|
82
|
+
description: z.ZodString;
|
|
83
|
+
link: z.ZodString;
|
|
84
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
85
|
+
title: z.ZodString;
|
|
86
|
+
resized: z.ZodObject<{
|
|
87
|
+
tiny: z.ZodString;
|
|
88
|
+
small: z.ZodString;
|
|
89
|
+
medium: z.ZodString;
|
|
90
|
+
large: z.ZodString;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
badgeText: z.ZodString;
|
|
94
|
+
buttonText: z.ZodString;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export declare const V1TagCourseCardSchema: z.ZodObject<{
|
|
97
|
+
title: z.ZodString;
|
|
98
|
+
summary: z.ZodString;
|
|
99
|
+
slug: z.ZodString;
|
|
100
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
101
|
+
title: z.ZodString;
|
|
102
|
+
resized: z.ZodObject<{
|
|
103
|
+
tiny: z.ZodString;
|
|
104
|
+
small: z.ZodString;
|
|
105
|
+
medium: z.ZodString;
|
|
106
|
+
large: z.ZodString;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
instructors: z.ZodArray<z.ZodObject<{
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
status: z.ZodEnum<{
|
|
113
|
+
published: "published";
|
|
114
|
+
coming_soon: "coming_soon";
|
|
115
|
+
}>;
|
|
116
|
+
launchAt: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
export declare const V1TagBySlugResponseSchema: z.ZodObject<{
|
|
119
|
+
slug: z.ZodString;
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
relatedTags: z.ZodArray<z.ZodObject<{
|
|
122
|
+
slug: z.ZodString;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
courses: z.ZodArray<z.ZodObject<{
|
|
126
|
+
title: z.ZodString;
|
|
127
|
+
summary: z.ZodString;
|
|
128
|
+
slug: z.ZodString;
|
|
129
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
130
|
+
title: z.ZodString;
|
|
131
|
+
resized: z.ZodObject<{
|
|
132
|
+
tiny: z.ZodString;
|
|
133
|
+
small: z.ZodString;
|
|
134
|
+
medium: z.ZodString;
|
|
135
|
+
large: z.ZodString;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
instructors: z.ZodArray<z.ZodObject<{
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
}, z.core.$strip>>;
|
|
141
|
+
status: z.ZodEnum<{
|
|
142
|
+
published: "published";
|
|
143
|
+
coming_soon: "coming_soon";
|
|
144
|
+
}>;
|
|
145
|
+
launchAt: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
activities: z.ZodArray<z.ZodObject<{
|
|
148
|
+
title: z.ZodString;
|
|
149
|
+
description: z.ZodString;
|
|
150
|
+
link: z.ZodString;
|
|
151
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
152
|
+
title: z.ZodString;
|
|
153
|
+
resized: z.ZodObject<{
|
|
154
|
+
tiny: z.ZodString;
|
|
155
|
+
small: z.ZodString;
|
|
156
|
+
medium: z.ZodString;
|
|
157
|
+
large: z.ZodString;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
}, z.core.$strip>>;
|
|
160
|
+
badgeText: z.ZodString;
|
|
161
|
+
buttonText: z.ZodString;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
posts: z.ZodArray<z.ZodObject<{
|
|
164
|
+
title: z.ZodString;
|
|
165
|
+
description: z.ZodString;
|
|
166
|
+
link: z.ZodString;
|
|
167
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
168
|
+
title: z.ZodString;
|
|
169
|
+
resized: z.ZodObject<{
|
|
170
|
+
tiny: z.ZodString;
|
|
171
|
+
small: z.ZodString;
|
|
172
|
+
medium: z.ZodString;
|
|
173
|
+
large: z.ZodString;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
postsCount: z.ZodNumber;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export declare const V1TagBySlugPostsQuerySchema: z.ZodObject<{
|
|
180
|
+
take: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
181
|
+
skip: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export declare const V1TagBySlugPostsResponseSchema: z.ZodObject<{
|
|
184
|
+
posts: z.ZodArray<z.ZodObject<{
|
|
185
|
+
title: z.ZodString;
|
|
186
|
+
description: z.ZodString;
|
|
187
|
+
link: z.ZodString;
|
|
188
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
189
|
+
title: z.ZodString;
|
|
190
|
+
resized: z.ZodObject<{
|
|
191
|
+
tiny: z.ZodString;
|
|
192
|
+
small: z.ZodString;
|
|
193
|
+
medium: z.ZodString;
|
|
194
|
+
large: z.ZodString;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
postsCount: z.ZodNumber;
|
|
199
|
+
}, z.core.$strip>;
|
|
61
200
|
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/schemas/tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,yBAAyB;;iBAEpC,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;iBAIL,CAAA;AAI7B,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/schemas/tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,yBAAyB;;iBAEpC,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;iBAIL,CAAA;AAI7B,eAAO,MAAM,6BAA6B;;;;;;;;;;;;iBAKxC,CAAA;AAIF,eAAO,MAAM,6BAA6B;;;iBAGxC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;iBAQL,CAAA;AAExB,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;iBAI3C,CAAA;AAuDF,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;iBAK9B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;iBAOlC,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;iBAQhC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQpC,CAAA;AAIF,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;iBAGzC,CAAA"}
|
package/dist/schemas/tag.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { internalServerErrorResponse } from '../responses.js';
|
|
3
3
|
import { RestErrorBodySchema } from '../rest.js';
|
|
4
|
-
import { PhotoResizedSchema } from './photo.js';
|
|
4
|
+
import { PhotoResizedSchema, PhotoSchema } from './photo.js';
|
|
5
5
|
import { registry } from './registry.js';
|
|
6
6
|
|
|
7
7
|
// --- Shared path params ---
|
|
@@ -16,6 +16,7 @@ export const CourseThumbnailSchema = z.object({
|
|
|
16
16
|
// --- Tag meta response ---
|
|
17
17
|
|
|
18
18
|
export const V1TagBySlugMetaResponseSchema = z.object({
|
|
19
|
+
name: z.string(),
|
|
19
20
|
ogTitle: z.string(),
|
|
20
21
|
ogDescription: z.string(),
|
|
21
22
|
ogImage: CourseThumbnailSchema.nullable()
|
|
@@ -107,4 +108,127 @@ registry.registerPath({
|
|
|
107
108
|
...internalServerErrorResponse
|
|
108
109
|
}
|
|
109
110
|
});
|
|
111
|
+
|
|
112
|
+
// --- Tag page response (full payload for SSR) ---
|
|
113
|
+
|
|
114
|
+
export const V1TagRelatedTagSchema = z.object({
|
|
115
|
+
slug: z.string(),
|
|
116
|
+
name: z.string()
|
|
117
|
+
});
|
|
118
|
+
export const V1TagPostCardSchema = z.object({
|
|
119
|
+
title: z.string(),
|
|
120
|
+
description: z.string(),
|
|
121
|
+
link: z.string(),
|
|
122
|
+
image: PhotoSchema.nullable()
|
|
123
|
+
});
|
|
124
|
+
export const V1TagActivityCardSchema = z.object({
|
|
125
|
+
title: z.string(),
|
|
126
|
+
description: z.string(),
|
|
127
|
+
link: z.string(),
|
|
128
|
+
image: PhotoSchema.nullable(),
|
|
129
|
+
badgeText: z.string(),
|
|
130
|
+
buttonText: z.string()
|
|
131
|
+
});
|
|
132
|
+
export const V1TagCourseCardSchema = z.object({
|
|
133
|
+
title: z.string(),
|
|
134
|
+
summary: z.string(),
|
|
135
|
+
slug: z.string(),
|
|
136
|
+
image: PhotoSchema.nullable(),
|
|
137
|
+
instructors: z.array(z.object({
|
|
138
|
+
name: z.string()
|
|
139
|
+
})),
|
|
140
|
+
status: z.enum(['published', 'coming_soon']),
|
|
141
|
+
launchAt: z.union([z.string(), z.null()])
|
|
142
|
+
});
|
|
143
|
+
export const V1TagBySlugResponseSchema = z.object({
|
|
144
|
+
slug: z.string(),
|
|
145
|
+
name: z.string(),
|
|
146
|
+
relatedTags: z.array(V1TagRelatedTagSchema),
|
|
147
|
+
courses: z.array(V1TagCourseCardSchema),
|
|
148
|
+
activities: z.array(V1TagActivityCardSchema),
|
|
149
|
+
posts: z.array(V1TagPostCardSchema),
|
|
150
|
+
postsCount: z.number().int().min(0)
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// --- Tag posts query & response (for load more) ---
|
|
154
|
+
|
|
155
|
+
export const V1TagBySlugPostsQuerySchema = z.object({
|
|
156
|
+
take: z.coerce.number().int().min(1).max(50).optional().default(12),
|
|
157
|
+
skip: z.coerce.number().int().min(0).max(5000).optional().default(0)
|
|
158
|
+
});
|
|
159
|
+
export const V1TagBySlugPostsResponseSchema = z.object({
|
|
160
|
+
posts: z.array(V1TagPostCardSchema),
|
|
161
|
+
postsCount: z.number().int().min(0)
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// --- OpenAPI: GET /v1/tags/{slug} ---
|
|
165
|
+
|
|
166
|
+
registry.registerPath({
|
|
167
|
+
method: 'get',
|
|
168
|
+
path: '/v1/tags/{slug}',
|
|
169
|
+
tags: ['Tags'],
|
|
170
|
+
description: 'Full tag page data (courses, activities, first posts page).',
|
|
171
|
+
request: {
|
|
172
|
+
params: V1TagSlugPathParamsSchema
|
|
173
|
+
},
|
|
174
|
+
responses: {
|
|
175
|
+
200: {
|
|
176
|
+
description: 'Success',
|
|
177
|
+
content: {
|
|
178
|
+
'application/json': {
|
|
179
|
+
schema: V1TagBySlugResponseSchema
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
404: {
|
|
184
|
+
description: 'Tag not found',
|
|
185
|
+
content: {
|
|
186
|
+
'application/json': {
|
|
187
|
+
schema: RestErrorBodySchema
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
...internalServerErrorResponse
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// --- OpenAPI: GET /v1/tags/{slug}/posts ---
|
|
196
|
+
|
|
197
|
+
registry.registerPath({
|
|
198
|
+
method: 'get',
|
|
199
|
+
path: '/v1/tags/{slug}/posts',
|
|
200
|
+
tags: ['Tags'],
|
|
201
|
+
description: 'Paginated posts for a tag (for load more).',
|
|
202
|
+
request: {
|
|
203
|
+
params: V1TagSlugPathParamsSchema,
|
|
204
|
+
query: V1TagBySlugPostsQuerySchema
|
|
205
|
+
},
|
|
206
|
+
responses: {
|
|
207
|
+
200: {
|
|
208
|
+
description: 'Success',
|
|
209
|
+
content: {
|
|
210
|
+
'application/json': {
|
|
211
|
+
schema: V1TagBySlugPostsResponseSchema
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
404: {
|
|
216
|
+
description: 'Tag not found',
|
|
217
|
+
content: {
|
|
218
|
+
'application/json': {
|
|
219
|
+
schema: RestErrorBodySchema
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
400: {
|
|
224
|
+
description: 'Bad request',
|
|
225
|
+
content: {
|
|
226
|
+
'application/json': {
|
|
227
|
+
schema: RestErrorBodySchema
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
...internalServerErrorResponse
|
|
232
|
+
}
|
|
233
|
+
});
|
|
110
234
|
//# sourceMappingURL=tag.js.map
|
package/dist/schemas/tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","names":["z","internalServerErrorResponse","RestErrorBodySchema","PhotoResizedSchema","registry","V1TagSlugPathParamsSchema","object","slug","string","min","max","CourseThumbnailSchema","resized","openapi","V1TagBySlugMetaResponseSchema","ogTitle","ogDescription","ogImage","nullable","V1TagBySlugCoursesQuerySchema","take","coerce","number","int","optional","default","skip","CourseCardSchema","title","subtitle","summary","thumbnail","V1TagBySlugCoursesResponseSchema","name","coursesCount","courses","array","registerPath","method","path","tags","description","request","params","responses","content","schema","query"],"sources":["../../src/schemas/tag.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { internalServerErrorResponse } from '../responses.js'\nimport { RestErrorBodySchema } from '../rest.js'\nimport { PhotoResizedSchema } from './photo.js'\nimport { registry } from './registry.js'\n\n// --- Shared path params ---\n\nexport const V1TagSlugPathParamsSchema = z.object({\n slug: z.string().min(1).max(200),\n})\n\nexport const CourseThumbnailSchema = z\n .object({\n resized: PhotoResizedSchema,\n })\n .openapi('CourseThumbnail')\n\n// --- Tag meta response ---\n\nexport const V1TagBySlugMetaResponseSchema = z.object({\n ogTitle: z.string(),\n ogDescription: z.string(),\n ogImage: CourseThumbnailSchema.nullable(),\n})\n\n// --- Tag courses query & response ---\n\nexport const V1TagBySlugCoursesQuerySchema = z.object({\n take: z.coerce.number().int().min(1).max(50).optional().default(12),\n skip: z.coerce.number().int().min(0).max(5000).optional().default(0),\n})\n\nexport const CourseCardSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n summary: z.string(),\n thumbnail: CourseThumbnailSchema.nullable(),\n })\n .openapi('CourseCard')\n\nexport const V1TagBySlugCoursesResponseSchema = z.object({\n name: z.string(),\n coursesCount: z.number().int().min(0),\n courses: z.array(CourseCardSchema),\n})\n\n// --- OpenAPI path registration ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/tags/{slug}/meta',\n tags: ['Tags'],\n description: 'OG metadata for a tag page.',\n request: { params: V1TagSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1TagBySlugMetaResponseSchema },\n },\n },\n 404: {\n description: 'Tag not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/tags/{slug}/courses',\n tags: ['Tags'],\n description: 'Courses for a tag (with count).',\n request: {\n params: V1TagSlugPathParamsSchema,\n query: V1TagBySlugCoursesQuerySchema,\n },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1TagBySlugCoursesResponseSchema },\n },\n },\n 404: {\n description: 'Tag not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,SAASC,2BAA2B,QAAQ,iBAAiB;AAC7D,SAASC,mBAAmB,QAAQ,YAAY;AAChD,SAASC,kBAAkB,QAAQ,YAAY;AAC/C,SAASC,QAAQ,QAAQ,eAAe;;AAExC;;AAEA,OAAO,MAAMC,yBAAyB,GAAGL,CAAC,CAACM,MAAM,CAAC;EAChDC,IAAI,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG;AACjC,CAAC,CAAC;AAEF,OAAO,MAAMC,qBAAqB,GAAGX,CAAC,CACnCM,MAAM,CAAC;EACNM,OAAO,EAAET;AACX,CAAC,CAAC,CACDU,OAAO,CAAC,iBAAiB,CAAC;;AAE7B;;AAEA,OAAO,MAAMC,6BAA6B,GAAGd,CAAC,CAACM,MAAM,CAAC;EACpDS,OAAO,EAAEf,CAAC,CAACQ,MAAM,CAAC,CAAC;EACnBQ,aAAa,EAAEhB,CAAC,CAACQ,MAAM,CAAC,CAAC;EACzBS,OAAO,EAAEN,qBAAqB,CAACO,QAAQ,CAAC;AAC1C,CAAC,CAAC;;AAEF;;AAEA,OAAO,MAAMC,6BAA6B,GAAGnB,CAAC,CAACM,MAAM,CAAC;EACpDc,IAAI,EAAEpB,CAAC,CAACqB,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACd,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,EAAE,CAAC,CAACc,QAAQ,CAAC,CAAC,CAACC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AAEC,MAAM,EAAEhC;QAA8B;MAC9D;IACF,CAAC;IACD,GAAG,EAAE;MACH2B,WAAW,EAAE,eAAe;MAC5BI,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5C;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC;AAEFG,QAAQ,CAACiC,YAAY,CAAC;EACpBC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,yBAAyB;EAC/BC,IAAI,EAAE,CAAC,MAAM,CAAC;EACdC,WAAW,EAAE,iCAAiC;EAC9CC,OAAO,EAAE;IACPC,MAAM,EAAEtC,yBAAyB;IACjC0C,KAAK,EAAE5B;EACT,CAAC;EACDyB,SAAS,EAAE;IACT,GAAG,EAAE;MACHH,WAAW,EAAE,SAAS;MACtBI,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAEd;QAAiC;MACjE;IACF,CAAC;IACD,GAAG,EAAE;MACHS,WAAW,EAAE,eAAe;MAC5BI,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5C;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACHuC,WAAW,EAAE,aAAa;MAC1BI,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5C;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"tag.js","names":["z","internalServerErrorResponse","RestErrorBodySchema","PhotoResizedSchema","PhotoSchema","registry","V1TagSlugPathParamsSchema","object","slug","string","min","max","CourseThumbnailSchema","resized","openapi","V1TagBySlugMetaResponseSchema","name","ogTitle","ogDescription","ogImage","nullable","V1TagBySlugCoursesQuerySchema","take","coerce","number","int","optional","default","skip","CourseCardSchema","title","subtitle","summary","thumbnail","V1TagBySlugCoursesResponseSchema","coursesCount","courses","array","registerPath","method","path","tags","description","request","params","responses","content","schema","query","V1TagRelatedTagSchema","V1TagPostCardSchema","link","image","V1TagActivityCardSchema","badgeText","buttonText","V1TagCourseCardSchema","instructors","status","enum","launchAt","union","null","V1TagBySlugResponseSchema","relatedTags","activities","posts","postsCount","V1TagBySlugPostsQuerySchema","V1TagBySlugPostsResponseSchema"],"sources":["../../src/schemas/tag.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { internalServerErrorResponse } from '../responses.js'\nimport { RestErrorBodySchema } from '../rest.js'\nimport { PhotoResizedSchema, PhotoSchema } from './photo.js'\nimport { registry } from './registry.js'\n\n// --- Shared path params ---\n\nexport const V1TagSlugPathParamsSchema = z.object({\n slug: z.string().min(1).max(200),\n})\n\nexport const CourseThumbnailSchema = z\n .object({\n resized: PhotoResizedSchema,\n })\n .openapi('CourseThumbnail')\n\n// --- Tag meta response ---\n\nexport const V1TagBySlugMetaResponseSchema = z.object({\n name: z.string(),\n ogTitle: z.string(),\n ogDescription: z.string(),\n ogImage: CourseThumbnailSchema.nullable(),\n})\n\n// --- Tag courses query & response ---\n\nexport const V1TagBySlugCoursesQuerySchema = z.object({\n take: z.coerce.number().int().min(1).max(50).optional().default(12),\n skip: z.coerce.number().int().min(0).max(5000).optional().default(0),\n})\n\nexport const CourseCardSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n summary: z.string(),\n thumbnail: CourseThumbnailSchema.nullable(),\n })\n .openapi('CourseCard')\n\nexport const V1TagBySlugCoursesResponseSchema = z.object({\n name: z.string(),\n coursesCount: z.number().int().min(0),\n courses: z.array(CourseCardSchema),\n})\n\n// --- OpenAPI path registration ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/tags/{slug}/meta',\n tags: ['Tags'],\n description: 'OG metadata for a tag page.',\n request: { params: V1TagSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1TagBySlugMetaResponseSchema },\n },\n },\n 404: {\n description: 'Tag not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/tags/{slug}/courses',\n tags: ['Tags'],\n description: 'Courses for a tag (with count).',\n request: {\n params: V1TagSlugPathParamsSchema,\n query: V1TagBySlugCoursesQuerySchema,\n },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1TagBySlugCoursesResponseSchema },\n },\n },\n 404: {\n description: 'Tag not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n\n// --- Tag page response (full payload for SSR) ---\n\nexport const V1TagRelatedTagSchema = z.object({\n slug: z.string(),\n name: z.string(),\n})\n\nexport const V1TagPostCardSchema = z.object({\n title: z.string(),\n description: z.string(),\n link: z.string(),\n image: PhotoSchema.nullable(),\n})\n\nexport const V1TagActivityCardSchema = z.object({\n title: z.string(),\n description: z.string(),\n link: z.string(),\n image: PhotoSchema.nullable(),\n badgeText: z.string(),\n buttonText: z.string(),\n})\n\nexport const V1TagCourseCardSchema = z.object({\n title: z.string(),\n summary: z.string(),\n slug: z.string(),\n image: PhotoSchema.nullable(),\n instructors: z.array(z.object({ name: z.string() })),\n status: z.enum(['published', 'coming_soon']),\n launchAt: z.union([z.string(), z.null()]),\n})\n\nexport const V1TagBySlugResponseSchema = z.object({\n slug: z.string(),\n name: z.string(),\n relatedTags: z.array(V1TagRelatedTagSchema),\n courses: z.array(V1TagCourseCardSchema),\n activities: z.array(V1TagActivityCardSchema),\n posts: z.array(V1TagPostCardSchema),\n postsCount: z.number().int().min(0),\n})\n\n// --- Tag posts query & response (for load more) ---\n\nexport const V1TagBySlugPostsQuerySchema = z.object({\n take: z.coerce.number().int().min(1).max(50).optional().default(12),\n skip: z.coerce.number().int().min(0).max(5000).optional().default(0),\n})\n\nexport const V1TagBySlugPostsResponseSchema = z.object({\n posts: z.array(V1TagPostCardSchema),\n postsCount: z.number().int().min(0),\n})\n\n// --- OpenAPI: GET /v1/tags/{slug} ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/tags/{slug}',\n tags: ['Tags'],\n description: 'Full tag page data (courses, activities, first posts page).',\n request: { params: V1TagSlugPathParamsSchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1TagBySlugResponseSchema },\n },\n },\n 404: {\n description: 'Tag not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n\n// --- OpenAPI: GET /v1/tags/{slug}/posts ---\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/tags/{slug}/posts',\n tags: ['Tags'],\n description: 'Paginated posts for a tag (for load more).',\n request: {\n params: V1TagSlugPathParamsSchema,\n query: V1TagBySlugPostsQuerySchema,\n },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1TagBySlugPostsResponseSchema },\n },\n },\n 404: {\n description: 'Tag not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 400: {\n description: 'Bad request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...internalServerErrorResponse,\n },\n})\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,SAASC,2BAA2B,QAAQ,iBAAiB;AAC7D,SAASC,mBAAmB,QAAQ,YAAY;AAChD,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,YAAY;AAC5D,SAASC,QAAQ,QAAQ,eAAe;;AAExC;;AAEA,OAAO,MAAMC,yBAAyB,GAAGN,CAAC,CAACO,MAAM,CAAC;EAChDC,IAAI,EAAER,CAAC,CAACS,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG;AACjC,CAAC,CAAC;AAEF,OAAO,MAAMC,qBAAqB,GAAGZ,CAAC,CACnCO,MAAM,CAAC;EACNM,OAAO,EAAEV;AACX,CAAC,CAAC,CACDW,OAAO,CAAC,iBAA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