@silkwebdev/gaffer-types 1.0.5
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/README +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/project-type/project-type.schema.d.ts +10 -0
- package/dist/project-type/project-type.schema.js +9 -0
- package/dist/quote/quote-status.schema.d.ts +21 -0
- package/dist/quote/quote-status.schema.js +15 -0
- package/dist/quote/quote.schema.d.ts +23 -0
- package/dist/quote/quote.schema.js +16 -0
- package/dist/testimonial/create-testimonial.schema.d.ts +98 -0
- package/dist/testimonial/create-testimonial.schema.js +25 -0
- package/dist/testimonial/get-testimonials.schema.d.ts +22 -0
- package/dist/testimonial/get-testimonials.schema.js +6 -0
- package/dist/testimonial/testimonial.schema.d.ts +19 -0
- package/dist/testimonial/testimonial.schema.js +13 -0
- package/dist/version/version.schema.d.ts +3 -0
- package/dist/version/version.schema.js +2 -0
- package/package.json +31 -0
package/README
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Shared types and Zod schemas
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./project-type/project-type.schema.js";
|
|
2
|
+
export * from "./quote/quote-status.schema.js";
|
|
3
|
+
export * from "./quote/quote.schema.js";
|
|
4
|
+
export * from "./testimonial/create-testimonial.schema.js";
|
|
5
|
+
export * from "./testimonial/get-testimonials.schema.js";
|
|
6
|
+
export * from "./testimonial/testimonial.schema.js";
|
|
7
|
+
export * from "./version/version.schema.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./project-type/project-type.schema.js";
|
|
2
|
+
export * from "./quote/quote-status.schema.js";
|
|
3
|
+
export * from "./quote/quote.schema.js";
|
|
4
|
+
export * from "./testimonial/create-testimonial.schema.js";
|
|
5
|
+
export * from "./testimonial/get-testimonials.schema.js";
|
|
6
|
+
export * from "./testimonial/testimonial.schema.js";
|
|
7
|
+
export * from "./version/version.schema.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ProjectTypeEnum: z.ZodEnum<{
|
|
3
|
+
EXTENSION: "EXTENSION";
|
|
4
|
+
RENOVATION: "RENOVATION";
|
|
5
|
+
CONVERSION: "CONVERSION";
|
|
6
|
+
NEW_BUILD: "NEW_BUILD";
|
|
7
|
+
LANDSCAPING: "LANDSCAPING";
|
|
8
|
+
}>;
|
|
9
|
+
export type ProjectType = z.infer<typeof ProjectTypeEnum>;
|
|
10
|
+
export declare const ProjectTypeOptions: ("EXTENSION" | "RENOVATION" | "CONVERSION" | "NEW_BUILD" | "LANDSCAPING")[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const QuoteStatusEnum: z.ZodEnum<{
|
|
3
|
+
PROPOSED: "PROPOSED";
|
|
4
|
+
ACCEPTED: "ACCEPTED";
|
|
5
|
+
REJECTED: "REJECTED";
|
|
6
|
+
ONGOING: "ONGOING";
|
|
7
|
+
COMPLETED: "COMPLETED";
|
|
8
|
+
SNAGGING: "SNAGGING";
|
|
9
|
+
ARCHIVED: "ARCHIVED";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const QuoteStatusSchema: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
12
|
+
PROPOSED: "PROPOSED";
|
|
13
|
+
ACCEPTED: "ACCEPTED";
|
|
14
|
+
REJECTED: "REJECTED";
|
|
15
|
+
ONGOING: "ONGOING";
|
|
16
|
+
COMPLETED: "COMPLETED";
|
|
17
|
+
SNAGGING: "SNAGGING";
|
|
18
|
+
ARCHIVED: "ARCHIVED";
|
|
19
|
+
}>>;
|
|
20
|
+
export type QuoteStatus = z.infer<typeof QuoteStatusSchema>;
|
|
21
|
+
export declare const QuoteStatusOptions: ("PROPOSED" | "ACCEPTED" | "REJECTED" | "ONGOING" | "COMPLETED" | "SNAGGING" | "ARCHIVED")[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const QuoteStatusEnum = z.enum([
|
|
3
|
+
"PROPOSED",
|
|
4
|
+
"ACCEPTED",
|
|
5
|
+
"REJECTED",
|
|
6
|
+
"ONGOING",
|
|
7
|
+
"COMPLETED",
|
|
8
|
+
"SNAGGING",
|
|
9
|
+
"ARCHIVED",
|
|
10
|
+
]);
|
|
11
|
+
export const QuoteStatusSchema = z
|
|
12
|
+
.string()
|
|
13
|
+
.transform((v) => v.toUpperCase())
|
|
14
|
+
.pipe(QuoteStatusEnum);
|
|
15
|
+
export const QuoteStatusOptions = QuoteStatusEnum.options;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const QuoteSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodUUID;
|
|
4
|
+
version: z.ZodString;
|
|
5
|
+
isLatest: z.ZodBoolean;
|
|
6
|
+
subtotal: z.ZodString;
|
|
7
|
+
vat: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<5>, z.ZodLiteral<20>]>;
|
|
8
|
+
total: z.ZodString;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
PROPOSED: "PROPOSED";
|
|
11
|
+
ACCEPTED: "ACCEPTED";
|
|
12
|
+
REJECTED: "REJECTED";
|
|
13
|
+
ONGOING: "ONGOING";
|
|
14
|
+
COMPLETED: "COMPLETED";
|
|
15
|
+
SNAGGING: "SNAGGING";
|
|
16
|
+
ARCHIVED: "ARCHIVED";
|
|
17
|
+
}>;
|
|
18
|
+
notes: z.ZodString;
|
|
19
|
+
createdAt: z.ZodISODateTime;
|
|
20
|
+
estimatedStart: z.ZodOptional<z.ZodISODateTime>;
|
|
21
|
+
projectedEnd: z.ZodOptional<z.ZodISODateTime>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type Quote = z.infer<typeof QuoteSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { VersionSchema } from "../version/version.schema.js";
|
|
3
|
+
import { QuoteStatusEnum } from "./quote-status.schema.js";
|
|
4
|
+
export const QuoteSchema = z.object({
|
|
5
|
+
id: z.uuid(),
|
|
6
|
+
version: VersionSchema,
|
|
7
|
+
isLatest: z.boolean(),
|
|
8
|
+
subtotal: z.string(),
|
|
9
|
+
vat: z.union([z.literal(0), z.literal(5), z.literal(20)]),
|
|
10
|
+
total: z.string(),
|
|
11
|
+
status: QuoteStatusEnum,
|
|
12
|
+
notes: z.string(),
|
|
13
|
+
createdAt: z.iso.datetime(),
|
|
14
|
+
estimatedStart: z.iso.datetime().optional(),
|
|
15
|
+
projectedEnd: z.iso.datetime().optional(),
|
|
16
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const BaseCreateTestimonialSchema: z.ZodObject<{
|
|
3
|
+
displayName: z.ZodString;
|
|
4
|
+
location: z.ZodOptional<z.ZodString>;
|
|
5
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
6
|
+
EXTENSION: "EXTENSION";
|
|
7
|
+
RENOVATION: "RENOVATION";
|
|
8
|
+
CONVERSION: "CONVERSION";
|
|
9
|
+
NEW_BUILD: "NEW_BUILD";
|
|
10
|
+
LANDSCAPING: "LANDSCAPING";
|
|
11
|
+
}>>;
|
|
12
|
+
body: z.ZodArray<z.ZodString>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const CreateTestimonialInputSchema: z.ZodObject<{
|
|
15
|
+
displayName: z.ZodString;
|
|
16
|
+
location: z.ZodOptional<z.ZodString>;
|
|
17
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
18
|
+
EXTENSION: "EXTENSION";
|
|
19
|
+
RENOVATION: "RENOVATION";
|
|
20
|
+
CONVERSION: "CONVERSION";
|
|
21
|
+
NEW_BUILD: "NEW_BUILD";
|
|
22
|
+
LANDSCAPING: "LANDSCAPING";
|
|
23
|
+
}>>;
|
|
24
|
+
body: z.ZodArray<z.ZodString>;
|
|
25
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export declare const CreateTestimonialAdminSchema: z.ZodPipe<z.ZodObject<{
|
|
28
|
+
displayName: z.ZodString;
|
|
29
|
+
location: z.ZodOptional<z.ZodString>;
|
|
30
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
31
|
+
EXTENSION: "EXTENSION";
|
|
32
|
+
RENOVATION: "RENOVATION";
|
|
33
|
+
CONVERSION: "CONVERSION";
|
|
34
|
+
NEW_BUILD: "NEW_BUILD";
|
|
35
|
+
LANDSCAPING: "LANDSCAPING";
|
|
36
|
+
}>>;
|
|
37
|
+
body: z.ZodArray<z.ZodString>;
|
|
38
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
40
|
+
excerpt: string;
|
|
41
|
+
displayName: string;
|
|
42
|
+
projectTypes: ("EXTENSION" | "RENOVATION" | "CONVERSION" | "NEW_BUILD" | "LANDSCAPING")[];
|
|
43
|
+
body: string[];
|
|
44
|
+
location?: string | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
displayName: string;
|
|
47
|
+
projectTypes: ("EXTENSION" | "RENOVATION" | "CONVERSION" | "NEW_BUILD" | "LANDSCAPING")[];
|
|
48
|
+
body: string[];
|
|
49
|
+
location?: string | undefined;
|
|
50
|
+
excerpt?: string | undefined;
|
|
51
|
+
}>>;
|
|
52
|
+
export declare const CreateTestimonialUserSchema: z.ZodPipe<z.ZodObject<{
|
|
53
|
+
displayName: z.ZodString;
|
|
54
|
+
location: z.ZodOptional<z.ZodString>;
|
|
55
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
56
|
+
EXTENSION: "EXTENSION";
|
|
57
|
+
RENOVATION: "RENOVATION";
|
|
58
|
+
CONVERSION: "CONVERSION";
|
|
59
|
+
NEW_BUILD: "NEW_BUILD";
|
|
60
|
+
LANDSCAPING: "LANDSCAPING";
|
|
61
|
+
}>>;
|
|
62
|
+
body: z.ZodArray<z.ZodString>;
|
|
63
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
64
|
+
excerpt: string;
|
|
65
|
+
displayName: string;
|
|
66
|
+
projectTypes: ("EXTENSION" | "RENOVATION" | "CONVERSION" | "NEW_BUILD" | "LANDSCAPING")[];
|
|
67
|
+
body: string[];
|
|
68
|
+
location?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
displayName: string;
|
|
71
|
+
projectTypes: ("EXTENSION" | "RENOVATION" | "CONVERSION" | "NEW_BUILD" | "LANDSCAPING")[];
|
|
72
|
+
body: string[];
|
|
73
|
+
location?: string | undefined;
|
|
74
|
+
}>>;
|
|
75
|
+
export declare const CreateTestimonialResponseSchema: z.ZodObject<{
|
|
76
|
+
testimonial: z.ZodObject<{
|
|
77
|
+
id: z.ZodNumber;
|
|
78
|
+
displayName: z.ZodString;
|
|
79
|
+
location: z.ZodNullable<z.ZodString>;
|
|
80
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
81
|
+
EXTENSION: "EXTENSION";
|
|
82
|
+
RENOVATION: "RENOVATION";
|
|
83
|
+
CONVERSION: "CONVERSION";
|
|
84
|
+
NEW_BUILD: "NEW_BUILD";
|
|
85
|
+
LANDSCAPING: "LANDSCAPING";
|
|
86
|
+
}>>;
|
|
87
|
+
excerpt: z.ZodString;
|
|
88
|
+
body: z.ZodArray<z.ZodString>;
|
|
89
|
+
approved: z.ZodNullable<z.ZodBoolean>;
|
|
90
|
+
hidden: z.ZodNullable<z.ZodBoolean>;
|
|
91
|
+
imagePublicId: z.ZodNullable<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type BaseCreateTestimonial = z.infer<typeof BaseCreateTestimonialSchema>;
|
|
95
|
+
export type CreateTestimonialInput = z.infer<typeof CreateTestimonialInputSchema>;
|
|
96
|
+
export type CreateTestimonialAdmin = z.infer<typeof CreateTestimonialAdminSchema>;
|
|
97
|
+
export type CreateTestimonialUser = z.infer<typeof CreateTestimonialUserSchema>;
|
|
98
|
+
export type CreateTestimonialResponse = z.infer<typeof CreateTestimonialResponseSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ProjectTypeEnum } from "../project-type/project-type.schema.js";
|
|
3
|
+
import { TestimonialSchema } from "./testimonial.schema.js";
|
|
4
|
+
export const BaseCreateTestimonialSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
displayName: z.string(),
|
|
7
|
+
location: z.string().optional(),
|
|
8
|
+
projectTypes: z.array(ProjectTypeEnum),
|
|
9
|
+
body: z.array(z.string().min(1)),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
export const CreateTestimonialInputSchema = BaseCreateTestimonialSchema.extend({
|
|
13
|
+
excerpt: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
export const CreateTestimonialAdminSchema = CreateTestimonialInputSchema.transform((data) => ({
|
|
16
|
+
...data,
|
|
17
|
+
excerpt: data.excerpt ?? data.body.join(" ").slice(0, 150),
|
|
18
|
+
}));
|
|
19
|
+
export const CreateTestimonialUserSchema = BaseCreateTestimonialSchema.transform((data) => ({
|
|
20
|
+
...data,
|
|
21
|
+
excerpt: data.body.join(" ").slice(0, 150),
|
|
22
|
+
}));
|
|
23
|
+
export const CreateTestimonialResponseSchema = z.object({
|
|
24
|
+
testimonial: TestimonialSchema,
|
|
25
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GetTestimonialsResponseSchema: z.ZodObject<{
|
|
3
|
+
count: z.ZodNumber;
|
|
4
|
+
testimonials: z.ZodArray<z.ZodObject<{
|
|
5
|
+
id: z.ZodNumber;
|
|
6
|
+
displayName: z.ZodString;
|
|
7
|
+
location: z.ZodNullable<z.ZodString>;
|
|
8
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
9
|
+
EXTENSION: "EXTENSION";
|
|
10
|
+
RENOVATION: "RENOVATION";
|
|
11
|
+
CONVERSION: "CONVERSION";
|
|
12
|
+
NEW_BUILD: "NEW_BUILD";
|
|
13
|
+
LANDSCAPING: "LANDSCAPING";
|
|
14
|
+
}>>;
|
|
15
|
+
excerpt: z.ZodString;
|
|
16
|
+
body: z.ZodArray<z.ZodString>;
|
|
17
|
+
approved: z.ZodNullable<z.ZodBoolean>;
|
|
18
|
+
hidden: z.ZodNullable<z.ZodBoolean>;
|
|
19
|
+
imagePublicId: z.ZodNullable<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type GetTestimonialsResponse = z.infer<typeof GetTestimonialsResponseSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TestimonialSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
displayName: z.ZodString;
|
|
5
|
+
location: z.ZodNullable<z.ZodString>;
|
|
6
|
+
projectTypes: z.ZodArray<z.ZodEnum<{
|
|
7
|
+
EXTENSION: "EXTENSION";
|
|
8
|
+
RENOVATION: "RENOVATION";
|
|
9
|
+
CONVERSION: "CONVERSION";
|
|
10
|
+
NEW_BUILD: "NEW_BUILD";
|
|
11
|
+
LANDSCAPING: "LANDSCAPING";
|
|
12
|
+
}>>;
|
|
13
|
+
excerpt: z.ZodString;
|
|
14
|
+
body: z.ZodArray<z.ZodString>;
|
|
15
|
+
approved: z.ZodNullable<z.ZodBoolean>;
|
|
16
|
+
hidden: z.ZodNullable<z.ZodBoolean>;
|
|
17
|
+
imagePublicId: z.ZodNullable<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type Testimonial = z.infer<typeof TestimonialSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ProjectTypeEnum } from "../project-type/project-type.schema.js";
|
|
3
|
+
export const TestimonialSchema = z.object({
|
|
4
|
+
id: z.number(),
|
|
5
|
+
displayName: z.string(),
|
|
6
|
+
location: z.string().nullable(),
|
|
7
|
+
projectTypes: z.array(ProjectTypeEnum),
|
|
8
|
+
excerpt: z.string(),
|
|
9
|
+
body: z.array(z.string()),
|
|
10
|
+
approved: z.boolean().nullable(),
|
|
11
|
+
hidden: z.boolean().nullable(),
|
|
12
|
+
imagePublicId: z.string().nullable(),
|
|
13
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@silkwebdev/gaffer-types",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Shared types and Zod schemas",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/SilkWebDev/gaffer-types.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"author": "James J. Kerr",
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/SilkWebDev/gaffer-types/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/SilkWebDev/gaffer-types#readme",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "^4.3.6"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^6.0.2"
|
|
30
|
+
}
|
|
31
|
+
}
|