@automate.ax/api-contract 0.154.0 → 0.155.0

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/index.d.ts CHANGED
@@ -9148,6 +9148,7 @@ export declare const contract: {
9148
9148
  timestamp: import("zod").ZodDate;
9149
9149
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
9150
9150
  sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodIntersection<import("zod").ZodObject<{
9151
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodCustom<File, File>>>;
9151
9152
  headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
9152
9153
  replyTo: import("zod").ZodOptional<import("zod").ZodEmail>;
9153
9154
  subject: import("zod").ZodString;
package/dist/runtime.d.ts CHANGED
@@ -18,6 +18,8 @@ export declare const AUTOMATION_LOG_MAX_MESSAGE_LENGTH = 16384;
18
18
  export declare const runtimeObservabilityFieldsSchema: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>;
19
19
  /** Runtime-validated structural policy for author-visible value projection. */
20
20
  export declare const sensitivityMaskSchema: z.ZodCustom<SensitivityMask, SensitivityMask>;
21
+ export declare const PLATFORM_EMAIL_MAX_ENCODED_ATTACHMENT_BYTES = 40000000;
22
+ export declare const platformEmailAttachmentsSchema: z.ZodArray<z.ZodCustom<File, File>>;
21
23
  /** Immediate or mutually exclusive absolute/relative invocation timing. */
22
24
  export declare const automationInvocationScheduleSchema: z.ZodUnion<readonly [z.ZodObject<{
23
25
  runAt: z.ZodUnion<readonly [z.ZodDate, z.ZodString, z.ZodNumber]>;
@@ -2823,6 +2825,7 @@ export declare const runtimeContract: {
2823
2825
  timestamp: z.ZodDate;
2824
2826
  }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
2825
2827
  sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodIntersection<z.ZodObject<{
2828
+ attachments: z.ZodOptional<z.ZodArray<z.ZodCustom<File, File>>>;
2826
2829
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2827
2830
  replyTo: z.ZodOptional<z.ZodEmail>;
2828
2831
  subject: z.ZodString;
package/dist/runtime.js CHANGED
@@ -59,6 +59,23 @@ const EMAIL_BODY_SCHEMA = z.union([
59
59
  text: z.string().min(1),
60
60
  }),
61
61
  ]);
62
+ export const PLATFORM_EMAIL_MAX_ENCODED_ATTACHMENT_BYTES = 40_000_000;
63
+ const PLATFORM_EMAIL_ATTACHMENT_SCHEMA = z
64
+ .instanceof(File)
65
+ .refine((file) => file.name.length > 0, "Attachments must have a filename.");
66
+ export const platformEmailAttachmentsSchema = PLATFORM_EMAIL_ATTACHMENT_SCHEMA.array().superRefine((files, context) => {
67
+ let encodedBytes = 0;
68
+ for (const file of files) {
69
+ encodedBytes += 4 * Math.ceil(file.size / 3);
70
+ if (encodedBytes > PLATFORM_EMAIL_MAX_ENCODED_ATTACHMENT_BYTES) {
71
+ context.addIssue({
72
+ code: "custom",
73
+ message: "Attachments must total 40 MB or less after Base64 encoding.",
74
+ });
75
+ return;
76
+ }
77
+ }
78
+ });
62
79
  /** Immediate or mutually exclusive absolute/relative invocation timing. */
63
80
  export const automationInvocationScheduleSchema = z.union([
64
81
  z.object({
@@ -1039,6 +1056,7 @@ export const runtimeContract = {
1039
1056
  sendEmail: oc
1040
1057
  .input(z
1041
1058
  .object({
1059
+ attachments: platformEmailAttachmentsSchema.optional(),
1042
1060
  headers: z.record(z.string().min(1), z.string()).optional(),
1043
1061
  replyTo: z.email().optional(),
1044
1062
  subject: z.string().min(1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.154.0",
3
+ "version": "0.155.0",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ai-sdk/gateway": "4.0.46",
34
- "@automate.ax/catalog": "0.154.0",
35
- "@automate.ax/codec": "0.154.0",
36
- "@automate.ax/integration-contracts": "0.154.0",
34
+ "@automate.ax/catalog": "0.155.0",
35
+ "@automate.ax/codec": "0.155.0",
36
+ "@automate.ax/integration-contracts": "0.155.0",
37
37
  "@orpc/contract": "1.15.0",
38
38
  "fast-json-stable-stringify": "^2.1.0",
39
39
  "zod": "^4.3.6"
package/src/runtime.ts CHANGED
@@ -83,6 +83,25 @@ const EMAIL_BODY_SCHEMA = z.union([
83
83
  text: z.string().min(1),
84
84
  }),
85
85
  ])
86
+ export const PLATFORM_EMAIL_MAX_ENCODED_ATTACHMENT_BYTES = 40_000_000
87
+ const PLATFORM_EMAIL_ATTACHMENT_SCHEMA = z
88
+ .instanceof(File)
89
+ .refine((file) => file.name.length > 0, "Attachments must have a filename.")
90
+ export const platformEmailAttachmentsSchema =
91
+ PLATFORM_EMAIL_ATTACHMENT_SCHEMA.array().superRefine((files, context) => {
92
+ let encodedBytes = 0
93
+ for (const file of files) {
94
+ encodedBytes += 4 * Math.ceil(file.size / 3)
95
+ if (encodedBytes > PLATFORM_EMAIL_MAX_ENCODED_ATTACHMENT_BYTES) {
96
+ context.addIssue({
97
+ code: "custom",
98
+ message:
99
+ "Attachments must total 40 MB or less after Base64 encoding.",
100
+ })
101
+ return
102
+ }
103
+ }
104
+ })
86
105
 
87
106
  /** Immediate or mutually exclusive absolute/relative invocation timing. */
88
107
  export const automationInvocationScheduleSchema = z.union([
@@ -1272,6 +1291,7 @@ export const runtimeContract = {
1272
1291
  .input(
1273
1292
  z
1274
1293
  .object({
1294
+ attachments: platformEmailAttachmentsSchema.optional(),
1275
1295
  headers: z.record(z.string().min(1), z.string()).optional(),
1276
1296
  replyTo: z.email().optional(),
1277
1297
  subject: z.string().min(1),