@schemavaults/send-email-api-options 0.0.5 → 0.0.6

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/bun.lock CHANGED
@@ -5,6 +5,7 @@
5
5
  "": {
6
6
  "name": "@schemavaults/send-email-api-options",
7
7
  "dependencies": {
8
+ "@schemavaults/app-definitions": "0.6.23",
8
9
  "zod": "3.25.8",
9
10
  },
10
11
  "devDependencies": {
@@ -52,6 +53,8 @@
52
53
 
53
54
  "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="],
54
55
 
56
+ "@schemavaults/app-definitions": ["@schemavaults/app-definitions@0.6.23", "", { "dependencies": { "zod": "3.25.8" } }, "sha512-gdI1PVujXrcHObcjiqO0/aeiKCKSzsGzWu8fWwOwCp9BQeDu2iovAJRp3Gme9iWBnWz1Yv+Mg4A5Y/G3HXp1jA=="],
57
+
55
58
  "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
56
59
 
57
60
  "@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schemavaults/send-email-api-options",
3
3
  "description": "Schema defining the shape of the request body to send an email via @schemavaults/mail-server",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "repository": {
@@ -13,7 +13,8 @@
13
13
  "module": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "dependencies": {
16
- "zod": "3.25.8"
16
+ "zod": "3.25.8",
17
+ "@schemavaults/app-definitions": "0.6.23"
17
18
  },
18
19
  "scripts": {
19
20
  "build": "tsc --project tsconfig.json && tsc-alias --project tsconfig.json",
@@ -1,2 +0,0 @@
1
- import { z } from "zod";
2
- export declare const emailTemplateIdSchema: z.ZodString;
@@ -1,7 +0,0 @@
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
- .regex(/^[a-z][a-z0-9_-]+$/, "Template ID must start with a letter, and may only contain lowercase alphanumeric characters, hyphens and underscores.");
7
- //# sourceMappingURL=email-template-id-schema.js.map
@@ -1 +0,0 @@
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;KACP,KAAK,CACJ,oBAAoB,EACpB,wHAAwH,CACzH,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { sendEmailRequestBodySchema, sendEmailRequestBodySchema as default, createSendEmailRequestBodySchema, } from "./send-email-request-body-schema";
2
- export type { SendEmailRequestBody } from "./send-email-request-body-schema";
3
- export { emailTemplateIdSchema } from "./email-template-id-schema";
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { sendEmailRequestBodySchema, sendEmailRequestBodySchema as default, createSendEmailRequestBodySchema, } from "./send-email-request-body-schema";
2
- export { emailTemplateIdSchema } from "./email-template-id-schema";
3
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,IAAI,OAAO,EACrC,gCAAgC,GACjC,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,126 +0,0 @@
1
- import { z } from "zod";
2
- export declare function createRecipientSchema(allow_mailing_list_ids_as_recipients?: boolean): z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodString]> | z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
3
- /**
4
- *
5
- * @param allow_mailing_list_ids_as_recipients
6
- * @returns Schema for validating send-email request body
7
- */
8
- export declare function createSendEmailRequestBodySchema(allow_mailing_list_ids_as_recipients?: boolean): z.ZodObject<{
9
- message: z.ZodUnion<[z.ZodObject<{
10
- template_id: z.ZodString;
11
- template_props: z.ZodUnknown;
12
- }, "strict", z.ZodTypeAny, {
13
- template_id: string;
14
- template_props?: unknown;
15
- }, {
16
- template_id: string;
17
- template_props?: unknown;
18
- }>, z.ZodObject<{
19
- text: z.ZodString;
20
- html: z.ZodString;
21
- }, "strict", z.ZodTypeAny, {
22
- text: string;
23
- html: string;
24
- }, {
25
- text: string;
26
- html: string;
27
- }>]>;
28
- to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodString]> | z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
29
- from: z.ZodOptional<z.ZodString>;
30
- subject: z.ZodString;
31
- replyTo: z.ZodOptional<z.ZodString>;
32
- cc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
33
- bcc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
34
- }, "strict", z.ZodTypeAny, {
35
- message: {
36
- template_id: string;
37
- template_props?: unknown;
38
- } | {
39
- text: string;
40
- html: string;
41
- };
42
- to: string | string[];
43
- subject: string;
44
- from?: string | undefined;
45
- replyTo?: string | undefined;
46
- cc?: string | string[] | undefined;
47
- bcc?: string | string[] | undefined;
48
- }, {
49
- message: {
50
- template_id: string;
51
- template_props?: unknown;
52
- } | {
53
- text: string;
54
- html: string;
55
- };
56
- to: string | string[];
57
- subject: string;
58
- from?: string | undefined;
59
- replyTo?: string | undefined;
60
- cc?: string | string[] | undefined;
61
- bcc?: string | string[] | undefined;
62
- }>;
63
- /**
64
- * Default send email request body schema
65
- * @see createSendEmailRequestBodySchema
66
- *
67
- * This schema will not allow "to: <mailing_list_uuid>"-- use createSendEmailRequestBodySchema
68
- * with allow_mailing_list_ids_as_recipients = true to accept UUIDs
69
- */
70
- export declare const sendEmailRequestBodySchema: z.ZodObject<{
71
- message: z.ZodUnion<[z.ZodObject<{
72
- template_id: z.ZodString;
73
- template_props: z.ZodUnknown;
74
- }, "strict", z.ZodTypeAny, {
75
- template_id: string;
76
- template_props?: unknown;
77
- }, {
78
- template_id: string;
79
- template_props?: unknown;
80
- }>, z.ZodObject<{
81
- text: z.ZodString;
82
- html: z.ZodString;
83
- }, "strict", z.ZodTypeAny, {
84
- text: string;
85
- html: string;
86
- }, {
87
- text: string;
88
- html: string;
89
- }>]>;
90
- to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodString]> | z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
91
- from: z.ZodOptional<z.ZodString>;
92
- subject: z.ZodString;
93
- replyTo: z.ZodOptional<z.ZodString>;
94
- cc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
95
- bcc: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
96
- }, "strict", z.ZodTypeAny, {
97
- message: {
98
- template_id: string;
99
- template_props?: unknown;
100
- } | {
101
- text: string;
102
- html: string;
103
- };
104
- to: string | string[];
105
- subject: string;
106
- from?: string | undefined;
107
- replyTo?: string | undefined;
108
- cc?: string | string[] | undefined;
109
- bcc?: string | string[] | undefined;
110
- }, {
111
- message: {
112
- template_id: string;
113
- template_props?: unknown;
114
- } | {
115
- text: string;
116
- html: string;
117
- };
118
- to: string | string[];
119
- subject: string;
120
- from?: string | undefined;
121
- replyTo?: string | undefined;
122
- cc?: string | string[] | undefined;
123
- bcc?: string | string[] | undefined;
124
- }>;
125
- export type SendEmailRequestBody = z.infer<typeof sendEmailRequestBodySchema>;
126
- export default createSendEmailRequestBodySchema;
@@ -1,80 +0,0 @@
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 function createRecipientSchema(allow_mailing_list_ids_as_recipients = false) {
24
- if (allow_mailing_list_ids_as_recipients) {
25
- return z.union([
26
- z.string().email(), // single recipient
27
- z.string().email().array().min(1).max(MAX_RECIPIENTS), // multi recipient
28
- z.string().uuid(), // mailing list id as recipient
29
- ]);
30
- }
31
- else {
32
- return z.union([
33
- z.string().email(), // single recipient
34
- z.string().email().array().min(1).max(MAX_RECIPIENTS), // multi recipient
35
- ]);
36
- }
37
- }
38
- /**
39
- *
40
- * @param allow_mailing_list_ids_as_recipients
41
- * @returns Schema for validating send-email request body
42
- */
43
- export function createSendEmailRequestBodySchema(allow_mailing_list_ids_as_recipients = false) {
44
- return z
45
- .object({
46
- to: createRecipientSchema(allow_mailing_list_ids_as_recipients),
47
- from: z.string().email().optional(),
48
- subject: z.string().nonempty(),
49
- message: z.union([sendEmailTemplateOptions, sendRawEmailOptions]),
50
- replyTo: z.string().email().optional(),
51
- cc: z
52
- .union([
53
- z.string().email(),
54
- z.string().email().array().min(1).max(MAX_RECIPIENTS),
55
- ])
56
- .optional(),
57
- bcc: z
58
- .union([
59
- z.string().email(),
60
- z.string().email().array().min(1).max(MAX_RECIPIENTS),
61
- ])
62
- .optional(),
63
- })
64
- .required({
65
- to: true,
66
- message: true,
67
- subject: true,
68
- })
69
- .strict();
70
- }
71
- /**
72
- * Default send email request body schema
73
- * @see createSendEmailRequestBodySchema
74
- *
75
- * This schema will not allow "to: <mailing_list_uuid>"-- use createSendEmailRequestBodySchema
76
- * with allow_mailing_list_ids_as_recipients = true to accept UUIDs
77
- */
78
- export const sendEmailRequestBodySchema = createSendEmailRequestBodySchema();
79
- export default createSendEmailRequestBodySchema;
80
- //# sourceMappingURL=send-email-request-body-schema.js.map
@@ -1 +0,0 @@
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;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,cAAc,GAAW,EAAE,C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