@twreporter-academy/api-types 0.0.1 → 0.0.2

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './api-variables.js';
2
2
  export * from './openapi.js';
3
3
  export * from './rest.js';
4
+ export * from './schemas/member.js';
4
5
  export * from './schemas/tag.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -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,kBAAkB,CAAA"}
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,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './api-variables.js';
2
2
  export * from './openapi.js';
3
3
  export * from './rest.js';
4
+ export * from './schemas/member.js';
4
5
  export * from './schemas/tag.js';
5
6
  //# sourceMappingURL=index.js.map
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/tag.js'\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,kBAAkB","ignoreList":[]}
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/member.js'\nexport * from './schemas/tag.js'\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,qBAAqB;AACnC,cAAc,kBAAkB","ignoreList":[]}
package/dist/openapi.d.ts CHANGED
@@ -1,8 +1,15 @@
1
+ import './schemas/member.js';
1
2
  export declare function getOpenApiDocument(): {
2
- tags: {
3
+ tags: ({
4
+ readonly name: "Auth";
5
+ readonly description: "Token exchange and session management.";
6
+ } | {
7
+ readonly name: "Members";
8
+ readonly description: "Authenticated member profile.";
9
+ } | {
3
10
  readonly name: "Tags";
4
11
  readonly description: "Tag metadata and course feeds by slug.";
5
- }[];
12
+ })[];
6
13
  openapi: string;
7
14
  info: import("openapi3-ts/oas30").InfoObject;
8
15
  servers?: import("openapi3-ts/oas30").ServerObject[];
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB;;;;;;;;;;;;EAcjC"}
1
+ {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,CAAA;AAY5B,wBAAgB,kBAAkB;;;;;;;;;;;;;;;;;;EAcjC"}
package/dist/openapi.js CHANGED
@@ -1,6 +1,14 @@
1
+ // Side-effect imports: ensure OpenAPI paths are registered before generation.
2
+ import './schemas/member.js';
1
3
  import { OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi';
2
4
  import { registry } from './schemas/tag.js';
3
5
  const openApiRootTags = [{
6
+ name: 'Auth',
7
+ description: 'Token exchange and session management.'
8
+ }, {
9
+ name: 'Members',
10
+ description: 'Authenticated member profile.'
11
+ }, {
4
12
  name: 'Tags',
5
13
  description: 'Tag metadata and course feeds by slug.'
6
14
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.js","names":["OpenApiGeneratorV3","registry","openApiRootTags","name","description","getOpenApiDocument","generator","definitions","generateDocument","openapi","info","title","version","tags"],"sources":["../src/openapi.ts"],"sourcesContent":["import { OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi'\n\nimport { registry } from './schemas/tag.js'\n\nconst openApiRootTags = [\n { name: 'Tags', description: 'Tag metadata and course feeds by slug.' },\n] as const\n\nexport function getOpenApiDocument() {\n const generator = new OpenApiGeneratorV3(registry.definitions)\n return {\n ...generator.generateDocument({\n openapi: '3.0.3',\n info: {\n title: 'TWReporter Academy API',\n version: '0.0.1',\n description:\n 'Academy content API. Serves tag metadata and course feeds.',\n },\n }),\n tags: [...openApiRootTags],\n }\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,MAAMC,eAAe,GAAG,CACtB;EAAEC,IAAI,EAAE,MAAM;EAAEC,WAAW,EAAE;AAAyC,CAAC,CAC/D;AAEV,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAG,IAAIN,kBAAkB,CAACC,QAAQ,CAACM,WAAW,CAAC;EAC9D,OAAO;IACL,GAAGD,SAAS,CAACE,gBAAgB,CAAC;MAC5BC,OAAO,EAAE,OAAO;MAChBC,IAAI,EAAE;QACJC,KAAK,EAAE,wBAAwB;QAC/BC,OAAO,EAAE,OAAO;QAChBR,WAAW,EACT;MACJ;IACF,CAAC,CAAC;IACFS,IAAI,EAAE,CAAC,GAAGX,eAAe;EAC3B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"openapi.js","names":["OpenApiGeneratorV3","registry","openApiRootTags","name","description","getOpenApiDocument","generator","definitions","generateDocument","openapi","info","title","version","tags"],"sources":["../src/openapi.ts"],"sourcesContent":["// Side-effect imports: ensure OpenAPI paths are registered before generation.\nimport './schemas/member.js'\n\nimport { OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi'\n\nimport { registry } from './schemas/tag.js'\n\nconst openApiRootTags = [\n { name: 'Auth', description: 'Token exchange and session management.' },\n { name: 'Members', description: 'Authenticated member profile.' },\n { name: 'Tags', description: 'Tag metadata and course feeds by slug.' },\n] as const\n\nexport function getOpenApiDocument() {\n const generator = new OpenApiGeneratorV3(registry.definitions)\n return {\n ...generator.generateDocument({\n openapi: '3.0.3',\n info: {\n title: 'TWReporter Academy API',\n version: '0.0.1',\n description:\n 'Academy content API. Serves tag metadata and course feeds.',\n },\n }),\n tags: [...openApiRootTags],\n }\n}\n"],"mappings":"AAAA;AACA,OAAO,qBAAqB;AAE5B,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,MAAMC,eAAe,GAAG,CACtB;EAAEC,IAAI,EAAE,MAAM;EAAEC,WAAW,EAAE;AAAyC,CAAC,EACvE;EAAED,IAAI,EAAE,SAAS;EAAEC,WAAW,EAAE;AAAgC,CAAC,EACjE;EAAED,IAAI,EAAE,MAAM;EAAEC,WAAW,EAAE;AAAyC,CAAC,CAC/D;AAEV,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAG,IAAIN,kBAAkB,CAACC,QAAQ,CAACM,WAAW,CAAC;EAC9D,OAAO;IACL,GAAGD,SAAS,CAACE,gBAAgB,CAAC;MAC5BC,OAAO,EAAE,OAAO;MAChBC,IAAI,EAAE;QACJC,KAAK,EAAE,wBAAwB;QAC/BC,OAAO,EAAE,OAAO;QAChBR,WAAW,EACT;MACJ;IACF,CAAC,CAAC;IACFS,IAAI,EAAE,CAAC,GAAGX,eAAe;EAC3B,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export declare const V1MemberProfileSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ email: z.ZodString;
5
+ name: z.ZodString;
6
+ twreporterUserId: z.ZodString;
7
+ hasAccess: z.ZodBoolean;
8
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
9
+ }, z.core.$strip>;
10
+ export declare const V1MemberProfileResponseSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ email: z.ZodString;
13
+ name: z.ZodString;
14
+ twreporterUserId: z.ZodString;
15
+ hasAccess: z.ZodBoolean;
16
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
17
+ }, z.core.$strip>;
18
+ export declare const V1AccessTokenResponseSchema: z.ZodObject<{
19
+ accessToken: z.ZodString;
20
+ twreporterUserId: z.ZodString;
21
+ expiresAt: z.ZodNumber;
22
+ }, z.core.$strip>;
23
+ //# sourceMappingURL=member.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../src/schemas/member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,qBAAqB;;;;;;;iBASP,CAAA;AAE3B,eAAO,MAAM,6BAA6B;;;;;;;iBAAwB,CAAA;AAElE,eAAO,MAAM,2BAA2B;;;;iBAMP,CAAA"}
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ import { RestErrorBodySchema } from '../rest.js';
3
+ import { registry } from './tag.js';
4
+ export const V1MemberProfileSchema = z.object({
5
+ id: z.string(),
6
+ email: z.string(),
7
+ name: z.string(),
8
+ twreporterUserId: z.string(),
9
+ hasAccess: z.boolean(),
10
+ createdAt: z.iso.datetime().nullable().optional()
11
+ }).openapi('MemberProfile');
12
+ export const V1MemberProfileResponseSchema = V1MemberProfileSchema;
13
+ export const V1AccessTokenResponseSchema = z.object({
14
+ accessToken: z.string(),
15
+ twreporterUserId: z.string(),
16
+ expiresAt: z.number()
17
+ }).openapi('AccessTokenResponse');
18
+
19
+ // --- OpenAPI path registration ---
20
+
21
+ const unauthorizedResponse = {
22
+ 401: {
23
+ description: 'Unauthorized — missing or invalid JWT',
24
+ content: {
25
+ 'application/json': {
26
+ schema: RestErrorBodySchema
27
+ }
28
+ }
29
+ }
30
+ };
31
+ const internalServerErrorResponse = {
32
+ 500: {
33
+ description: 'Internal server error',
34
+ content: {
35
+ 'application/json': {
36
+ schema: RestErrorBodySchema
37
+ }
38
+ }
39
+ }
40
+ };
41
+ registry.registerPath({
42
+ method: 'post',
43
+ path: '/auth/access-token',
44
+ tags: ['Auth'],
45
+ description: 'Exchange id_token cookie for a JWT access token. Creates the member on first login.',
46
+ responses: {
47
+ 200: {
48
+ description: 'Success',
49
+ content: {
50
+ 'application/json': {
51
+ schema: V1AccessTokenResponseSchema
52
+ }
53
+ }
54
+ },
55
+ 400: {
56
+ description: 'Bad request — missing id_token cookie',
57
+ content: {
58
+ 'application/json': {
59
+ schema: RestErrorBodySchema
60
+ }
61
+ }
62
+ },
63
+ 403: {
64
+ description: 'Forbidden — missing, invalid, or disallowed Origin',
65
+ content: {
66
+ 'application/json': {
67
+ schema: RestErrorBodySchema
68
+ }
69
+ }
70
+ },
71
+ ...unauthorizedResponse,
72
+ ...internalServerErrorResponse
73
+ }
74
+ });
75
+ registry.registerPath({
76
+ method: 'get',
77
+ path: '/v1/members/me',
78
+ tags: ['Members'],
79
+ description: 'Get the authenticated member profile.',
80
+ responses: {
81
+ 200: {
82
+ description: 'Success',
83
+ content: {
84
+ 'application/json': {
85
+ schema: V1MemberProfileResponseSchema
86
+ }
87
+ }
88
+ },
89
+ 404: {
90
+ description: 'Member not found',
91
+ content: {
92
+ 'application/json': {
93
+ schema: RestErrorBodySchema
94
+ }
95
+ }
96
+ },
97
+ ...unauthorizedResponse,
98
+ ...internalServerErrorResponse
99
+ }
100
+ });
101
+ //# sourceMappingURL=member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member.js","names":["z","RestErrorBodySchema","registry","V1MemberProfileSchema","object","id","string","email","name","twreporterUserId","hasAccess","boolean","createdAt","iso","datetime","nullable","optional","openapi","V1MemberProfileResponseSchema","V1AccessTokenResponseSchema","accessToken","expiresAt","number","unauthorizedResponse","description","content","schema","internalServerErrorResponse","registerPath","method","path","tags","responses"],"sources":["../../src/schemas/member.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { RestErrorBodySchema } from '../rest.js'\nimport { registry } from './tag.js'\n\nexport const V1MemberProfileSchema = z\n .object({\n id: z.string(),\n email: z.string(),\n name: z.string(),\n twreporterUserId: z.string(),\n hasAccess: z.boolean(),\n createdAt: z.iso.datetime().nullable().optional(),\n })\n .openapi('MemberProfile')\n\nexport const V1MemberProfileResponseSchema = V1MemberProfileSchema\n\nexport const V1AccessTokenResponseSchema = z\n .object({\n accessToken: z.string(),\n twreporterUserId: z.string(),\n expiresAt: z.number(),\n })\n .openapi('AccessTokenResponse')\n\n// --- OpenAPI path registration ---\n\nconst unauthorizedResponse = {\n 401: {\n description: 'Unauthorized — missing or invalid JWT',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n} as const\n\nconst internalServerErrorResponse = {\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n} as const\n\nregistry.registerPath({\n method: 'post',\n path: '/auth/access-token',\n tags: ['Auth'],\n description:\n 'Exchange id_token cookie for a JWT access token. Creates the member on first login.',\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1AccessTokenResponseSchema },\n },\n },\n 400: {\n description: 'Bad request — missing id_token cookie',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n 403: {\n description: 'Forbidden — missing, invalid, or disallowed Origin',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...unauthorizedResponse,\n ...internalServerErrorResponse,\n },\n})\n\nregistry.registerPath({\n method: 'get',\n path: '/v1/members/me',\n tags: ['Members'],\n description: 'Get the authenticated member profile.',\n responses: {\n 200: {\n description: 'Success',\n content: {\n 'application/json': { schema: V1MemberProfileResponseSchema },\n },\n },\n 404: {\n description: 'Member not found',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n ...unauthorizedResponse,\n ...internalServerErrorResponse,\n },\n})\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,SAASC,mBAAmB,QAAQ,YAAY;AAChD,SA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1BC,IAAI,EAAE,CAAC,MAAM,CAAC;EACdP,WAAW,EACT,qFAAqF;EACvFQ,SAAS,EAAE;IACT,GAAG,EAAE;MACHR,WAAW,EAAE,SAAS;MACtBC,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAEP;QAA4B;MAC5D;IACF,CAAC;IACD,GAAG,EAAE;MACHK,WAAW,EAAE,uCAAuC;MACpDC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEzB;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACHuB,WAAW,EAAE,oDAAoD;MACjEC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEzB;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGsB,oBAAoB;IACvB,GAAGI;EACL;AACF,CAAC,CAAC;AAEFzB,QAAQ,CAAC0B,YAAY,CAAC;EACpBC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,gBAAgB;EACtBC,IAAI,EAAE,CAAC,SAAS,CAAC;EACjBP,WAAW,EAAE,uCAAuC;EACpDQ,SAAS,EAAE;IACT,GAAG,EAAE;MACHR,WAAW,EAAE,SAAS;MACtBC,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAER;QAA8B;MAC9D;IACF,CAAC;IACD,GAAG,EAAE;MACHM,WAAW,EAAE,kBAAkB;MAC/BC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEzB;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGsB,oBAAoB;IACvB,GAAGI;EACL;AACF,CAAC,CAAC","ignoreList":[]}
@@ -5,21 +5,21 @@ export declare const V1TagSlugPathParamsSchema: z.ZodObject<{
5
5
  slug: z.ZodString;
6
6
  }, z.core.$strip>;
7
7
  export declare const PhotoResizedSchema: z.ZodObject<{
8
- small: z.ZodDefault<z.ZodString>;
8
+ small: z.ZodString;
9
9
  }, z.core.$strip>;
10
10
  export declare const CourseThumbnailSchema: z.ZodObject<{
11
11
  resized: z.ZodObject<{
12
- small: z.ZodDefault<z.ZodString>;
12
+ small: z.ZodString;
13
13
  }, z.core.$strip>;
14
14
  }, z.core.$strip>;
15
15
  export declare const V1TagBySlugMetaResponseSchema: z.ZodObject<{
16
- ogTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
- ogDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
- ogImage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
16
+ ogTitle: z.ZodString;
17
+ ogDescription: z.ZodString;
18
+ ogImage: z.ZodNullable<z.ZodObject<{
19
19
  resized: z.ZodObject<{
20
- small: z.ZodDefault<z.ZodString>;
20
+ small: z.ZodString;
21
21
  }, z.core.$strip>;
22
- }, z.core.$strip>>>;
22
+ }, z.core.$strip>>;
23
23
  }, z.core.$strip>;
24
24
  export declare const V1TagBySlugCoursesQuerySchema: z.ZodObject<{
25
25
  take: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
@@ -30,11 +30,11 @@ export declare const CourseCardSchema: z.ZodObject<{
30
30
  title: z.ZodString;
31
31
  subtitle: z.ZodString;
32
32
  summary: z.ZodString;
33
- thumbnail: z.ZodOptional<z.ZodNullable<z.ZodObject<{
33
+ thumbnail: z.ZodNullable<z.ZodObject<{
34
34
  resized: z.ZodObject<{
35
- small: z.ZodDefault<z.ZodString>;
35
+ small: z.ZodString;
36
36
  }, z.core.$strip>;
37
- }, z.core.$strip>>>;
37
+ }, z.core.$strip>>;
38
38
  }, z.core.$strip>;
39
39
  export declare const V1TagBySlugCoursesResponseSchema: z.ZodObject<{
40
40
  name: z.ZodString;
@@ -44,11 +44,11 @@ export declare const V1TagBySlugCoursesResponseSchema: z.ZodObject<{
44
44
  title: z.ZodString;
45
45
  subtitle: z.ZodString;
46
46
  summary: z.ZodString;
47
- thumbnail: z.ZodOptional<z.ZodNullable<z.ZodObject<{
47
+ thumbnail: z.ZodNullable<z.ZodObject<{
48
48
  resized: z.ZodObject<{
49
- small: z.ZodDefault<z.ZodString>;
49
+ small: z.ZodString;
50
50
  }, z.core.$strip>;
51
- }, z.core.$strip>>>;
51
+ }, z.core.$strip>>;
52
52
  }, z.core.$strip>>;
53
53
  }, z.core.$strip>;
54
54
  //# sourceMappingURL=tag.d.ts.map
@@ -10,7 +10,7 @@ export const V1TagSlugPathParamsSchema = z.object({
10
10
  slug: z.string().min(1).max(200)
11
11
  });
12
12
  export const PhotoResizedSchema = z.object({
13
- small: z.string().default('')
13
+ small: z.string().min(1)
14
14
  }).openapi('ResizedPhoto');
15
15
  export const CourseThumbnailSchema = z.object({
16
16
  resized: PhotoResizedSchema
@@ -19,9 +19,9 @@ export const CourseThumbnailSchema = z.object({
19
19
  // --- Tag meta response ---
20
20
 
21
21
  export const V1TagBySlugMetaResponseSchema = z.object({
22
- ogTitle: z.string().nullable().optional(),
23
- ogDescription: z.string().nullable().optional(),
24
- ogImage: CourseThumbnailSchema.nullable().optional()
22
+ ogTitle: z.string(),
23
+ ogDescription: z.string(),
24
+ ogImage: CourseThumbnailSchema.nullable()
25
25
  });
26
26
 
27
27
  // --- Tag courses query & response ---
@@ -35,7 +35,7 @@ export const CourseCardSchema = z.object({
35
35
  title: z.string(),
36
36
  subtitle: z.string(),
37
37
  summary: z.string(),
38
- thumbnail: CourseThumbnailSchema.nullable().optional()
38
+ thumbnail: CourseThumbnailSchema.nullable()
39
39
  }).openapi('CourseCard');
40
40
  export const V1TagBySlugCoursesResponseSchema = z.object({
41
41
  name: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"tag.js","names":["extendZodWithOpenApi","OpenAPIRegistry","z","RestErrorBodySchema","registry","V1TagSlugPathParamsSchema","object","slug","string","min","max","PhotoResizedSchema","small","default","openapi","CourseThumbnailSchema","resized","V1TagBySlugMetaResponseSchema","ogTitle","nullable","optional","ogDescription","ogImage","V1TagBySlugCoursesQuerySchema","take","coerce","number","int","skip","CourseCardSchema","title","subtitle","summary","thumbnail","V1TagBySlugCoursesResponseSchema","name","coursesCount","courses","array","internalServerErrorResponse","description","content","schema","registerPath","method","path","tags","request","params","responses","query"],"sources":["../../src/schemas/tag.ts"],"sourcesContent":["import {\n extendZodWithOpenApi,\n OpenAPIRegistry,\n} from '@asteasolutions/zod-to-openapi'\nimport { z } from 'zod'\n\nimport { RestErrorBodySchema } from '../rest.js'\n\nextendZodWithOpenApi(z)\n\nexport const registry = new OpenAPIRegistry()\n\n// --- Shared path params ---\n\nexport const V1TagSlugPathParamsSchema = z.object({\n slug: z.string().min(1).max(200),\n})\n\nexport const PhotoResizedSchema = z\n .object({\n small: z.string().default(''),\n })\n .openapi('ResizedPhoto')\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().nullable().optional(),\n ogDescription: z.string().nullable().optional(),\n ogImage: CourseThumbnailSchema.nullable().optional(),\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().optional(),\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\nconst internalServerErrorResponse = {\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n} as const\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,SACEA,oBAAoB,EACpBC,eAAe,QACV,gCAAgC;AACvC,SAASC,CAAC,QAAQ,KAAK;AAEvB,SAASC,mBAAmB,QAAQ,YAAY;AAEhDH,oBAAoB,CAACE,CAAC,CAAC;AAEvB,OAAO,MAAME,QAAQ,GAAG,IAAIH,eAAe,CAAC,CAAC;;AAE7C;;AAEA,OAAO,MAAMI,yBAAyB,GAAGH,CAAC,CAACI,MAAM,CAAC;EAChDC,IAAI,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG;AACjC,CAAC,CAAC;AAEF,OAAO,MAAMC,kBAAkB,GAAGT,CAAC,CAChCI,MAAM,CAAC;EACNM,KAAK,EAAEV,CAAC,CAACM,MAAM,CAAC,CAAC,CAACK,OAAO,CAAC,EAAE;AAC9B,CAAC,CAAC,CACDC,OAAO,CAAC,cAAc,CAAC;AAE1B,OAAO,MAAMC,qBAAqB,GAAGb,CAAC,CACnCI,MAAM,CAAC;EACNU,OAAO,EAAEL;AACX,CAAC,CAAC,CACDG,OAAO,CAAC,iBAAiB,CAAC;;AAE7B;;AAEA,OAAO,MAAM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AAE;IACT,GAAG,EAAE;MACHT,WAAW,EAAE,SAAS;MACtBC,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAER;QAAiC;MACjE;IACF,CAAC;IACD,GAAG,EAAE;MACHM,WAAW,EAAE,eAAe;MAC5BC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEvC;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACHqC,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEvC;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGoC;EACL;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"tag.js","names":["extendZodWithOpenApi","OpenAPIRegistry","z","RestErrorBodySchema","registry","V1TagSlugPathParamsSchema","object","slug","string","min","max","PhotoResizedSchema","small","openapi","CourseThumbnailSchema","resized","V1TagBySlugMetaResponseSchema","ogTitle","ogDescription","ogImage","nullable","V1TagBySlugCoursesQuerySchema","take","coerce","number","int","optional","default","skip","CourseCardSchema","title","subtitle","summary","thumbnail","V1TagBySlugCoursesResponseSchema","name","coursesCount","courses","array","internalServerErrorResponse","description","content","schema","registerPath","method","path","tags","request","params","responses","query"],"sources":["../../src/schemas/tag.ts"],"sourcesContent":["import {\n extendZodWithOpenApi,\n OpenAPIRegistry,\n} from '@asteasolutions/zod-to-openapi'\nimport { z } from 'zod'\n\nimport { RestErrorBodySchema } from '../rest.js'\n\nextendZodWithOpenApi(z)\n\nexport const registry = new OpenAPIRegistry()\n\n// --- Shared path params ---\n\nexport const V1TagSlugPathParamsSchema = z.object({\n slug: z.string().min(1).max(200),\n})\n\nexport const PhotoResizedSchema = z\n .object({\n small: z.string().min(1),\n })\n .openapi('ResizedPhoto')\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\nconst internalServerErrorResponse = {\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: RestErrorBodySchema } },\n },\n} as const\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,SACEA,oBAAoB,EACpBC,eAAe,QACV,gCAAgC;AACvC,SA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G,EAAE;MACHT,WAAW,EAAE,SAAS;MACtBC,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAE1B;QAA8B;MAC9D;IACF,CAAC;IACD,GAAG,EAAE;MACHwB,WAAW,EAAE,eAAe;MAC5BC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEvC;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGoC;EACL;AACF,CAAC,CAAC;AAEFnC,QAAQ,CAACuC,YAAY,CAAC;EACpBC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,yBAAyB;EAC/BC,IAAI,EAAE,CAAC,MAAM,CAAC;EACdN,WAAW,EAAE,iCAAiC;EAC9CO,OAAO,EAAE;IACPC,MAAM,EAAE3C,yBAAyB;IACjC6C,KAAK,EAAE7B;EACT,CAAC;EACD4B,SAAS,EAAE;IACT,GAAG,EAAE;MACHT,WAAW,EAAE,SAAS;MACtBC,OAAO,EAAE;QACP,kBAAkB,EAAE;UAAEC,MAAM,EAAER;QAAiC;MACjE;IACF,CAAC;IACD,GAAG,EAAE;MACHM,WAAW,EAAE,eAAe;MAC5BC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEvC;QAAoB;MAAE;IACjE,CAAC;IACD,GAAG,EAAE;MACHqC,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE;QAAE,kBAAkB,EAAE;UAAEC,MAAM,EAAEvC;QAAoB;MAAE;IACjE,CAAC;IACD,GAAGoC;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.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [