@zyacreatives/shared 1.4.9 → 1.5.1
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/schemas/discipline.d.ts +7 -7
- package/dist/schemas/discipline.js +27 -41
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/username.d.ts +4 -1
- package/dist/schemas/username.js +10 -0
- package/dist/types/discipline.d.ts +4 -6
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/username.d.ts +3 -0
- package/dist/types/username.js +2 -0
- package/package.json +1 -1
- package/src/schemas/discipline.ts +27 -45
- package/src/schemas/index.ts +1 -0
- package/src/schemas/project.ts +1 -0
- package/src/schemas/username.ts +10 -0
- package/src/types/discipline.ts +8 -17
- package/src/types/index.ts +1 -0
- package/src/types/username.ts +4 -0
|
@@ -4,7 +4,7 @@ export declare const DisciplineEntitySchema: z.ZodObject<{
|
|
|
4
4
|
name: z.ZodString;
|
|
5
5
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const DisciplineUpdateOutputSchema: z.ZodObject<{
|
|
8
8
|
slug: z.ZodString;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
10
|
export declare const CreateDisciplinesInputSchema: z.ZodObject<{
|
|
@@ -13,17 +13,14 @@ export declare const CreateDisciplinesInputSchema: z.ZodObject<{
|
|
|
13
13
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
14
14
|
}, z.core.$strip>>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
16
|
+
export declare const CreateDisciplinesOutputSchema: z.ZodObject<{
|
|
17
|
+
disciplines: z.ZodArray<z.ZodString>;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const GetDisciplinesInputSchema: z.ZodObject<{
|
|
20
20
|
withTags: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"true">, z.ZodLiteral<"false">]>>>;
|
|
21
21
|
getDefault: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"true">, z.ZodLiteral<"false">]>>>;
|
|
22
22
|
slugs: z.ZodOptional<z.ZodString>;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
|
-
export declare const CreateDisciplinesOutputSchema: z.ZodObject<{
|
|
25
|
-
disciplines: z.ZodArray<z.ZodString>;
|
|
26
|
-
}, z.core.$strip>;
|
|
27
24
|
export declare const GetDisciplinesOutputSchema: z.ZodObject<{
|
|
28
25
|
disciplines: z.ZodArray<z.ZodObject<{
|
|
29
26
|
slug: z.ZodString;
|
|
@@ -31,3 +28,6 @@ export declare const GetDisciplinesOutputSchema: z.ZodObject<{
|
|
|
31
28
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
29
|
}, z.core.$strip>>;
|
|
33
30
|
}, z.core.$strip>;
|
|
31
|
+
export declare const SlugInputSchema: z.ZodObject<{
|
|
32
|
+
slug: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SlugInputSchema = exports.GetDisciplinesOutputSchema = exports.GetDisciplinesInputSchema = exports.CreateDisciplinesOutputSchema = exports.CreateDisciplinesInputSchema = exports.DisciplineUpdateOutputSchema = exports.DisciplineEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
exports.DisciplineEntitySchema = zod_openapi_1.z
|
|
6
6
|
.object({
|
|
@@ -9,55 +9,39 @@ exports.DisciplineEntitySchema = zod_openapi_1.z
|
|
|
9
9
|
tags: zod_openapi_1.z
|
|
10
10
|
.array(zod_openapi_1.z.string().openapi({ example: "illustration" }))
|
|
11
11
|
.optional()
|
|
12
|
-
.openapi({
|
|
13
|
-
example: ["illustration", "concept-art"],
|
|
14
|
-
}),
|
|
12
|
+
.openapi({ example: ["illustration", "concept-art"] }),
|
|
15
13
|
})
|
|
16
14
|
.openapi({ title: "DisciplineEntity" });
|
|
17
|
-
exports.
|
|
15
|
+
exports.DisciplineUpdateOutputSchema = zod_openapi_1.z
|
|
18
16
|
.object({
|
|
19
17
|
slug: zod_openapi_1.z.string().openapi({ example: "digital-art" }),
|
|
20
18
|
})
|
|
21
|
-
.openapi({ title: "
|
|
19
|
+
.openapi({ title: "DisciplineUpdateOutput" });
|
|
22
20
|
exports.CreateDisciplinesInputSchema = zod_openapi_1.z
|
|
23
21
|
.object({
|
|
24
22
|
disciplines: zod_openapi_1.z
|
|
25
23
|
.array(zod_openapi_1.z.object({
|
|
26
|
-
name: zod_openapi_1.z.string().max(128).openapi({
|
|
27
|
-
example: "Mathematics",
|
|
28
|
-
}),
|
|
24
|
+
name: zod_openapi_1.z.string().max(128).openapi({ example: "Mathematics" }),
|
|
29
25
|
tags: zod_openapi_1.z
|
|
30
|
-
.array(zod_openapi_1.z.string().openapi({
|
|
31
|
-
example: "algebra",
|
|
32
|
-
}))
|
|
26
|
+
.array(zod_openapi_1.z.string().openapi({ example: "algebra" }))
|
|
33
27
|
.default([])
|
|
34
|
-
.openapi({
|
|
35
|
-
example: ["algebra", "geometry"],
|
|
36
|
-
}),
|
|
28
|
+
.openapi({ example: ["algebra", "geometry"] }),
|
|
37
29
|
}))
|
|
38
30
|
.openapi({
|
|
39
31
|
description: "Array of disciplines to upsert.",
|
|
40
32
|
example: [
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
tags: ["algebra", "geometry"],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "Physics",
|
|
47
|
-
tags: ["mechanics", "optics"],
|
|
48
|
-
},
|
|
33
|
+
{ name: "Mathematics", tags: ["algebra", "geometry"] },
|
|
34
|
+
{ name: "Physics", tags: ["mechanics", "optics"] },
|
|
49
35
|
],
|
|
50
36
|
}),
|
|
51
37
|
})
|
|
52
|
-
.openapi({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
exports.GetDisciplinesQuerySchema = zod_openapi_1.z
|
|
38
|
+
.openapi({ title: "CreateDisciplinesInput" });
|
|
39
|
+
exports.CreateDisciplinesOutputSchema = zod_openapi_1.z
|
|
40
|
+
.object({
|
|
41
|
+
disciplines: zod_openapi_1.z.array(zod_openapi_1.z.string()),
|
|
42
|
+
})
|
|
43
|
+
.openapi({ title: "CreateDisciplinesOutput" });
|
|
44
|
+
exports.GetDisciplinesInputSchema = zod_openapi_1.z
|
|
61
45
|
.object({
|
|
62
46
|
withTags: zod_openapi_1.z
|
|
63
47
|
.union([zod_openapi_1.z.literal("true"), zod_openapi_1.z.literal("false")])
|
|
@@ -72,19 +56,21 @@ exports.GetDisciplinesQuerySchema = zod_openapi_1.z
|
|
|
72
56
|
.optional()
|
|
73
57
|
.default("false")
|
|
74
58
|
.openapi({
|
|
75
|
-
description: "Fetch the default list of disciplines (non user-added disciplines)",
|
|
59
|
+
description: "Fetch the default list of disciplines (non user-added disciplines).",
|
|
76
60
|
}),
|
|
77
61
|
slugs: zod_openapi_1.z.string().optional().openapi({
|
|
78
62
|
description: "Comma-separated list of discipline slugs to filter by.",
|
|
79
63
|
example: "mathematics,physics",
|
|
80
64
|
}),
|
|
81
65
|
})
|
|
82
|
-
.openapi({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
exports.CreateDisciplinesOutputSchema = zod_openapi_1.z.object({
|
|
86
|
-
disciplines: zod_openapi_1.z.array(zod_openapi_1.z.string()),
|
|
87
|
-
});
|
|
88
|
-
exports.GetDisciplinesOutputSchema = zod_openapi_1.z.object({
|
|
66
|
+
.openapi({ title: "GetDisciplinesInput" });
|
|
67
|
+
exports.GetDisciplinesOutputSchema = zod_openapi_1.z
|
|
68
|
+
.object({
|
|
89
69
|
disciplines: zod_openapi_1.z.array(exports.DisciplineEntitySchema),
|
|
90
|
-
})
|
|
70
|
+
})
|
|
71
|
+
.openapi({ title: "GetDisciplinesOutput" });
|
|
72
|
+
exports.SlugInputSchema = zod_openapi_1.z
|
|
73
|
+
.object({
|
|
74
|
+
slug: zod_openapi_1.z.string().max(128).openapi({ example: "mathematics" }),
|
|
75
|
+
})
|
|
76
|
+
.openapi({ title: "SlugInput" });
|
package/dist/schemas/index.d.ts
CHANGED
package/dist/schemas/index.js
CHANGED
package/dist/schemas/username.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsernameSchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
exports.UsernameSchema = zod_openapi_1.z.object({
|
|
6
|
+
username: zod_openapi_1.z
|
|
7
|
+
.string()
|
|
8
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
9
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
10
|
+
message: "Username may only contain letters, numbers, and underscores",
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { CreateDisciplinesInputSchema, CreateDisciplinesOutputSchema, DisciplineEntitySchema,
|
|
2
|
+
import { CreateDisciplinesInputSchema, CreateDisciplinesOutputSchema, DisciplineEntitySchema, DisciplineUpdateOutputSchema, GetDisciplinesInputSchema, GetDisciplinesOutputSchema, SlugInputSchema } from "../schemas/discipline";
|
|
3
3
|
export type DisciplineEntity = z.infer<typeof DisciplineEntitySchema>;
|
|
4
|
-
export type
|
|
4
|
+
export type DisciplineUpdateOutput = z.infer<typeof DisciplineUpdateOutputSchema>;
|
|
5
5
|
export type CreateDisciplinesInput = z.infer<typeof CreateDisciplinesInputSchema>;
|
|
6
|
-
export type SlugInput = z.infer<typeof SlugSchema>;
|
|
7
|
-
export type GetMultipleDisciplinesQuery = z.infer<typeof GetDisciplinesQuerySchema>;
|
|
8
|
-
export type DeleteDisciplineInput = SlugInput;
|
|
9
|
-
export type DeleteDisciplineOutput = SlugInput;
|
|
10
6
|
export type CreateDisciplinesOutput = z.infer<typeof CreateDisciplinesOutputSchema>;
|
|
7
|
+
export type GetDisciplinesInput = z.infer<typeof GetDisciplinesInputSchema>;
|
|
11
8
|
export type GetDisciplinesOutput = z.infer<typeof GetDisciplinesOutputSchema>;
|
|
9
|
+
export type SlugInput = z.infer<typeof SlugInputSchema>;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -7,63 +7,45 @@ export const DisciplineEntitySchema = z
|
|
|
7
7
|
tags: z
|
|
8
8
|
.array(z.string().openapi({ example: "illustration" }))
|
|
9
9
|
.optional()
|
|
10
|
-
.openapi({
|
|
11
|
-
example: ["illustration", "concept-art"],
|
|
12
|
-
}),
|
|
10
|
+
.openapi({ example: ["illustration", "concept-art"] }),
|
|
13
11
|
})
|
|
14
12
|
.openapi({ title: "DisciplineEntity" });
|
|
15
13
|
|
|
16
|
-
export const
|
|
14
|
+
export const DisciplineUpdateOutputSchema = z
|
|
17
15
|
.object({
|
|
18
16
|
slug: z.string().openapi({ example: "digital-art" }),
|
|
19
17
|
})
|
|
20
|
-
.openapi({ title: "
|
|
18
|
+
.openapi({ title: "DisciplineUpdateOutput" });
|
|
21
19
|
|
|
22
20
|
export const CreateDisciplinesInputSchema = z
|
|
23
21
|
.object({
|
|
24
22
|
disciplines: z
|
|
25
23
|
.array(
|
|
26
24
|
z.object({
|
|
27
|
-
name: z.string().max(128).openapi({
|
|
28
|
-
example: "Mathematics",
|
|
29
|
-
}),
|
|
25
|
+
name: z.string().max(128).openapi({ example: "Mathematics" }),
|
|
30
26
|
tags: z
|
|
31
|
-
.array(
|
|
32
|
-
z.string().openapi({
|
|
33
|
-
example: "algebra",
|
|
34
|
-
})
|
|
35
|
-
)
|
|
27
|
+
.array(z.string().openapi({ example: "algebra" }))
|
|
36
28
|
.default([])
|
|
37
|
-
.openapi({
|
|
38
|
-
example: ["algebra", "geometry"],
|
|
39
|
-
}),
|
|
29
|
+
.openapi({ example: ["algebra", "geometry"] }),
|
|
40
30
|
})
|
|
41
31
|
)
|
|
42
32
|
.openapi({
|
|
43
33
|
description: "Array of disciplines to upsert.",
|
|
44
34
|
example: [
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
tags: ["algebra", "geometry"],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: "Physics",
|
|
51
|
-
tags: ["mechanics", "optics"],
|
|
52
|
-
},
|
|
35
|
+
{ name: "Mathematics", tags: ["algebra", "geometry"] },
|
|
36
|
+
{ name: "Physics", tags: ["mechanics", "optics"] },
|
|
53
37
|
],
|
|
54
38
|
}),
|
|
55
39
|
})
|
|
56
|
-
.openapi({
|
|
57
|
-
description: "Schema for upserting multiple disciplines.",
|
|
58
|
-
});
|
|
40
|
+
.openapi({ title: "CreateDisciplinesInput" });
|
|
59
41
|
|
|
60
|
-
export const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
});
|
|
42
|
+
export const CreateDisciplinesOutputSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
disciplines: z.array(z.string()),
|
|
45
|
+
})
|
|
46
|
+
.openapi({ title: "CreateDisciplinesOutput" });
|
|
65
47
|
|
|
66
|
-
export const
|
|
48
|
+
export const GetDisciplinesInputSchema = z
|
|
67
49
|
.object({
|
|
68
50
|
withTags: z
|
|
69
51
|
.union([z.literal("true"), z.literal("false")])
|
|
@@ -79,23 +61,23 @@ export const GetDisciplinesQuerySchema = z
|
|
|
79
61
|
.default("false")
|
|
80
62
|
.openapi({
|
|
81
63
|
description:
|
|
82
|
-
"Fetch the default list of disciplines (non user-added disciplines)",
|
|
64
|
+
"Fetch the default list of disciplines (non user-added disciplines).",
|
|
83
65
|
}),
|
|
84
66
|
slugs: z.string().optional().openapi({
|
|
85
67
|
description: "Comma-separated list of discipline slugs to filter by.",
|
|
86
68
|
example: "mathematics,physics",
|
|
87
69
|
}),
|
|
88
70
|
})
|
|
89
|
-
.openapi({
|
|
90
|
-
description: "Query parameters for fetching multiple disciplines.",
|
|
91
|
-
});
|
|
92
|
-
|
|
71
|
+
.openapi({ title: "GetDisciplinesInput" });
|
|
93
72
|
|
|
94
|
-
export const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
disciplines: z.array(DisciplineEntitySchema),
|
|
100
|
-
});
|
|
73
|
+
export const GetDisciplinesOutputSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
disciplines: z.array(DisciplineEntitySchema),
|
|
76
|
+
})
|
|
77
|
+
.openapi({ title: "GetDisciplinesOutput" });
|
|
101
78
|
|
|
79
|
+
export const SlugInputSchema = z
|
|
80
|
+
.object({
|
|
81
|
+
slug: z.string().max(128).openapi({ example: "mathematics" }),
|
|
82
|
+
})
|
|
83
|
+
.openapi({ title: "SlugInput" });
|
package/src/schemas/index.ts
CHANGED
package/src/schemas/project.ts
CHANGED
package/src/schemas/username.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const UsernameSchema = z.object({
|
|
4
|
+
username: z
|
|
5
|
+
.string()
|
|
6
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
7
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
8
|
+
message: "Username may only contain letters, numbers, and underscores",
|
|
9
|
+
}),
|
|
10
|
+
});
|
package/src/types/discipline.ts
CHANGED
|
@@ -3,34 +3,25 @@ import {
|
|
|
3
3
|
CreateDisciplinesInputSchema,
|
|
4
4
|
CreateDisciplinesOutputSchema,
|
|
5
5
|
DisciplineEntitySchema,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
DisciplineUpdateOutputSchema,
|
|
7
|
+
GetDisciplinesInputSchema,
|
|
8
8
|
GetDisciplinesOutputSchema,
|
|
9
|
-
|
|
9
|
+
SlugInputSchema,
|
|
10
10
|
} from "../schemas/discipline";
|
|
11
11
|
|
|
12
12
|
export type DisciplineEntity = z.infer<typeof DisciplineEntitySchema>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
typeof DisciplineUpdateOutputEntitySchema
|
|
13
|
+
export type DisciplineUpdateOutput = z.infer<
|
|
14
|
+
typeof DisciplineUpdateOutputSchema
|
|
16
15
|
>;
|
|
17
16
|
|
|
18
17
|
export type CreateDisciplinesInput = z.infer<
|
|
19
18
|
typeof CreateDisciplinesInputSchema
|
|
20
19
|
>;
|
|
21
|
-
|
|
22
|
-
export type SlugInput = z.infer<typeof SlugSchema>;
|
|
23
|
-
|
|
24
|
-
export type GetMultipleDisciplinesQuery = z.infer<
|
|
25
|
-
typeof GetDisciplinesQuerySchema
|
|
26
|
-
>;
|
|
27
|
-
|
|
28
|
-
export type DeleteDisciplineInput = SlugInput;
|
|
29
|
-
|
|
30
|
-
export type DeleteDisciplineOutput = SlugInput;
|
|
31
|
-
|
|
32
20
|
export type CreateDisciplinesOutput = z.infer<
|
|
33
21
|
typeof CreateDisciplinesOutputSchema
|
|
34
22
|
>;
|
|
35
23
|
|
|
24
|
+
export type GetDisciplinesInput = z.infer<typeof GetDisciplinesInputSchema>;
|
|
36
25
|
export type GetDisciplinesOutput = z.infer<typeof GetDisciplinesOutputSchema>;
|
|
26
|
+
|
|
27
|
+
export type SlugInput = z.infer<typeof SlugInputSchema>;
|
package/src/types/index.ts
CHANGED