@qawolf/api-contracts 0.42.0 → 0.48.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.
Files changed (93) hide show
  1. package/dist/v1/auth/config.d.ts +14 -6
  2. package/dist/v1/auth/config.d.ts.map +1 -1
  3. package/dist/v1/auth/config.js +15 -6
  4. package/dist/v1/auth/config.js.map +1 -1
  5. package/dist/v1/email/find.d.ts +42 -0
  6. package/dist/v1/email/find.d.ts.map +1 -0
  7. package/dist/v1/email/find.js +44 -0
  8. package/dist/v1/email/find.js.map +1 -0
  9. package/dist/v1/email/get.d.ts +52 -0
  10. package/dist/v1/email/get.d.ts.map +1 -0
  11. package/dist/v1/email/get.js +19 -0
  12. package/dist/v1/email/get.js.map +1 -0
  13. package/dist/v1/email/getAttachment.d.ts +23 -0
  14. package/dist/v1/email/getAttachment.d.ts.map +1 -0
  15. package/dist/v1/email/getAttachment.js +46 -0
  16. package/dist/v1/email/getAttachment.js.map +1 -0
  17. package/dist/v1/email/listAddresses.d.ts +23 -0
  18. package/dist/v1/email/listAddresses.d.ts.map +1 -0
  19. package/dist/v1/email/listAddresses.js +33 -0
  20. package/dist/v1/email/listAddresses.js.map +1 -0
  21. package/dist/v1/email/resource.d.ts +67 -0
  22. package/dist/v1/email/resource.d.ts.map +1 -0
  23. package/dist/v1/email/resource.js +56 -0
  24. package/dist/v1/email/resource.js.map +1 -0
  25. package/dist/v1/email/send.d.ts +46 -0
  26. package/dist/v1/email/send.d.ts.map +1 -0
  27. package/dist/v1/email/send.js +62 -0
  28. package/dist/v1/email/send.js.map +1 -0
  29. package/dist/v1/index.d.ts +387 -0
  30. package/dist/v1/index.d.ts.map +1 -1
  31. package/dist/v1/index.js +28 -13
  32. package/dist/v1/index.js.map +1 -1
  33. package/dist/v1/runner/evaluateSnippet.d.ts +5 -1
  34. package/dist/v1/runner/evaluateSnippet.d.ts.map +1 -1
  35. package/dist/v1/runner/evaluateSnippet.js +5 -2
  36. package/dist/v1/runner/evaluateSnippet.js.map +1 -1
  37. package/dist/v1/runner/get.d.ts +5 -1
  38. package/dist/v1/runner/get.d.ts.map +1 -1
  39. package/dist/v1/runner/get.js +5 -2
  40. package/dist/v1/runner/get.js.map +1 -1
  41. package/dist/v1/runner/highlightSelector.d.ts +5 -1
  42. package/dist/v1/runner/highlightSelector.d.ts.map +1 -1
  43. package/dist/v1/runner/highlightSelector.js +5 -2
  44. package/dist/v1/runner/highlightSelector.js.map +1 -1
  45. package/dist/v1/runner/identity.d.ts +2 -0
  46. package/dist/v1/runner/identity.d.ts.map +1 -1
  47. package/dist/v1/runner/identity.js +2 -0
  48. package/dist/v1/runner/identity.js.map +1 -1
  49. package/dist/v1/runner/importPackage.d.ts +5 -1
  50. package/dist/v1/runner/importPackage.d.ts.map +1 -1
  51. package/dist/v1/runner/importPackage.js +5 -2
  52. package/dist/v1/runner/importPackage.js.map +1 -1
  53. package/dist/v1/runner/index.d.ts +9 -2
  54. package/dist/v1/runner/index.d.ts.map +1 -1
  55. package/dist/v1/runner/index.js +9 -3
  56. package/dist/v1/runner/index.js.map +1 -1
  57. package/dist/v1/runner/inspect.d.ts +5 -1
  58. package/dist/v1/runner/inspect.d.ts.map +1 -1
  59. package/dist/v1/runner/inspect.js +5 -2
  60. package/dist/v1/runner/inspect.js.map +1 -1
  61. package/dist/v1/runner/inspectMobile.d.ts +5 -1
  62. package/dist/v1/runner/inspectMobile.d.ts.map +1 -1
  63. package/dist/v1/runner/inspectMobile.js +5 -2
  64. package/dist/v1/runner/inspectMobile.js.map +1 -1
  65. package/dist/v1/runner/list.d.ts +26 -0
  66. package/dist/v1/runner/list.d.ts.map +1 -0
  67. package/dist/v1/runner/list.js +23 -0
  68. package/dist/v1/runner/list.js.map +1 -0
  69. package/dist/v1/runner/performAction.d.ts +5 -1
  70. package/dist/v1/runner/performAction.d.ts.map +1 -1
  71. package/dist/v1/runner/performAction.js +5 -2
  72. package/dist/v1/runner/performAction.js.map +1 -1
  73. package/dist/v1/runner/promoteSnapshot.d.ts +5 -1
  74. package/dist/v1/runner/promoteSnapshot.d.ts.map +1 -1
  75. package/dist/v1/runner/promoteSnapshot.js +5 -2
  76. package/dist/v1/runner/promoteSnapshot.js.map +1 -1
  77. package/dist/v1/runner/readJournal.d.ts +5 -1
  78. package/dist/v1/runner/readJournal.d.ts.map +1 -1
  79. package/dist/v1/runner/readJournal.js +5 -2
  80. package/dist/v1/runner/readJournal.js.map +1 -1
  81. package/dist/v1/runner/runFlow.d.ts +3 -1
  82. package/dist/v1/runner/runFlow.d.ts.map +1 -1
  83. package/dist/v1/runner/runFlow.js +4 -1
  84. package/dist/v1/runner/runFlow.js.map +1 -1
  85. package/dist/v1/runner/stopRun.d.ts +5 -1
  86. package/dist/v1/runner/stopRun.d.ts.map +1 -1
  87. package/dist/v1/runner/stopRun.js +5 -2
  88. package/dist/v1/runner/stopRun.js.map +1 -1
  89. package/dist/v1/runner/takeScreenshot.d.ts +5 -1
  90. package/dist/v1/runner/takeScreenshot.d.ts.map +1 -1
  91. package/dist/v1/runner/takeScreenshot.js +5 -2
  92. package/dist/v1/runner/takeScreenshot.js.map +1 -1
  93. package/package.json +1 -1
@@ -0,0 +1,62 @@
1
+ import { z } from "zod";
2
+ import { resource } from "../resource.js";
3
+ import { emailUrlFieldDescription, makeEmailSummaryFields, } from "./resource.js";
4
+ const recipientsSchema = z.array(z.email()).max(50);
5
+ const maxAttachments = 10;
6
+ /**
7
+ * The most base64 content the attachments of one email may carry together.
8
+ * SendGrid refuses a message over 30 MB, and base64 is the form on the wire.
9
+ */
10
+ export const maxEmailAttachmentsBase64Length = 30 * 1024 * 1024;
11
+ const attachmentsBase64Length = (attachments) => Object.values(attachments).reduce((total, content) => total + content.length, 0);
12
+ export const makeSendEmailContract = (ids) => {
13
+ const input = z
14
+ .object({
15
+ // A record rather than a list: the CLI expresses a record of strings
16
+ // as one repeatable flag, and cannot express a list of objects.
17
+ attachments: z
18
+ .record(z.string().min(1), z.base64())
19
+ .refine((attachments) => Object.keys(attachments).length <= maxAttachments, { message: `Send at most ${maxAttachments} attachments.` })
20
+ // A cap here answers with a 400 before the payload reaches the
21
+ // emailer, whatever the state of the size guard behind it.
22
+ .refine((attachments) => attachmentsBase64Length(attachments) <=
23
+ maxEmailAttachmentsBase64Length, { message: "Send at most 30 MB of attachments." })
24
+ .optional()
25
+ .describe("Files to attach, as file name to base64 content, at most 30 MB in total. The MIME type comes from the file name's extension."),
26
+ bcc: recipientsSchema.optional(),
27
+ cc: recipientsSchema.optional(),
28
+ from: z
29
+ .email()
30
+ .optional()
31
+ .describe("The workspace inbox address to send from, or a plus-suffixed form of one. Defaults to the workspace's default inbox address. See email.listAddresses."),
32
+ html: z.string().optional().describe("The HTML body."),
33
+ inReplyTo: z
34
+ .string()
35
+ .min(1)
36
+ .optional()
37
+ .describe("The id of an email of the workspace to reply to, from email.find. The reply threads under that message."),
38
+ replyTo: recipientsSchema
39
+ .optional()
40
+ .describe("Where replies should go instead of the from address."),
41
+ subject: z.string().min(1),
42
+ text: z.string().optional().describe("The plain text body."),
43
+ to: recipientsSchema.min(1),
44
+ workspaceId: ids.workspace
45
+ .optional()
46
+ .describe("The workspace to send from. Required when authenticating with an organization or user API key."),
47
+ })
48
+ .refine((email) => email.html || email.text, {
49
+ message: "Provide text, html, or both.",
50
+ });
51
+ const output = resource(makeEmailSummaryFields(), {
52
+ urlFieldDescription: emailUrlFieldDescription,
53
+ });
54
+ return {
55
+ description: "Send an email from one of the workspace's inbox addresses, for example to exercise a flow that reacts to incoming mail. Returns the sent email; read it back with email.get.",
56
+ input,
57
+ kind: "write",
58
+ name: "email.send",
59
+ output,
60
+ };
61
+ };
62
+ //# sourceMappingURL=send.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/v1/email/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,QAAQ,EAAE,MAAM,g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