@veruna/api-contracts 1.0.15 → 1.0.17
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/build/shared/common-schemas.d.ts +9 -4
- package/build/shared/common-schemas.js +21 -5
- package/build/shared/index.d.ts +1 -0
- package/build/shared/index.js +1 -0
- package/build/v1/blog/admin/commands/create-category.command.d.ts +1 -1
- package/build/v1/blog/admin/commands/create-post.command.d.ts +1 -1
- package/build/v1/blog/admin/commands/delete-category.command.d.ts +3 -1
- package/build/v1/blog/admin/commands/delete-category.command.js +1 -1
- package/build/v1/blog/admin/commands/delete-post.command.d.ts +3 -1
- package/build/v1/blog/admin/commands/delete-post.command.js +1 -1
- package/build/v1/blog/admin/commands/update-category.command.d.ts +1 -1
- package/build/v1/blog/admin/commands/update-post.command.d.ts +1 -1
- package/build/v1/blog/admin/queries/get-posts.query.d.ts +1 -1
- package/build/v1/blog/public/queries/get-posts.query.d.ts +1 -1
- package/build/v1/blog/public/queries/get-posts.query.js +2 -2
- package/build/v1/blog/schemas/create-category-request.schema.d.ts +1 -1
- package/build/v1/blog/schemas/create-category-request.schema.js +1 -1
- package/build/v1/blog/schemas/create-post-request.schema.d.ts +1 -1
- package/build/v1/blog/schemas/create-post-request.schema.js +1 -1
- package/build/v1/blog/schemas/get-posts-query.schema.d.ts +2 -2
- package/build/v1/blog/schemas/get-posts-query.schema.js +6 -6
- package/build/v1/blog/schemas/update-category-request.schema.d.ts +1 -1
- package/build/v1/blog/schemas/update-category-request.schema.js +1 -1
- package/build/v1/blog/schemas/update-post-request.schema.d.ts +1 -1
- package/build/v1/blog/schemas/update-post-request.schema.js +1 -1
- package/build/v1/seo-pages/admin/commands/create-page.command.d.ts +13 -1
- package/build/v1/seo-pages/admin/commands/delete-page.command.d.ts +1 -1
- package/build/v1/seo-pages/admin/commands/delete-page.command.js +2 -1
- package/build/v1/seo-pages/admin/commands/update-page.command.d.ts +13 -1
- package/build/v1/seo-pages/admin/queries/get-page.query.d.ts +6 -0
- package/build/v1/seo-pages/admin/queries/get-pages.query.d.ts +6 -0
- package/build/v1/seo-pages/public/queries/get-page-by-alias.query.d.ts +6 -0
- package/build/v1/seo-pages/schemas/create-page-request.schema.d.ts +7 -1
- package/build/v1/seo-pages/schemas/create-page-request.schema.js +3 -1
- package/build/v1/seo-pages/schemas/faq.schema.d.ts +19 -0
- package/build/v1/seo-pages/schemas/faq.schema.js +17 -0
- package/build/v1/seo-pages/schemas/index.d.ts +1 -0
- package/build/v1/seo-pages/schemas/index.js +4 -1
- package/build/v1/seo-pages/schemas/page-response.schema.d.ts +6 -0
- package/build/v1/seo-pages/schemas/page-response.schema.js +2 -0
- package/build/v1/seo-pages/schemas/update-page-request.schema.d.ts +7 -1
- package/build/v1/seo-pages/schemas/update-page-request.schema.js +3 -1
- package/build/v1/seo-pages/seo-pages.errors.d.ts +2 -1
- package/build/v1/seo-pages/seo-pages.errors.js +5 -0
- package/package.json +1 -1
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Query parameter array transform
|
|
4
|
+
* Converts single string or array of strings to array
|
|
5
|
+
* Usage: queryArraySchema() for optional, queryArraySchema(false) for required
|
|
6
|
+
*/
|
|
7
|
+
export declare const queryArraySchema: (optional?: boolean) => z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>> | z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
2
8
|
/**
|
|
3
9
|
* Empty Response (for void operations)
|
|
4
10
|
*/
|
|
5
11
|
export declare const EmptyResponseSchema: z.ZodObject<{}, z.core.$strip>;
|
|
6
12
|
/**
|
|
7
|
-
*
|
|
13
|
+
* Delete Response Schema (returns UUID of deleted entity)
|
|
8
14
|
*/
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
11
|
-
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
15
|
+
export declare const DeleteResponseSchema: z.ZodObject<{
|
|
16
|
+
uuid: z.ZodString;
|
|
12
17
|
}, z.core.$strip>;
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DeleteResponseSchema = exports.EmptyResponseSchema = exports.queryArraySchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const regex_1 = require("./regex");
|
|
6
|
+
/**
|
|
7
|
+
* Query parameter array transform
|
|
8
|
+
* Converts single string or array of strings to array
|
|
9
|
+
* Usage: queryArraySchema() for optional, queryArraySchema(false) for required
|
|
10
|
+
*/
|
|
11
|
+
const queryArraySchema = (optional = true) => {
|
|
12
|
+
const schema = zod_1.z
|
|
13
|
+
.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())])
|
|
14
|
+
.transform((val) => {
|
|
15
|
+
if (Array.isArray(val))
|
|
16
|
+
return val;
|
|
17
|
+
return [val];
|
|
18
|
+
});
|
|
19
|
+
return optional ? schema.optional() : schema;
|
|
20
|
+
};
|
|
21
|
+
exports.queryArraySchema = queryArraySchema;
|
|
5
22
|
/**
|
|
6
23
|
* Empty Response (for void operations)
|
|
7
24
|
*/
|
|
8
25
|
exports.EmptyResponseSchema = zod_1.z.object({});
|
|
9
26
|
/**
|
|
10
|
-
*
|
|
27
|
+
* Delete Response Schema (returns UUID of deleted entity)
|
|
11
28
|
*/
|
|
12
|
-
exports.
|
|
13
|
-
|
|
14
|
-
details: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
29
|
+
exports.DeleteResponseSchema = zod_1.z.object({
|
|
30
|
+
uuid: zod_1.z.string().regex(regex_1.UUID_REGEX),
|
|
15
31
|
});
|
package/build/shared/index.d.ts
CHANGED
package/build/shared/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../../shared/http-method';
|
|
3
3
|
export declare namespace AdminBlogCreateCategoryCommand {
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
|
-
alias: z.ZodString
|
|
5
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
6
6
|
title: z.ZodString;
|
|
7
7
|
order: z.ZodDefault<z.ZodNumber>;
|
|
8
8
|
status: z.ZodDefault<z.ZodEnum<typeof import("../../schemas").BlogCategoryStatus>>;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../../shared/http-method';
|
|
3
3
|
export declare namespace AdminBlogCreatePostCommand {
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
|
-
alias: z.ZodString
|
|
5
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
6
6
|
title: z.ZodString;
|
|
7
7
|
metaTitle: z.ZodString;
|
|
8
8
|
metaDescription: z.ZodString;
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../../shared/http-method';
|
|
3
3
|
export declare namespace AdminBlogDeleteCategoryCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
const Response: z.ZodObject<{
|
|
5
|
+
const Response: z.ZodObject<{
|
|
6
|
+
uuid: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
6
8
|
const URL: (uuid: string) => string;
|
|
7
9
|
const METHOD = HttpMethod.DELETE;
|
|
8
10
|
type RequestType = z.infer<typeof Request>;
|
|
@@ -8,7 +8,7 @@ const common_schemas_1 = require("../../../../shared/common-schemas");
|
|
|
8
8
|
var AdminBlogDeleteCategoryCommand;
|
|
9
9
|
(function (AdminBlogDeleteCategoryCommand) {
|
|
10
10
|
AdminBlogDeleteCategoryCommand.Request = zod_1.z.object({});
|
|
11
|
-
AdminBlogDeleteCategoryCommand.Response = common_schemas_1.
|
|
11
|
+
AdminBlogDeleteCategoryCommand.Response = common_schemas_1.DeleteResponseSchema;
|
|
12
12
|
AdminBlogDeleteCategoryCommand.URL = (uuid) => rest_api_1.REST_API.V1.BLOG.ADMIN.CATEGORIES.DELETE(uuid);
|
|
13
13
|
AdminBlogDeleteCategoryCommand.METHOD = http_method_1.HttpMethod.DELETE;
|
|
14
14
|
})(AdminBlogDeleteCategoryCommand || (exports.AdminBlogDeleteCategoryCommand = AdminBlogDeleteCategoryCommand = {}));
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../../shared/http-method';
|
|
3
3
|
export declare namespace AdminBlogDeletePostCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
const Response: z.ZodObject<{
|
|
5
|
+
const Response: z.ZodObject<{
|
|
6
|
+
uuid: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
6
8
|
const URL: (uuid: string) => string;
|
|
7
9
|
const METHOD = HttpMethod.DELETE;
|
|
8
10
|
type RequestType = z.infer<typeof Request>;
|
|
@@ -8,7 +8,7 @@ const common_schemas_1 = require("../../../../shared/common-schemas");
|
|
|
8
8
|
var AdminBlogDeletePostCommand;
|
|
9
9
|
(function (AdminBlogDeletePostCommand) {
|
|
10
10
|
AdminBlogDeletePostCommand.Request = zod_1.z.object({});
|
|
11
|
-
AdminBlogDeletePostCommand.Response = common_schemas_1.
|
|
11
|
+
AdminBlogDeletePostCommand.Response = common_schemas_1.DeleteResponseSchema;
|
|
12
12
|
AdminBlogDeletePostCommand.URL = (uuid) => rest_api_1.REST_API.V1.BLOG.ADMIN.POSTS.DELETE(uuid);
|
|
13
13
|
AdminBlogDeletePostCommand.METHOD = http_method_1.HttpMethod.DELETE;
|
|
14
14
|
})(AdminBlogDeletePostCommand || (exports.AdminBlogDeletePostCommand = AdminBlogDeletePostCommand = {}));
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../../shared/http-method';
|
|
3
3
|
export declare namespace AdminBlogUpdateCategoryCommand {
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
|
-
alias: z.ZodOptional<z.ZodString
|
|
5
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
6
6
|
title: z.ZodOptional<z.ZodString>;
|
|
7
7
|
order: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
status: z.ZodOptional<z.ZodEnum<typeof import("../../schemas").BlogCategoryStatus>>;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../../shared/http-method';
|
|
3
3
|
export declare namespace AdminBlogUpdatePostCommand {
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
|
-
alias: z.ZodOptional<z.ZodString
|
|
5
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
6
6
|
title: z.ZodOptional<z.ZodString>;
|
|
7
7
|
metaTitle: z.ZodOptional<z.ZodString>;
|
|
8
8
|
metaDescription: z.ZodOptional<z.ZodString>;
|
|
@@ -5,7 +5,7 @@ export declare namespace AdminBlogGetPostsQuery {
|
|
|
5
5
|
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
6
6
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
7
7
|
status: z.ZodOptional<z.ZodEnum<typeof import("../../schemas").BlogPostStatus>>;
|
|
8
|
-
categoryAliases: z.ZodOptional<z.ZodArray<z.ZodString
|
|
8
|
+
categoryAliases: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>> | z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
10
|
const Response: z.ZodObject<{
|
|
11
11
|
data: z.ZodArray<z.ZodObject<{
|
|
@@ -4,7 +4,7 @@ export declare namespace BlogGetPostsQuery {
|
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
5
|
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
6
6
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
7
|
-
categoryAliases: z.ZodOptional<z.ZodArray<z.ZodString
|
|
7
|
+
categoryAliases: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>> | z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
const Response: z.ZodObject<{
|
|
10
10
|
data: z.ZodArray<z.ZodObject<{
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BlogGetPostsQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../schemas");
|
|
6
|
-
const
|
|
6
|
+
const shared_1 = require("../../../../shared");
|
|
7
7
|
const rest_api_1 = require("../../../../rest-api");
|
|
8
8
|
const http_method_1 = require("../../../../shared/http-method");
|
|
9
9
|
const PostsListResponseSchema = zod_1.z.object({
|
|
10
10
|
data: zod_1.z.array(schemas_1.PostResponseSchema),
|
|
11
|
-
meta:
|
|
11
|
+
meta: shared_1.PaginationMetaSchema,
|
|
12
12
|
});
|
|
13
13
|
var BlogGetPostsQuery;
|
|
14
14
|
(function (BlogGetPostsQuery) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BlogCategoryStatus } from './blog-category-status.enum';
|
|
3
3
|
export declare const CreateCategoryRequestSchema: z.ZodObject<{
|
|
4
|
-
alias: z.ZodString
|
|
4
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
5
5
|
title: z.ZodString;
|
|
6
6
|
order: z.ZodDefault<z.ZodNumber>;
|
|
7
7
|
status: z.ZodDefault<z.ZodEnum<typeof BlogCategoryStatus>>;
|
|
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const shared_1 = require("../../../shared");
|
|
6
6
|
const blog_category_status_enum_1 = require("./blog-category-status.enum");
|
|
7
7
|
exports.CreateCategoryRequestSchema = zod_1.z.object({
|
|
8
|
-
alias: zod_1.z.string().min(1).max(100).regex(shared_1.SLUG_REGEX),
|
|
8
|
+
alias: zod_1.z.string().min(1).max(100).regex(shared_1.SLUG_REGEX).transform(val => val.toLowerCase().trim()),
|
|
9
9
|
title: zod_1.z.string().min(1).max(200),
|
|
10
10
|
order: zod_1.z.number().int().nonnegative().default(0),
|
|
11
11
|
status: zod_1.z.enum(blog_category_status_enum_1.BlogCategoryStatus).default(blog_category_status_enum_1.BlogCategoryStatus.DRAFT),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BlogPostStatus } from './blog-post-status.enum';
|
|
3
3
|
export declare const CreatePostRequestSchema: z.ZodObject<{
|
|
4
|
-
alias: z.ZodString
|
|
4
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
5
5
|
title: z.ZodString;
|
|
6
6
|
metaTitle: z.ZodString;
|
|
7
7
|
metaDescription: z.ZodString;
|
|
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const shared_1 = require("../../../shared");
|
|
6
6
|
const blog_post_status_enum_1 = require("./blog-post-status.enum");
|
|
7
7
|
exports.CreatePostRequestSchema = zod_1.z.object({
|
|
8
|
-
alias: zod_1.z.string().min(1).max(200).regex(shared_1.SLUG_REGEX),
|
|
8
|
+
alias: zod_1.z.string().min(1).max(200).regex(shared_1.SLUG_REGEX).transform(val => val.toLowerCase().trim()),
|
|
9
9
|
title: zod_1.z.string().min(1).max(300),
|
|
10
10
|
metaTitle: zod_1.z.string().min(1).max(100),
|
|
11
11
|
metaDescription: zod_1.z.string().min(1).max(200),
|
|
@@ -4,10 +4,10 @@ export declare const GetPostsQueryAdminSchema: z.ZodObject<{
|
|
|
4
4
|
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
5
5
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
6
6
|
status: z.ZodOptional<z.ZodEnum<typeof BlogPostStatus>>;
|
|
7
|
-
categoryAliases: z.ZodOptional<z.ZodArray<z.ZodString
|
|
7
|
+
categoryAliases: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>> | z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
export declare const GetPostsQueryPublicSchema: z.ZodObject<{
|
|
10
10
|
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
11
11
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
12
|
-
categoryAliases: z.ZodOptional<z.ZodArray<z.ZodString
|
|
12
|
+
categoryAliases: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>> | z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
13
13
|
}, z.core.$strip>;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetPostsQueryPublicSchema = exports.GetPostsQueryAdminSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const shared_1 = require("../../../shared");
|
|
6
6
|
const blog_post_status_enum_1 = require("./blog-post-status.enum");
|
|
7
|
-
exports.GetPostsQueryAdminSchema =
|
|
8
|
-
status: zod_1.z.
|
|
9
|
-
categoryAliases:
|
|
7
|
+
exports.GetPostsQueryAdminSchema = shared_1.PaginationQuerySchema.extend({
|
|
8
|
+
status: zod_1.z.enum(blog_post_status_enum_1.BlogPostStatus).optional(),
|
|
9
|
+
categoryAliases: (0, shared_1.queryArraySchema)(),
|
|
10
10
|
});
|
|
11
|
-
exports.GetPostsQueryPublicSchema =
|
|
12
|
-
categoryAliases:
|
|
11
|
+
exports.GetPostsQueryPublicSchema = shared_1.PaginationQuerySchema.extend({
|
|
12
|
+
categoryAliases: (0, shared_1.queryArraySchema)(),
|
|
13
13
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BlogCategoryStatus } from './blog-category-status.enum';
|
|
3
3
|
export declare const UpdateCategoryRequestSchema: z.ZodObject<{
|
|
4
|
-
alias: z.ZodOptional<z.ZodString
|
|
4
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
5
5
|
title: z.ZodOptional<z.ZodString>;
|
|
6
6
|
order: z.ZodOptional<z.ZodNumber>;
|
|
7
7
|
status: z.ZodOptional<z.ZodEnum<typeof BlogCategoryStatus>>;
|
|
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const regex_1 = require("../../../shared/regex");
|
|
6
6
|
const blog_category_status_enum_1 = require("./blog-category-status.enum");
|
|
7
7
|
exports.UpdateCategoryRequestSchema = zod_1.z.object({
|
|
8
|
-
alias: zod_1.z.string().min(1).max(100).regex(regex_1.SLUG_REGEX).optional(),
|
|
8
|
+
alias: zod_1.z.string().min(1).max(100).regex(regex_1.SLUG_REGEX).transform(val => val.toLowerCase().trim()).optional(),
|
|
9
9
|
title: zod_1.z.string().min(1).max(200).optional(),
|
|
10
10
|
order: zod_1.z.number().int().nonnegative().optional(),
|
|
11
11
|
status: zod_1.z.nativeEnum(blog_category_status_enum_1.BlogCategoryStatus).optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BlogPostStatus } from './blog-post-status.enum';
|
|
3
3
|
export declare const UpdatePostRequestSchema: z.ZodObject<{
|
|
4
|
-
alias: z.ZodOptional<z.ZodString
|
|
4
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
5
5
|
title: z.ZodOptional<z.ZodString>;
|
|
6
6
|
metaTitle: z.ZodOptional<z.ZodString>;
|
|
7
7
|
metaDescription: z.ZodOptional<z.ZodString>;
|
|
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const regex_1 = require("../../../shared/regex");
|
|
6
6
|
const blog_post_status_enum_1 = require("./blog-post-status.enum");
|
|
7
7
|
exports.UpdatePostRequestSchema = zod_1.z.object({
|
|
8
|
-
alias: zod_1.z.string().min(1).max(200).regex(regex_1.SLUG_REGEX).optional(),
|
|
8
|
+
alias: zod_1.z.string().min(1).max(200).regex(regex_1.SLUG_REGEX).transform(val => val.toLowerCase().trim()).optional(),
|
|
9
9
|
title: zod_1.z.string().min(1).max(300).optional(),
|
|
10
10
|
metaTitle: zod_1.z.string().min(1).max(100).optional(),
|
|
11
11
|
metaDescription: zod_1.z.string().min(1).max(200).optional(),
|
|
@@ -7,8 +7,14 @@ export declare namespace AdminSeoPageCreatePageCommand {
|
|
|
7
7
|
title: z.ZodString;
|
|
8
8
|
description: z.ZodString;
|
|
9
9
|
content: z.ZodString;
|
|
10
|
-
alias: z.ZodString
|
|
10
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
11
11
|
type: z.ZodEnum<typeof import("../../schemas").PageType>;
|
|
12
|
+
faq: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
14
|
+
question: z.ZodString;
|
|
15
|
+
answer: z.ZodString;
|
|
16
|
+
}, z.core.$strip>>>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
12
18
|
}, z.core.$strip>;
|
|
13
19
|
const Response: z.ZodObject<{
|
|
14
20
|
uuid: z.ZodString;
|
|
@@ -19,6 +25,12 @@ export declare namespace AdminSeoPageCreatePageCommand {
|
|
|
19
25
|
content: z.ZodString;
|
|
20
26
|
alias: z.ZodString;
|
|
21
27
|
type: z.ZodEnum<typeof import("../../schemas").PageType>;
|
|
28
|
+
faq: z.ZodObject<{
|
|
29
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
30
|
+
question: z.ZodString;
|
|
31
|
+
answer: z.ZodString;
|
|
32
|
+
}, z.core.$strip>>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
22
34
|
createdAt: z.ZodString;
|
|
23
35
|
updatedAt: z.ZodString;
|
|
24
36
|
}, z.core.$strip>;
|
|
@@ -3,7 +3,7 @@ import { HttpMethod } from '../../../../shared/http-method';
|
|
|
3
3
|
export declare namespace AdminSeoPageDeletePageCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
5
|
const Response: z.ZodObject<{
|
|
6
|
-
|
|
6
|
+
uuid: z.ZodString;
|
|
7
7
|
}, z.core.$strip>;
|
|
8
8
|
const URL: (uuid: string) => string;
|
|
9
9
|
const METHOD = HttpMethod.DELETE;
|
|
@@ -4,10 +4,11 @@ exports.AdminSeoPageDeletePageCommand = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const rest_api_1 = require("../../../../rest-api");
|
|
6
6
|
const http_method_1 = require("../../../../shared/http-method");
|
|
7
|
+
const common_schemas_1 = require("../../../../shared/common-schemas");
|
|
7
8
|
var AdminSeoPageDeletePageCommand;
|
|
8
9
|
(function (AdminSeoPageDeletePageCommand) {
|
|
9
10
|
AdminSeoPageDeletePageCommand.Request = zod_1.z.object({});
|
|
10
|
-
AdminSeoPageDeletePageCommand.Response =
|
|
11
|
+
AdminSeoPageDeletePageCommand.Response = common_schemas_1.DeleteResponseSchema;
|
|
11
12
|
AdminSeoPageDeletePageCommand.URL = (uuid) => rest_api_1.REST_API.V1.SEO_PAGES.ADMIN.DELETE(uuid);
|
|
12
13
|
AdminSeoPageDeletePageCommand.METHOD = http_method_1.HttpMethod.DELETE;
|
|
13
14
|
})(AdminSeoPageDeletePageCommand || (exports.AdminSeoPageDeletePageCommand = AdminSeoPageDeletePageCommand = {}));
|
|
@@ -7,8 +7,14 @@ export declare namespace AdminSeoPageUpdatePageCommand {
|
|
|
7
7
|
title: z.ZodOptional<z.ZodString>;
|
|
8
8
|
description: z.ZodOptional<z.ZodString>;
|
|
9
9
|
content: z.ZodOptional<z.ZodString>;
|
|
10
|
-
alias: z.ZodOptional<z.ZodString
|
|
10
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
11
11
|
type: z.ZodOptional<z.ZodEnum<typeof import("../../schemas").PageType>>;
|
|
12
|
+
faq: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
14
|
+
question: z.ZodString;
|
|
15
|
+
answer: z.ZodString;
|
|
16
|
+
}, z.core.$strip>>>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
12
18
|
}, z.core.$strip>;
|
|
13
19
|
const Response: z.ZodObject<{
|
|
14
20
|
uuid: z.ZodString;
|
|
@@ -19,6 +25,12 @@ export declare namespace AdminSeoPageUpdatePageCommand {
|
|
|
19
25
|
content: z.ZodString;
|
|
20
26
|
alias: z.ZodString;
|
|
21
27
|
type: z.ZodEnum<typeof import("../../schemas").PageType>;
|
|
28
|
+
faq: z.ZodObject<{
|
|
29
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
30
|
+
question: z.ZodString;
|
|
31
|
+
answer: z.ZodString;
|
|
32
|
+
}, z.core.$strip>>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
22
34
|
createdAt: z.ZodString;
|
|
23
35
|
updatedAt: z.ZodString;
|
|
24
36
|
}, z.core.$strip>;
|
|
@@ -11,6 +11,12 @@ export declare namespace AdminSeoPageGetPageQuery {
|
|
|
11
11
|
content: z.ZodString;
|
|
12
12
|
alias: z.ZodString;
|
|
13
13
|
type: z.ZodEnum<typeof import("../../schemas").PageType>;
|
|
14
|
+
faq: z.ZodObject<{
|
|
15
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
16
|
+
question: z.ZodString;
|
|
17
|
+
answer: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
14
20
|
createdAt: z.ZodString;
|
|
15
21
|
updatedAt: z.ZodString;
|
|
16
22
|
}, z.core.$strip>;
|
|
@@ -15,6 +15,12 @@ export declare namespace AdminSeoPageGetPagesQuery {
|
|
|
15
15
|
content: z.ZodString;
|
|
16
16
|
alias: z.ZodString;
|
|
17
17
|
type: z.ZodEnum<typeof import("../../schemas").PageType>;
|
|
18
|
+
faq: z.ZodObject<{
|
|
19
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
20
|
+
question: z.ZodString;
|
|
21
|
+
answer: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
18
24
|
createdAt: z.ZodString;
|
|
19
25
|
updatedAt: z.ZodString;
|
|
20
26
|
}, z.core.$strip>>;
|
|
@@ -11,6 +11,12 @@ export declare namespace SeoPageGetPageByAliasQuery {
|
|
|
11
11
|
content: z.ZodString;
|
|
12
12
|
alias: z.ZodString;
|
|
13
13
|
type: z.ZodEnum<typeof import("../../schemas").PageType>;
|
|
14
|
+
faq: z.ZodObject<{
|
|
15
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
16
|
+
question: z.ZodString;
|
|
17
|
+
answer: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
14
20
|
createdAt: z.ZodString;
|
|
15
21
|
updatedAt: z.ZodString;
|
|
16
22
|
}, z.core.$strip>;
|
|
@@ -9,6 +9,12 @@ export declare const CreatePageRequestSchema: z.ZodObject<{
|
|
|
9
9
|
title: z.ZodString;
|
|
10
10
|
description: z.ZodString;
|
|
11
11
|
content: z.ZodString;
|
|
12
|
-
alias: z.ZodString
|
|
12
|
+
alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
13
13
|
type: z.ZodEnum<typeof PageType>;
|
|
14
|
+
faq: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
16
|
+
question: z.ZodString;
|
|
17
|
+
answer: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
14
20
|
}, z.core.$strip>;
|
|
@@ -4,6 +4,7 @@ exports.CreatePageRequestSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const shared_1 = require("../../../shared");
|
|
6
6
|
const page_type_enum_1 = require("./page-type.enum");
|
|
7
|
+
const faq_schema_1 = require("./faq.schema");
|
|
7
8
|
/**
|
|
8
9
|
* Create SEO Page Request Schema
|
|
9
10
|
*/
|
|
@@ -13,6 +14,7 @@ exports.CreatePageRequestSchema = zod_1.z.object({
|
|
|
13
14
|
title: zod_1.z.string().min(1).max(300),
|
|
14
15
|
description: zod_1.z.string().min(1),
|
|
15
16
|
content: zod_1.z.string().min(1),
|
|
16
|
-
alias: zod_1.z.string().min(1).max(200).regex(shared_1.SLUG_REGEX),
|
|
17
|
+
alias: zod_1.z.string().min(1).max(200).regex(shared_1.SLUG_REGEX).transform(val => val.toLowerCase().trim()),
|
|
17
18
|
type: zod_1.z.nativeEnum(page_type_enum_1.PageType),
|
|
19
|
+
faq: faq_schema_1.FaqSchema.optional(),
|
|
18
20
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* FAQ Item Schema
|
|
4
|
+
*/
|
|
5
|
+
export declare const FaqItemSchema: z.ZodObject<{
|
|
6
|
+
question: z.ZodString;
|
|
7
|
+
answer: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
/**
|
|
10
|
+
* FAQ Schema
|
|
11
|
+
*/
|
|
12
|
+
export declare const FaqSchema: z.ZodObject<{
|
|
13
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
14
|
+
question: z.ZodString;
|
|
15
|
+
answer: z.ZodString;
|
|
16
|
+
}, z.core.$strip>>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type FaqItem = z.infer<typeof FaqItemSchema>;
|
|
19
|
+
export type Faq = z.infer<typeof FaqSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FaqSchema = exports.FaqItemSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* FAQ Item Schema
|
|
7
|
+
*/
|
|
8
|
+
exports.FaqItemSchema = zod_1.z.object({
|
|
9
|
+
question: zod_1.z.string().min(10).max(500),
|
|
10
|
+
answer: zod_1.z.string().min(20).max(2000),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* FAQ Schema
|
|
14
|
+
*/
|
|
15
|
+
exports.FaqSchema = zod_1.z.object({
|
|
16
|
+
items: zod_1.z.array(exports.FaqItemSchema).max(20).default([]),
|
|
17
|
+
});
|
|
@@ -5,3 +5,4 @@ export { PageType } from './page-type.enum';
|
|
|
5
5
|
export { PageResponseSchema } from './page-response.schema';
|
|
6
6
|
export { CreatePageRequestSchema } from './create-page-request.schema';
|
|
7
7
|
export { UpdatePageRequestSchema } from './update-page-request.schema';
|
|
8
|
+
export { FaqSchema, FaqItemSchema, type Faq, type FaqItem } from './faq.schema';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdatePageRequestSchema = exports.CreatePageRequestSchema = exports.PageResponseSchema = exports.PageType = void 0;
|
|
3
|
+
exports.FaqItemSchema = exports.FaqSchema = exports.UpdatePageRequestSchema = exports.CreatePageRequestSchema = exports.PageResponseSchema = exports.PageType = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Centralized exports for SEO Pages schemas
|
|
6
6
|
*/
|
|
@@ -12,3 +12,6 @@ var create_page_request_schema_1 = require("./create-page-request.schema");
|
|
|
12
12
|
Object.defineProperty(exports, "CreatePageRequestSchema", { enumerable: true, get: function () { return create_page_request_schema_1.CreatePageRequestSchema; } });
|
|
13
13
|
var update_page_request_schema_1 = require("./update-page-request.schema");
|
|
14
14
|
Object.defineProperty(exports, "UpdatePageRequestSchema", { enumerable: true, get: function () { return update_page_request_schema_1.UpdatePageRequestSchema; } });
|
|
15
|
+
var faq_schema_1 = require("./faq.schema");
|
|
16
|
+
Object.defineProperty(exports, "FaqSchema", { enumerable: true, get: function () { return faq_schema_1.FaqSchema; } });
|
|
17
|
+
Object.defineProperty(exports, "FaqItemSchema", { enumerable: true, get: function () { return faq_schema_1.FaqItemSchema; } });
|
|
@@ -12,6 +12,12 @@ export declare const PageResponseSchema: z.ZodObject<{
|
|
|
12
12
|
content: z.ZodString;
|
|
13
13
|
alias: z.ZodString;
|
|
14
14
|
type: z.ZodEnum<typeof PageType>;
|
|
15
|
+
faq: z.ZodObject<{
|
|
16
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
17
|
+
question: z.ZodString;
|
|
18
|
+
answer: z.ZodString;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
15
21
|
createdAt: z.ZodString;
|
|
16
22
|
updatedAt: z.ZodString;
|
|
17
23
|
}, z.core.$strip>;
|
|
@@ -4,6 +4,7 @@ exports.PageResponseSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const regex_1 = require("../../../shared/regex");
|
|
6
6
|
const page_type_enum_1 = require("./page-type.enum");
|
|
7
|
+
const faq_schema_1 = require("./faq.schema");
|
|
7
8
|
/**
|
|
8
9
|
* SEO Page Response Schema
|
|
9
10
|
*/
|
|
@@ -16,6 +17,7 @@ exports.PageResponseSchema = zod_1.z.object({
|
|
|
16
17
|
content: zod_1.z.string(),
|
|
17
18
|
alias: zod_1.z.string(),
|
|
18
19
|
type: zod_1.z.nativeEnum(page_type_enum_1.PageType),
|
|
20
|
+
faq: faq_schema_1.FaqSchema,
|
|
19
21
|
createdAt: zod_1.z.string().regex(regex_1.DATETIME_REGEX),
|
|
20
22
|
updatedAt: zod_1.z.string().regex(regex_1.DATETIME_REGEX),
|
|
21
23
|
});
|
|
@@ -9,6 +9,12 @@ export declare const UpdatePageRequestSchema: z.ZodObject<{
|
|
|
9
9
|
title: z.ZodOptional<z.ZodString>;
|
|
10
10
|
description: z.ZodOptional<z.ZodString>;
|
|
11
11
|
content: z.ZodOptional<z.ZodString>;
|
|
12
|
-
alias: z.ZodOptional<z.ZodString
|
|
12
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
13
13
|
type: z.ZodOptional<z.ZodEnum<typeof PageType>>;
|
|
14
|
+
faq: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
16
|
+
question: z.ZodString;
|
|
17
|
+
answer: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
14
20
|
}, z.core.$strip>;
|
|
@@ -4,6 +4,7 @@ exports.UpdatePageRequestSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const shared_1 = require("../../../shared");
|
|
6
6
|
const page_type_enum_1 = require("./page-type.enum");
|
|
7
|
+
const faq_schema_1 = require("./faq.schema");
|
|
7
8
|
/**
|
|
8
9
|
* Update SEO Page Request Schema
|
|
9
10
|
*/
|
|
@@ -13,6 +14,7 @@ exports.UpdatePageRequestSchema = zod_1.z.object({
|
|
|
13
14
|
title: zod_1.z.string().min(1).max(300).optional(),
|
|
14
15
|
description: zod_1.z.string().min(1).optional(),
|
|
15
16
|
content: zod_1.z.string().min(1).optional(),
|
|
16
|
-
alias: zod_1.z.string().min(1).max(200).regex(shared_1.SLUG_REGEX).optional(),
|
|
17
|
+
alias: zod_1.z.string().min(1).max(200).regex(shared_1.SLUG_REGEX).transform(val => val.toLowerCase().trim()).optional(),
|
|
17
18
|
type: zod_1.z.nativeEnum(page_type_enum_1.PageType).optional(),
|
|
19
|
+
faq: faq_schema_1.FaqSchema.optional(),
|
|
18
20
|
});
|
|
@@ -6,6 +6,7 @@ export declare enum SeoPageErrorCode {
|
|
|
6
6
|
PAGE_CREATION_FAILED = "PAGE_CREATION_FAILED",
|
|
7
7
|
PAGE_UPDATE_FAILED = "PAGE_UPDATE_FAILED",
|
|
8
8
|
PAGE_DELETE_FAILED = "PAGE_DELETE_FAILED",
|
|
9
|
-
INVALID_ALIAS_FORMAT = "INVALID_ALIAS_FORMAT"
|
|
9
|
+
INVALID_ALIAS_FORMAT = "INVALID_ALIAS_FORMAT",
|
|
10
|
+
INVALID_FAQ_FORMAT = "INVALID_FAQ_FORMAT"
|
|
10
11
|
}
|
|
11
12
|
export declare const SEO_PAGE_ERRORS: Record<SeoPageErrorCode, ErrorMetadata>;
|
|
@@ -10,6 +10,7 @@ var SeoPageErrorCode;
|
|
|
10
10
|
SeoPageErrorCode["PAGE_UPDATE_FAILED"] = "PAGE_UPDATE_FAILED";
|
|
11
11
|
SeoPageErrorCode["PAGE_DELETE_FAILED"] = "PAGE_DELETE_FAILED";
|
|
12
12
|
SeoPageErrorCode["INVALID_ALIAS_FORMAT"] = "INVALID_ALIAS_FORMAT";
|
|
13
|
+
SeoPageErrorCode["INVALID_FAQ_FORMAT"] = "INVALID_FAQ_FORMAT";
|
|
13
14
|
})(SeoPageErrorCode || (exports.SeoPageErrorCode = SeoPageErrorCode = {}));
|
|
14
15
|
exports.SEO_PAGE_ERRORS = {
|
|
15
16
|
[SeoPageErrorCode.PAGE_NOT_FOUND]: {
|
|
@@ -40,4 +41,8 @@ exports.SEO_PAGE_ERRORS = {
|
|
|
40
41
|
code: SeoPageErrorCode.INVALID_ALIAS_FORMAT,
|
|
41
42
|
statusCode: 400,
|
|
42
43
|
},
|
|
44
|
+
[SeoPageErrorCode.INVALID_FAQ_FORMAT]: {
|
|
45
|
+
code: SeoPageErrorCode.INVALID_FAQ_FORMAT,
|
|
46
|
+
statusCode: 400,
|
|
47
|
+
},
|
|
43
48
|
};
|