@twreporter-academy/api-types 0.0.21 → 0.0.22
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/constants/course.d.ts +2 -0
- package/dist/constants/course.d.ts.map +1 -0
- package/dist/constants/course.js +2 -0
- package/dist/constants/course.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/course.d.ts +52 -0
- package/dist/schemas/course.d.ts.map +1 -1
- package/dist/schemas/course.js +35 -0
- package/dist/schemas/course.js.map +1 -1
- package/dist/schemas/post.d.ts +44 -0
- package/dist/schemas/post.d.ts.map +1 -1
- package/dist/schemas/post.js +50 -0
- package/dist/schemas/post.js.map +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"course.d.ts","sourceRoot":"","sources":["../../src/constants/course.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"course.js","names":["NEW_COURSE_BADGE_DAYS"],"sources":["../../src/constants/course.ts"],"sourcesContent":["export const NEW_COURSE_BADGE_DAYS = 30\n"],"mappings":"AAAA,OAAO,MAAMA,qBAAqB,GAAG,EAAE","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './api-variables.js'\nexport * from './openapi.js'\nexport * from './rest.js'\nexport * from './schemas/activity.js'\nexport * from './schemas/course.js'\nexport * from './schemas/home.js'\nexport * from './schemas/lesson-progress.js'\nexport * from './schemas/member.js'\nexport * from './schemas/photo.js'\nexport * from './schemas/post.js'\nexport * from './schemas/tag.js'\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,8BAA8B;AAC5C,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './api-variables.js'\nexport * from './constants/course.js'\nexport * from './openapi.js'\nexport * from './rest.js'\nexport * from './schemas/activity.js'\nexport * from './schemas/course.js'\nexport * from './schemas/home.js'\nexport * from './schemas/lesson-progress.js'\nexport * from './schemas/member.js'\nexport * from './schemas/photo.js'\nexport * from './schemas/post.js'\nexport * from './schemas/tag.js'\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,8BAA8B;AAC5C,cAAc,qBAAqB;AACnC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB","ignoreList":[]}
|
package/dist/schemas/course.d.ts
CHANGED
|
@@ -100,6 +100,58 @@ export declare const V1CoursesListResponseSchema: z.ZodObject<{
|
|
|
100
100
|
}>>;
|
|
101
101
|
}, z.core.$strip>>;
|
|
102
102
|
}, z.core.$strip>;
|
|
103
|
+
export declare const V1CourseCatalogItemSchema: z.ZodObject<{
|
|
104
|
+
slug: z.ZodString;
|
|
105
|
+
title: z.ZodString;
|
|
106
|
+
subtitle: z.ZodString;
|
|
107
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
108
|
+
resized: z.ZodObject<{
|
|
109
|
+
tiny: z.ZodString;
|
|
110
|
+
small: z.ZodString;
|
|
111
|
+
medium: z.ZodString;
|
|
112
|
+
large: z.ZodString;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
instructors: z.ZodArray<z.ZodObject<{
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
119
|
+
slug: z.ZodString;
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
status: z.ZodEnum<{
|
|
123
|
+
published: "published";
|
|
124
|
+
coming_soon: "coming_soon";
|
|
125
|
+
}>;
|
|
126
|
+
launchAt: z.ZodNullable<z.ZodISODateTime>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export declare const V1CoursesCatalogResponseSchema: z.ZodObject<{
|
|
129
|
+
courses: z.ZodArray<z.ZodObject<{
|
|
130
|
+
slug: z.ZodString;
|
|
131
|
+
title: z.ZodString;
|
|
132
|
+
subtitle: z.ZodString;
|
|
133
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
134
|
+
resized: z.ZodObject<{
|
|
135
|
+
tiny: z.ZodString;
|
|
136
|
+
small: z.ZodString;
|
|
137
|
+
medium: z.ZodString;
|
|
138
|
+
large: z.ZodString;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
}, z.core.$strip>>;
|
|
141
|
+
instructors: z.ZodArray<z.ZodObject<{
|
|
142
|
+
name: z.ZodString;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
145
|
+
slug: z.ZodString;
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
status: z.ZodEnum<{
|
|
149
|
+
published: "published";
|
|
150
|
+
coming_soon: "coming_soon";
|
|
151
|
+
}>;
|
|
152
|
+
launchAt: z.ZodNullable<z.ZodISODateTime>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
}, z.core.$strip>;
|
|
103
155
|
/** Learning badge is only `new`; `wip` / coming_soon courses are excluded from this list. */
|
|
104
156
|
export declare const V1LearningCourseBadgeSchema: z.ZodLiteral<"new">;
|
|
105
157
|
export declare const V1LearningCourseItemSchema: z.ZodObject<{
|
|
@@ -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,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBf,CAAA;AAE7B,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBf,CAAA"}
|
package/dist/schemas/course.js
CHANGED
|
@@ -67,6 +67,24 @@ export const V1HeaderCourseItemSchema = z.object({
|
|
|
67
67
|
export const V1CoursesListResponseSchema = z.object({
|
|
68
68
|
courses: z.array(V1HeaderCourseItemSchema)
|
|
69
69
|
}).openapi('CoursesListResponse');
|
|
70
|
+
export const V1CourseCatalogItemSchema = z.object({
|
|
71
|
+
slug: z.string(),
|
|
72
|
+
title: z.string(),
|
|
73
|
+
subtitle: z.string(),
|
|
74
|
+
image: CourseThumbnailSchema.nullable(),
|
|
75
|
+
instructors: z.array(z.object({
|
|
76
|
+
name: z.string()
|
|
77
|
+
})),
|
|
78
|
+
tags: z.array(z.object({
|
|
79
|
+
slug: z.string(),
|
|
80
|
+
name: z.string()
|
|
81
|
+
})),
|
|
82
|
+
status: V1CourseStatusSchema,
|
|
83
|
+
launchAt: z.iso.datetime().nullable()
|
|
84
|
+
}).openapi('CourseCatalogItem');
|
|
85
|
+
export const V1CoursesCatalogResponseSchema = z.object({
|
|
86
|
+
courses: z.array(V1CourseCatalogItemSchema)
|
|
87
|
+
}).openapi('CoursesCatalogResponse');
|
|
70
88
|
|
|
71
89
|
/** Learning badge is only `new`; `wip` / coming_soon courses are excluded from this list. */
|
|
72
90
|
export const V1LearningCourseBadgeSchema = z.literal('new');
|
|
@@ -144,6 +162,23 @@ registry.registerPath({
|
|
|
144
162
|
...internalServerErrorResponse
|
|
145
163
|
}
|
|
146
164
|
});
|
|
165
|
+
registry.registerPath({
|
|
166
|
+
method: 'get',
|
|
167
|
+
path: '/v1/courses/catalog',
|
|
168
|
+
tags: ['Courses'],
|
|
169
|
+
description: 'Public course catalog.',
|
|
170
|
+
responses: {
|
|
171
|
+
200: {
|
|
172
|
+
description: 'Success',
|
|
173
|
+
content: {
|
|
174
|
+
'application/json': {
|
|
175
|
+
schema: V1CoursesCatalogResponseSchema
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
...internalServerErrorResponse
|
|
180
|
+
}
|
|
181
|
+
});
|
|
147
182
|
registry.registerPath({
|
|
148
183
|
method: 'get',
|
|
149
184
|
path: '/v1/courses/{slug}/meta',
|
|
@@ -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","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","heroImageVideoPortrait","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 heroImageVideoPortrait: 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,CAACkB,MAAM,CAAC;EACvDK,OAAO,EAAEvB,CAAC,CAACU,MAAM,CAAC,CAAC;EACnBc,aAAa,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AAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE7F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACH2C,WAAW,EAAE,kBAAkB;MAC/BiD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE7F;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","V1CourseCatalogItemSchema","image","instructors","tags","status","launchAt","iso","datetime","V1CoursesCatalogResponseSchema","V1LearningCourseBadgeSchema","literal","V1LearningCourseItemSchema","completedLessons","nonnegative","totalLessons","progressPercent","unitTitle","describe","V1CoursesLearningListResponseSchema","V1CourseTagSchema","V1ClassroomBySlugResponseSchema","summary","previewVideoId","videoId","lessons","resources","furtherReading","V1CourseBySlugResponseSchema","trialVideos","lessonsMeta","heroImageVideo","heroImageVideoPortrait","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\nexport const V1CourseCatalogItemSchema = z\n .object({\n slug: z.string(),\n title: z.string(),\n subtitle: z.string(),\n image: CourseThumbnailSchema.nullable(),\n instructors: z.array(z.object({ name: z.string() })),\n tags: z.array(z.object({ slug: z.string(), name: z.string() })),\n status: V1CourseStatusSchema,\n launchAt: z.iso.datetime().nullable(),\n })\n .openapi('CourseCatalogItem')\n\nexport const V1CoursesCatalogResponseSchema = z\n .object({\n courses: z.array(V1CourseCatalogItemSchema),\n })\n .openapi('CoursesCatalogResponse')\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 heroImageVideoPortrait: 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/catalog',\n tags: ['Courses'],\n description: 'Public course catalog.',\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1CoursesCatalogResponseSchema },\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,CAA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C,WAAW,EAAE,kBAAkB;MAC/BmD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE/F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC;AAEFK,QAAQ,CAACsF,YAAY,CAAC;EACpBC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,oBAAoB;EAC1BhC,IAAI,EAAE,CAAC,SAAS,CAAC;EACjBjB,WAAW,EACT,8MAA8M;EAChNqD,OAAO,EAAE;IAAEC,MAAM,EAAElF;EAA6B,CAAC;EACjD8E,SAAS,EAAE;IACT,GAAG,EAAE;MACHlD,WAAW,EAAE,SAAS;MACtBmD,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAEX;QAA6B;MAC7D;IACF,CAAC;IACD,GAAG,EAAE;MACHzC,WAAW,EAAE,aAAa;MAC1BmD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE/F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACH2C,WAAW,EAAE,kBAAkB;MAC/BmD,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE/F;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
package/dist/schemas/post.d.ts
CHANGED
|
@@ -14,4 +14,48 @@ export declare const V1PostsListResponseSchema: z.ZodObject<{
|
|
|
14
14
|
href: z.ZodString;
|
|
15
15
|
}, z.core.$strip>>;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
|
+
export declare const V1PostsCatalogQuerySchema: z.ZodObject<{
|
|
18
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
19
|
+
take: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
20
|
+
skip: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const V1PostCatalogItemSchema: z.ZodObject<{
|
|
23
|
+
title: z.ZodString;
|
|
24
|
+
description: z.ZodString;
|
|
25
|
+
link: z.ZodString;
|
|
26
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
27
|
+
title: z.ZodString;
|
|
28
|
+
resized: z.ZodObject<{
|
|
29
|
+
tiny: z.ZodString;
|
|
30
|
+
small: z.ZodString;
|
|
31
|
+
medium: z.ZodString;
|
|
32
|
+
large: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const V1PostCatalogTagSchema: z.ZodObject<{
|
|
37
|
+
slug: z.ZodString;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const V1PostsCatalogResponseSchema: z.ZodObject<{
|
|
41
|
+
posts: z.ZodArray<z.ZodObject<{
|
|
42
|
+
title: z.ZodString;
|
|
43
|
+
description: z.ZodString;
|
|
44
|
+
link: z.ZodString;
|
|
45
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
46
|
+
title: z.ZodString;
|
|
47
|
+
resized: z.ZodObject<{
|
|
48
|
+
tiny: z.ZodString;
|
|
49
|
+
small: z.ZodString;
|
|
50
|
+
medium: z.ZodString;
|
|
51
|
+
large: z.ZodString;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
postsCount: z.ZodNumber;
|
|
56
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
57
|
+
slug: z.ZodString;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
}, z.core.$strip>;
|
|
17
61
|
//# sourceMappingURL=post.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/schemas/post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/schemas/post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,sBAAsB;;iBAEjC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;iBAMP,CAAA;AAE5B,eAAO,MAAM,yBAAyB;;;;;;iBAIP,CAAA;AAE/B,eAAO,MAAM,yBAAyB;;;;iBAIpC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;iBAOP,CAAA;AAE7B,eAAO,MAAM,sBAAsB;;;iBAKP,CAAA;AAE5B,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;iBAMP,CAAA"}
|
package/dist/schemas/post.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { internalServerErrorResponse } from '../responses.js';
|
|
2
3
|
import { RestErrorBodySchema } from '../rest.js';
|
|
4
|
+
import { PhotoSchema } from './photo.js';
|
|
3
5
|
import { registry } from './registry.js';
|
|
4
6
|
export const V1PostsListQuerySchema = z.object({
|
|
5
7
|
take: z.coerce.number().int().min(1).max(10).optional()
|
|
@@ -12,6 +14,26 @@ export const V1HeaderPostItemSchema = z.object({
|
|
|
12
14
|
export const V1PostsListResponseSchema = z.object({
|
|
13
15
|
posts: z.array(V1HeaderPostItemSchema)
|
|
14
16
|
}).openapi('PostsListResponse');
|
|
17
|
+
export const V1PostsCatalogQuerySchema = z.object({
|
|
18
|
+
tag: z.string().min(1).max(200).optional(),
|
|
19
|
+
take: z.coerce.number().int().min(1).max(50).optional().default(12),
|
|
20
|
+
skip: z.coerce.number().int().min(0).max(5000).optional().default(0)
|
|
21
|
+
});
|
|
22
|
+
export const V1PostCatalogItemSchema = z.object({
|
|
23
|
+
title: z.string(),
|
|
24
|
+
description: z.string(),
|
|
25
|
+
link: z.string(),
|
|
26
|
+
image: PhotoSchema.nullable()
|
|
27
|
+
}).openapi('PostCatalogItem');
|
|
28
|
+
export const V1PostCatalogTagSchema = z.object({
|
|
29
|
+
slug: z.string(),
|
|
30
|
+
name: z.string()
|
|
31
|
+
}).openapi('PostCatalogTag');
|
|
32
|
+
export const V1PostsCatalogResponseSchema = z.object({
|
|
33
|
+
posts: z.array(V1PostCatalogItemSchema),
|
|
34
|
+
postsCount: z.number().int().nonnegative(),
|
|
35
|
+
tags: z.array(V1PostCatalogTagSchema)
|
|
36
|
+
}).openapi('PostsCatalogResponse');
|
|
15
37
|
registry.registerPath({
|
|
16
38
|
method: 'get',
|
|
17
39
|
path: '/v1/posts',
|
|
@@ -47,4 +69,32 @@ registry.registerPath({
|
|
|
47
69
|
}
|
|
48
70
|
}
|
|
49
71
|
});
|
|
72
|
+
registry.registerPath({
|
|
73
|
+
method: 'get',
|
|
74
|
+
path: '/v1/posts/catalog',
|
|
75
|
+
tags: ['Posts'],
|
|
76
|
+
description: 'Paginated public post catalog with available tags.',
|
|
77
|
+
request: {
|
|
78
|
+
query: V1PostsCatalogQuerySchema
|
|
79
|
+
},
|
|
80
|
+
responses: {
|
|
81
|
+
200: {
|
|
82
|
+
description: 'Success',
|
|
83
|
+
content: {
|
|
84
|
+
'application/json': {
|
|
85
|
+
schema: V1PostsCatalogResponseSchema
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
400: {
|
|
90
|
+
description: 'Invalid request',
|
|
91
|
+
content: {
|
|
92
|
+
'application/json': {
|
|
93
|
+
schema: RestErrorBodySchema
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
...internalServerErrorResponse
|
|
98
|
+
}
|
|
99
|
+
});
|
|
50
100
|
//# sourceMappingURL=post.js.map
|
package/dist/schemas/post.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","names":["z","RestErrorBodySchema","registry","V1PostsListQuerySchema","object","take","coerce","number","int","min","max","optional","V1HeaderPostItemSchema","title","string","imageUrl","nullable","href","openapi","V1PostsListResponseSchema","posts","array","
|
|
1
|
+
{"version":3,"file":"post.js","names":["z","internalServerErrorResponse","RestErrorBodySchema","PhotoSchema","registry","V1PostsListQuerySchema","object","take","coerce","number","int","min","max","optional","V1HeaderPostItemSchema","title","string","imageUrl","nullable","href","openapi","V1PostsListResponseSchema","posts","array","V1PostsCatalogQuerySchema","tag","default","skip","V1PostCatalogItemSchema","description","link","image","V1PostCatalogTagSchema","slug","name","V1PostsCatalogResponseSchema","postsCount","nonnegative","tags","registerPath","method","path","request","query","responses","content","schema"],"sources":["../../src/schemas/post.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { internalServerErrorResponse } from '../responses.js'\nimport { RestErrorBodySchema } from '../rest.js'\nimport { PhotoSchema } from './photo.js'\nimport { registry } from './registry.js'\n\nexport const V1PostsListQuerySchema = z.object({\n take: z.coerce.number().int().min(1).max(10).optional(),\n})\n\nexport const V1HeaderPostItemSchema = z\n .object({\n title: z.string(),\n imageUrl: z.string().nullable(),\n href: z.string(),\n })\n .openapi('HeaderPostItem')\n\nexport const V1PostsListResponseSchema = z\n .object({\n posts: z.array(V1HeaderPostItemSchema),\n })\n .openapi('PostsListResponse')\n\nexport const V1PostsCatalogQuerySchema = z.object({\n tag: z.string().min(1).max(200).optional(),\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 V1PostCatalogItemSchema = z\n .object({\n title: z.string(),\n description: z.string(),\n link: z.string(),\n image: PhotoSchema.nullable(),\n })\n .openapi('PostCatalogItem')\n\nexport const V1PostCatalogTagSchema = z\n .object({\n slug: z.string(),\n name: z.string(),\n })\n .openapi('PostCatalogTag')\n\nexport const V1PostsCatalogResponseSchema = z\n .object({\n posts: z.array(V1PostCatalogItemSchema),\n postsCount: z.number().int().nonnegative(),\n tags: z.array(V1PostCatalogTagSchema),\n })\n .openapi('PostsCatalogResponse')\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/posts',\n tags: ['Posts'],\n description: 'Latest posts for header.',\n request: { query: V1PostsListQuerySchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1PostsListResponseSchema },\n },\n },\n 400: {\n description: 'Invalid request',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/posts/catalog',\n tags: ['Posts'],\n description: 'Paginated public post catalog with available tags.',\n request: { query: V1PostsCatalogQuerySchema },\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1PostsCatalogResponseSchema },\n },\n },\n 400: {\n description: 'Invalid 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,WAAW,QAAQ,YAAY;AACxC,SAASC,QAAQ,QAAQ,eAAe;AAExC,OAAO,MAAMC,sBAAsB,GAAGL,CAAC,CAACM,MAAM,CAAC;EAC7CC,IAAI,EAAEP,CAAC,CAACQ,MAAM,CAACC,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,MAAMC,sBAAsB,GAAGd,CAAC,CACpCM,MAAM,CAAC;EACNS,KAAK,EAAEf,CAAC,CAACgB,MAAM,CAAC,CAAC;EACjBC,QAAQ,EAAEjB,CAAC,CAACgB,MAAM,CAAC,CAAC,CAACE,QAAQ,CAAC,CAAC;EAC/BC,IAAI,EAAEnB,CAAC,CAACg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AAO,CAAC;EACfT,WAAW,EAAE,oDAAoD;EACjEa,OAAO,EAAE;IAAEC,KAAK,EAAEnB;EAA0B,CAAC;EAC7CoB,SAAS,EAAE;IACT,GAAG,EAAE;MACHf,WAAW,EAAE,SAAS;MACtBgB,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAEX;QAA6B;MAC7D;IACF,CAAC;IACD,GAAG,EAAE;MACHN,WAAW,EAAE,iBAAiB;MAC9BgB,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAE5C;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGD;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter-academy/api-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./constants/course": {
|
|
18
|
+
"types": "./dist/constants/course.d.ts",
|
|
19
|
+
"import": "./dist/constants/course.js",
|
|
20
|
+
"default": "./dist/constants/course.js"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"scripts": {
|