@schemavaults/send-email-api-options 0.0.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.
@@ -0,0 +1,2 @@
1
+ import { z } from "zod";
2
+ export declare const emailTemplateIdSchema: z.ZodString;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export const emailTemplateIdSchema = z
3
+ .string()
4
+ .min(1, "Email template ID must be non-empty!")
5
+ .max(64);
6
+ //# sourceMappingURL=email-template-id-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-template-id-schema.js","sourceRoot":"","sources":["../src/email-template-id-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,EAAE,sCAAsC,CAAC;KAC9C,GAAG,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { sendEmailRequestBodySchema, sendEmailRequestBodySchema as default, } from "./send-email-request-body-schema";
2
+ export type { SendEmailRequestBody } from "./send-email-request-body-schema";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { sendEmailRequestBodySchema, sendEmailRequestBodySchema as default, } from "./send-email-request-body-schema";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,IAAI,OAAO,GACtC,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ export declare const sendEmailRequestBodySchema: z.ZodObject<{
3
+ message: z.ZodUnion<[z.ZodObject<{
4
+ template_id: z.ZodString;
5
+ template_props: z.ZodUnknown;
6
+ }, "strict", z.ZodTypeAny, {
7
+ template_id: string;
8
+ template_props?: unknown;
9
+ }, {
10
+ template_id: string;
11
+ template_props?: unknown;
12
+ }>, z.ZodObject<{
13
+ text: z.ZodString;
14
+ html: z.ZodString;
15
+ }, "strict", z.ZodTypeAny, {
16
+ text: string;
17
+ html: string;
18
+ }, {
19
+ text: string;
20
+ html: string;
21
+ }>]>;
22
+ to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
23
+ from: z.ZodOptional<z.ZodString>;
24
+ subject: z.ZodString;
25
+ replyTo: z.ZodOptional<z.ZodString>;
26
+ cc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
27
+ bcc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
28
+ }, "strict", z.ZodTypeAny, {
29
+ message: {
30
+ template_id: string;
31
+ template_props?: unknown;
32
+ } | {
33
+ text: string;
34
+ html: string;
35
+ };
36
+ to: string | string[];
37
+ subject: string;
38
+ from?: string | undefined;
39
+ replyTo?: string | undefined;
40
+ cc?: string | string[] | undefined;
41
+ bcc?: string | string[] | undefined;
42
+ }, {
43
+ message: {
44
+ template_id: string;
45
+ template_props?: unknown;
46
+ } | {
47
+ text: string;
48
+ html: string;
49
+ };
50
+ to: string | string[];
51
+ subject: string;
52
+ from?: string | undefined;
53
+ replyTo?: string | undefined;
54
+ cc?: string | string[] | undefined;
55
+ bcc?: string | string[] | undefined;
56
+ }>;
57
+ export type SendEmailRequestBody = z.infer<typeof sendEmailRequestBodySchema>;
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ import { emailTemplateIdSchema } from "./email-template-id-schema";
3
+ const sendEmailTemplateOptions = z
4
+ .object({
5
+ template_id: emailTemplateIdSchema,
6
+ template_props: z.unknown(),
7
+ })
8
+ .required({
9
+ template_id: true,
10
+ })
11
+ .strict();
12
+ const sendRawEmailOptions = z
13
+ .object({
14
+ text: z.string().nonempty(),
15
+ html: z.string().nonempty(),
16
+ })
17
+ .required({
18
+ text: true,
19
+ html: true,
20
+ })
21
+ .strict();
22
+ const MAX_RECIPIENTS = 50;
23
+ export const sendEmailRequestBodySchema = z
24
+ .object({
25
+ to: z.union([
26
+ z.string().email(),
27
+ z.string().email().array().min(1).max(MAX_RECIPIENTS),
28
+ ]),
29
+ from: z.string().email().optional(),
30
+ subject: z.string().nonempty(),
31
+ message: z.union([sendEmailTemplateOptions, sendRawEmailOptions]),
32
+ replyTo: z.string().email().optional(),
33
+ cc: z
34
+ .union([
35
+ z.string().email(),
36
+ z.string().email().array().min(1).max(MAX_RECIPIENTS),
37
+ ])
38
+ .optional(),
39
+ bcc: z
40
+ .union([
41
+ z.string().email(),
42
+ z.string().email().array().min(1).max(MAX_RECIPIENTS),
43
+ ])
44
+ .optional(),
45
+ })
46
+ .required({
47
+ to: true,
48
+ message: true,
49
+ subject: true,
50
+ })
51
+ .strict();
52
+ //# sourceMappingURL=send-email-request-body-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-email-request-body-schema.js","sourceRoot":"","sources":["../src/send-email-request-body-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,wBAAwB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;CAC5B,CAAC;KACD,QAAQ,CAAC;IACR,WAAW,EAAE,IAAI;CAClB,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,mBAAmB,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC;KACD,QAAQ,CAAC;IACR,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;CACX,CAAC;K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AI;CACd,CAAC;KACD,MAAM,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@schemavaults/send-email-api-options",
3
+ "description": "Schema defining the shape of the request body to send an email via @schemavaults/mail-server",
4
+ "version": "0.0.1",
5
+ "license": "UNLICENSED",
6
+ "private": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/schemavaults/send-email-api-options.git"
10
+ },
11
+ "type": "module",
12
+ "main": "dist/index.js",
13
+ "module": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
+ "dependencies": {
16
+ "zod": "3.25.8"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc --project tsconfig.json && tsc-alias --project tsconfig.json",
20
+ "test": "NODE_ENV=test bun test",
21
+ "cleanup:compiled-tests-output": "find ./dist -type f \\( -name \"*.test.js\" -o -name \"*.test.js.map\" -o -name \"*.test.d.ts\" \\) -delete",
22
+ "cleanup": "bun run cleanup:compiled-tests-output",
23
+ "postbuild": "bun run cleanup",
24
+ "lint": "eslint src --ext .ts,.tsx",
25
+ "typecheck": "tsc --project tsconfig.json --noEmit"
26
+ },
27
+ "devDependencies": {
28
+ "typescript": "5.9.3",
29
+ "tsc-alias": "1.8.16",
30
+ "bun-types": "1.3.6",
31
+ "eslint": "9.39.1",
32
+ "@eslint/js": "9.39.1",
33
+ "globals": "16.5.0",
34
+ "@typescript-eslint/eslint-plugin": "8.48.1",
35
+ "@typescript-eslint/parser": "8.48.1"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "packageManager": "bun@1.3.6",
41
+ "exports": {
42
+ ".": {
43
+ "types": "./dist/index.d.ts",
44
+ "import": "./dist/index.js",
45
+ "require": "./dist/index.js"
46
+ },
47
+ "./*": {
48
+ "types": "./dist/*",
49
+ "import": "./dist/*",
50
+ "require": "./dist/*"
51
+ },
52
+ "./dist/*": {
53
+ "types": "./dist/*",
54
+ "import": "./dist/*",
55
+ "require": "./dist/*"
56
+ }
57
+ }
58
+ }