emailengine-app 2.78.0 → 2.79.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/.ncurc.js +23 -13
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +29 -0
- package/config/e2e.toml +2 -1
- package/config/test.toml +2 -1
- package/data/google-crawlers.json +1 -1
- package/lib/account.js +70 -35
- package/lib/api-reference/format.js +91 -4
- package/lib/api-reference/model.js +144 -19
- package/lib/api-reference/schema-tree.js +282 -28
- package/lib/api-routes/account-routes.js +80 -34
- package/lib/api-routes/blocklist-routes.js +21 -47
- package/lib/api-routes/chat-routes.js +10 -12
- package/lib/api-routes/delivery-test-routes.js +6 -26
- package/lib/api-routes/export-routes.js +2 -0
- package/lib/api-routes/gateway-routes.js +52 -11
- package/lib/api-routes/license-routes.js +2 -0
- package/lib/api-routes/mailbox-routes.js +29 -26
- package/lib/api-routes/message-routes.js +27 -21
- package/lib/api-routes/oauth2-app-routes.js +11 -29
- package/lib/api-routes/operation-impact.js +80 -0
- package/lib/api-routes/outbox-routes.js +15 -5
- package/lib/api-routes/permission-map.js +397 -0
- package/lib/api-routes/route-helpers.js +223 -9
- package/lib/api-routes/route-metadata.js +28 -0
- package/lib/api-routes/settings-routes.js +30 -25
- package/lib/api-routes/stats-routes.js +2 -2
- package/lib/api-routes/submit-routes.js +53 -31
- package/lib/api-routes/template-routes.js +3 -0
- package/lib/api-routes/token-routes.js +319 -33
- package/lib/api-routes/webhook-route-routes.js +14 -4
- package/lib/auth-token.js +80 -8
- package/lib/consts.js +10 -0
- package/lib/db.js +20 -2
- package/lib/delivery-error.js +30 -1
- package/lib/email-client/base-client.js +27 -41
- package/lib/email-client/gmail-client.js +19 -10
- package/lib/email-client/imap/mailbox.js +23 -24
- package/lib/email-client/imap/subconnection.js +10 -7
- package/lib/email-client/imap/sync-operations.js +46 -46
- package/lib/email-client/imap-client.js +36 -26
- package/lib/email-client/message-builder.js +3 -3
- package/lib/email-client/notification-handler.js +1 -1
- package/lib/email-client/outlook/graph-api.js +10 -4
- package/lib/email-client/outlook-client.js +53 -54
- package/lib/email-client/smtp-pool-manager.js +1 -1
- package/lib/enum-descriptions.js +92 -2
- package/lib/export.js +1 -1
- package/lib/field-usage.js +133 -0
- package/lib/gateway.js +1 -1
- package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +3 -3
- package/lib/imapproxy/imap-core/lib/commands/id.js +2 -13
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +1 -1
- package/lib/imapproxy/imap-core/lib/imap-command.js +21 -5
- package/lib/imapproxy/imap-core/lib/imap-connection.js +15 -5
- package/lib/imapproxy/imap-server.js +27 -7
- package/lib/license-beacon.js +4 -9
- package/lib/lists.js +49 -1
- package/lib/llm-pre-process.js +5 -5
- package/lib/logger.js +5 -1
- package/lib/metrics-collector.js +2 -2
- package/lib/oauth/gmail.js +9 -12
- package/lib/oauth/mail-ru.js +5 -7
- package/lib/oauth/outlook.js +9 -9
- package/lib/oauth/pubsub/google.js +25 -10
- package/lib/oauth/scope-checker.js +1 -1
- package/lib/oauth2-apps.js +223 -294
- package/lib/openapi/build-document.js +15 -7
- package/lib/openapi/joi-schema.js +20 -0
- package/lib/outbox.js +85 -17
- package/lib/pre-process.js +8 -8
- package/lib/queue-stats.js +49 -0
- package/lib/read-env-value.js +1 -1
- package/lib/reconnection-manager.js +2 -2
- package/lib/rewrite-text-nodes.js +4 -3
- package/lib/routes-ui.js +4 -0
- package/lib/schemas.js +216 -160
- package/lib/settings.js +84 -5
- package/lib/sub-script.js +2 -1
- package/lib/swagger-options.js +2 -1
- package/lib/templates.js +4 -4
- package/lib/threads.js +2 -2
- package/lib/token-audit-log.js +208 -0
- package/lib/token-permission-view.js +219 -0
- package/lib/token-permissions.js +172 -0
- package/lib/tokens.js +99 -15
- package/lib/tools.js +142 -37
- package/lib/ui-routes/account-routes.js +31 -11
- package/lib/ui-routes/admin-config-routes.js +18 -10
- package/lib/ui-routes/admin-entities-routes.js +66 -22
- package/lib/ui-routes/auth-routes.js +30 -24
- package/lib/ui-routes/export-routes.js +10 -4
- package/lib/ui-routes/oauth-config-routes.js +5 -5
- package/lib/ui-routes/reference-routes.js +3 -3
- package/lib/ui-routes/route-helpers.js +51 -2
- package/lib/ui-routes/settings-page.js +1 -1
- package/lib/ui-routes/smtp-test-routes.js +1 -1
- package/lib/ui-routes/suppression-list-routes.js +294 -0
- package/lib/ui-routes/unsubscribe-routes.js +19 -29
- package/lib/utils/network.js +2 -2
- package/lib/web-safe-html.js +1 -1
- package/lib/webhook-routing.js +80 -0
- package/lib/webhooks.js +20 -14
- package/package.json +11 -10
- package/sbom.json +1 -1
- package/server.js +80 -41
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +136 -9
- package/static/js/reference.js +456 -10
- package/static/js/ui.js +43 -0
- package/static/licenses.html +51 -41
- package/translations/messages.pot +59 -59
- package/views/accounts/account.hbs +69 -7
- package/views/accounts/browse.hbs +18 -35
- package/views/config/logging.hbs +6 -0
- package/views/config/oauth/app.hbs +0 -2
- package/views/config/security.hbs +13 -0
- package/views/partials/oauth_form.hbs +0 -15
- package/views/partials/reference/disclosure.hbs +8 -2
- package/views/partials/reference/operation.hbs +47 -13
- package/views/partials/reference/params.hbs +17 -1
- package/views/partials/reference/schema-node.hbs +110 -52
- package/views/partials/reference/schema-tools.hbs +25 -0
- package/views/partials/reference/try-it.hbs +84 -11
- package/views/partials/side_menu.hbs +1 -0
- package/views/partials/ui/checkbox.hbs +2 -2
- package/views/partials/ui/tabs.hbs +7 -1
- package/views/reference/token.hbs +4 -0
- package/views/suppression-lists/index.hbs +85 -0
- package/views/suppression-lists/list.hbs +87 -0
- package/views/templates/index.hbs +8 -2
- package/views/tokens/index.hbs +31 -4
- package/views/tokens/new.hbs +324 -2
- package/workers/api.js +146 -57
- package/workers/documents.js +46 -26
- package/workers/export.js +20 -8
- package/workers/imap-proxy.js +2 -2
- package/workers/imap.js +12 -6
- package/workers/smtp.js +13 -7
- package/workers/submit.js +40 -30
- package/workers/webhooks.js +59 -25
- package/lib/feature-flags.js +0 -48
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Where a route keeps the metadata that is about its documentation and its permissions rather than
|
|
4
|
+
// about serving the request: `plugins.openapi` in the route definition.
|
|
5
|
+
//
|
|
6
|
+
// Its own module because two readers need it and neither should own it. lib/openapi/build-document.js
|
|
7
|
+
// publishes what it finds there, and ./permission-map.js reads `x-ee-impact` out of it at request
|
|
8
|
+
// time to resolve what a token needs. Keeping the accessor in either would have the other spell the
|
|
9
|
+
// slot out again, and one of them feeds access control: rename the key with two independent readers
|
|
10
|
+
// and the second starts seeing an empty object, which downgrades every declared impact to the method
|
|
11
|
+
// default with nothing failing.
|
|
12
|
+
//
|
|
13
|
+
// It sits under lib/api-routes/ rather than lib/openapi/ so the dependency runs one way. The
|
|
14
|
+
// generator reads route metadata; route modules do not read the generator.
|
|
15
|
+
|
|
16
|
+
const PLUGIN_OPTIONS_KEY = 'openapi';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The documentation and permission metadata a route declares.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} route - a `server.table()` entry, or a live `request.route`
|
|
22
|
+
* @returns {Object} the route's `plugins.openapi`, or an empty object when it declares none
|
|
23
|
+
*/
|
|
24
|
+
function pluginOptions(route) {
|
|
25
|
+
return (route && route.settings && route.settings.plugins && route.settings.plugins[PLUGIN_OPTIONS_KEY]) || {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = { pluginOptions };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
|
-
const {
|
|
4
|
+
const { QUEUES_BY_NAME } = require('../db');
|
|
5
5
|
const settings = require('../settings');
|
|
6
6
|
const consts = require('../consts');
|
|
7
|
-
const { REDIS_PREFIX } = consts;
|
|
8
7
|
const { failAction } = require('../tools');
|
|
9
|
-
const {
|
|
8
|
+
const { queueStats } = require('../queue-stats');
|
|
9
|
+
const { handleError, maskSecrets } = require('./route-helpers');
|
|
10
10
|
const { settingsSchema, settingsQuerySchema, apiResponses, ENUM_DESCRIPTIONS } = require('../schemas');
|
|
11
11
|
|
|
12
12
|
// Response variant of the settings schema. Secret values are masked and returned as booleans,
|
|
@@ -59,6 +59,15 @@ async function init(args) {
|
|
|
59
59
|
values[key] = value;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
// The global equivalents of the credential-bearing account fields. encryptedKeys above
|
|
64
|
+
// covers what is encrypted at rest, which is not the same set: proxyUrl, httpProxyUrl,
|
|
65
|
+
// webhooks and webhooksCustomHeaders are stored in the clear and were returned in full,
|
|
66
|
+
// so this endpoint disclosed exactly what the account getters were masking. It sits in
|
|
67
|
+
// the never-grantable admin group, so no narrowed token reaches it - but leaving the
|
|
68
|
+
// asymmetry here is how the next reader learns the wrong pattern.
|
|
69
|
+
maskSecrets(values);
|
|
70
|
+
|
|
62
71
|
return values;
|
|
63
72
|
},
|
|
64
73
|
options: {
|
|
@@ -165,30 +174,25 @@ async function init(args) {
|
|
|
165
174
|
queue
|
|
166
175
|
};
|
|
167
176
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.llen(`${REDIS_PREFIX}bull:${queue}:paused`)
|
|
173
|
-
.llen(`${REDIS_PREFIX}bull:${queue}:wait`)
|
|
174
|
-
.hget(`${REDIS_PREFIX}bull:${queue}:meta`, 'paused')
|
|
175
|
-
.exec();
|
|
176
|
-
|
|
177
|
-
if (resActive[0] || resDelayed[0] || resPaused[0] || resWaiting[0]) {
|
|
178
|
-
// counting failed
|
|
177
|
+
let stats;
|
|
178
|
+
try {
|
|
179
|
+
stats = await queueStats(QUEUES_BY_NAME[queue]);
|
|
180
|
+
} catch (countErr) {
|
|
179
181
|
let err = new Error('Failed to count queue length');
|
|
180
182
|
err.statusCode = 500;
|
|
183
|
+
err.cause = countErr;
|
|
181
184
|
throw err;
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
values.jobs = {
|
|
185
|
-
active:
|
|
186
|
-
delayed:
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
active: stats.active,
|
|
189
|
+
delayed: stats.delayed,
|
|
190
|
+
// Reported for compatibility only - see the response schema below
|
|
191
|
+
paused: stats.paused,
|
|
192
|
+
waiting: stats.waiting
|
|
189
193
|
};
|
|
190
194
|
|
|
191
|
-
values.paused =
|
|
195
|
+
values.paused = stats.isPaused;
|
|
192
196
|
|
|
193
197
|
return values;
|
|
194
198
|
} catch (err) {
|
|
@@ -246,7 +250,12 @@ async function init(args) {
|
|
|
246
250
|
jobs: Joi.object({
|
|
247
251
|
active: Joi.number().integer().example(123).description('Jobs that are currently being processed'),
|
|
248
252
|
delayed: Joi.number().integer().example(123).description('Jobs that are processed in the future'),
|
|
249
|
-
paused: Joi.number()
|
|
253
|
+
paused: Joi.number()
|
|
254
|
+
.integer()
|
|
255
|
+
.example(0)
|
|
256
|
+
.description(
|
|
257
|
+
'Always 0. BullMQ 6 no longer parks jobs in a separate paused list, so jobs held by a paused queue are counted as waiting. Kept so existing clients still see the key'
|
|
258
|
+
),
|
|
250
259
|
waiting: Joi.number()
|
|
251
260
|
.integer()
|
|
252
261
|
.example(123)
|
|
@@ -267,11 +276,7 @@ async function init(args) {
|
|
|
267
276
|
try {
|
|
268
277
|
let queue = request.params.queue;
|
|
269
278
|
|
|
270
|
-
let queueObj =
|
|
271
|
-
documents: documentsQueue,
|
|
272
|
-
notify: notifyQueue,
|
|
273
|
-
submit: submitQueue
|
|
274
|
-
}[queue];
|
|
279
|
+
let queueObj = QUEUES_BY_NAME[queue];
|
|
275
280
|
|
|
276
281
|
let values = {
|
|
277
282
|
queue
|
|
@@ -72,14 +72,14 @@ async function init(args) {
|
|
|
72
72
|
key: Joi.string().example('maxmemory-policy').description('Warning identifier'),
|
|
73
73
|
color: Joi.string().example('warning').description('Severity indicator'),
|
|
74
74
|
title: Joi.string().example('Unsafe Redis eviction policy').description('Warning title'),
|
|
75
|
-
details: Joi.array().items(Joi.string()).description('Warning details')
|
|
75
|
+
details: Joi.array().items(Joi.string().example('maxmemory-policy is allkeys-lru')).description('Warning details')
|
|
76
76
|
})
|
|
77
77
|
.unknown()
|
|
78
78
|
.label('RedisWarningEntry')
|
|
79
79
|
)
|
|
80
80
|
.description('Warnings about the Redis configuration')
|
|
81
81
|
.label('RedisWarnings'),
|
|
82
|
-
redisPing: Joi.number().description('Redis latency in milliseconds'),
|
|
82
|
+
redisPing: Joi.number().example(1.2).description('Redis latency in milliseconds'),
|
|
83
83
|
imapflow: Joi.string().example('1.0.188').description('ImapFlow version'),
|
|
84
84
|
bullmq: Joi.string().example('5.0.0').description('BullMQ version'),
|
|
85
85
|
arch: Joi.string().example('arm64').description('CPU architecture of the host'),
|
|
@@ -5,8 +5,10 @@ const { redis } = require('../db');
|
|
|
5
5
|
const { Account } = require('../account');
|
|
6
6
|
const getSecret = require('../get-secret');
|
|
7
7
|
const { failAction } = require('../tools');
|
|
8
|
-
const { handleError } = require('./route-helpers');
|
|
8
|
+
const { handleError, assertNoNetworkOverride } = require('./route-helpers');
|
|
9
9
|
const BEHAVIOR = require('./behavior-notes');
|
|
10
|
+
const { IMPACT } = require('./operation-impact');
|
|
11
|
+
const { FIELD_USAGE } = require('../field-usage');
|
|
10
12
|
const {
|
|
11
13
|
messageReferenceSchema,
|
|
12
14
|
fromAddressSchema,
|
|
@@ -36,7 +38,12 @@ const deliveryAttemptsSchema = Joi.number().integer().example(10).description('H
|
|
|
36
38
|
const gatewaySchema = Joi.string().max(256).example('example').description('Optional SMTP gateway ID for message routing').label('MessageGateway');
|
|
37
39
|
|
|
38
40
|
const dsnSchema = Joi.object({
|
|
39
|
-
id: Joi.string()
|
|
41
|
+
id: Joi.string()
|
|
42
|
+
.trim()
|
|
43
|
+
.empty('')
|
|
44
|
+
.max(256)
|
|
45
|
+
.example('order-4815-notify')
|
|
46
|
+
.description('The envelope identifier that would be included in the response (ENVID)'),
|
|
40
47
|
return: Joi.string()
|
|
41
48
|
.trim()
|
|
42
49
|
.empty('')
|
|
@@ -47,12 +54,19 @@ const dsnSchema = Joi.object({
|
|
|
47
54
|
notify: Joi.array()
|
|
48
55
|
.single()
|
|
49
56
|
.items(Joi.string().valid('never', 'success', 'failure', 'delay').meta({ enumDescriptions: ENUM_DESCRIPTIONS.dsnNotify }).label('NotifyEntry'))
|
|
57
|
+
.example(['failure', 'delay'])
|
|
50
58
|
.description('Defines the conditions under which a DSN response should be sent')
|
|
51
59
|
.label('DsnNotify'),
|
|
52
|
-
recipient: Joi.string().trim().empty('').email().description('The email address the DSN should be sent (ORCPT)')
|
|
60
|
+
recipient: Joi.string().trim().empty('').email().example('bounces@example.com').description('The email address the DSN should be sent (ORCPT)')
|
|
53
61
|
}).description('Request DSN notifications');
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
// Refused for a token that carries a `permissions` record, see assertNoNetworkOverride() - the
|
|
64
|
+
// override decides where a session carrying the account's SMTP credentials connects, so it is not
|
|
65
|
+
// something a narrowed credential may set. Said in the description because the alternative is a 403
|
|
66
|
+
// that reads as a permission bug.
|
|
67
|
+
const proxySchema = settingsSchema.proxyUrl.description(
|
|
68
|
+
'Optional proxy URL to use when connecting to the SMTP server. A token with restricted permissions can not set this - it redirects a session that carries the account credentials'
|
|
69
|
+
);
|
|
56
70
|
|
|
57
71
|
const localAddressSchema = ipSchema.description('Optional local IP address to bind to when connecting to the SMTP server');
|
|
58
72
|
|
|
@@ -61,7 +75,8 @@ const idempotencyResponseSchema = Joi.object({
|
|
|
61
75
|
status: Joi.string()
|
|
62
76
|
.valid('MISS', 'HIT')
|
|
63
77
|
.example('MISS')
|
|
64
|
-
.description('Whether
|
|
78
|
+
.description('Whether this response was produced now or replayed from the idempotency cache')
|
|
79
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.idempotencyStatus })
|
|
65
80
|
})
|
|
66
81
|
.description('Idempotency info, present when an Idempotency-Key header was used')
|
|
67
82
|
.label('ResponseIdempotency');
|
|
@@ -83,6 +98,8 @@ async function init(args) {
|
|
|
83
98
|
});
|
|
84
99
|
|
|
85
100
|
try {
|
|
101
|
+
assertNoNetworkOverride(request);
|
|
102
|
+
|
|
86
103
|
return await accountObject.queueMessage(request.payload, {
|
|
87
104
|
source: 'api',
|
|
88
105
|
idempotencyKey: request.headers['idempotency-key'],
|
|
@@ -108,6 +125,7 @@ async function init(args) {
|
|
|
108
125
|
|
|
109
126
|
plugins: {
|
|
110
127
|
openapi: {
|
|
128
|
+
'x-ee-impact': IMPACT.SENDS,
|
|
111
129
|
'x-ee-behavior': [BEHAVIOR.QUEUED_DELIVERY, BEHAVIOR.SENT_FOLDER_UPLOAD],
|
|
112
130
|
responses: apiResponses(
|
|
113
131
|
'Returns the queue ID the message was accepted under. Delivery happens asynchronously - a 200 means queued, not sent.',
|
|
@@ -150,9 +168,8 @@ async function init(args) {
|
|
|
150
168
|
.truthy('Y', 'true', '1')
|
|
151
169
|
.falsy('N', 'false', 0)
|
|
152
170
|
.default(false)
|
|
153
|
-
.description(
|
|
154
|
-
|
|
155
|
-
)
|
|
171
|
+
.description('For MS Graph accounts: send as structured JSON instead of raw MIME')
|
|
172
|
+
.meta({ usage: FIELD_USAGE.useStructuredFormat })
|
|
156
173
|
}).label('SubmitQuery'),
|
|
157
174
|
|
|
158
175
|
headers: submitHeadersSchema,
|
|
@@ -164,9 +181,8 @@ async function init(args) {
|
|
|
164
181
|
from: Joi.string().email().allow('').example('sender@example.com'),
|
|
165
182
|
to: Joi.array().items(Joi.string().email().required().example('recipient@example.com')).single().label('SmtpEnvelopeTo')
|
|
166
183
|
})
|
|
167
|
-
.description(
|
|
168
|
-
|
|
169
|
-
)
|
|
184
|
+
.description('An optional object specifying the SMTP envelope used during email transmission')
|
|
185
|
+
.meta({ usage: FIELD_USAGE.messageEnvelope })
|
|
170
186
|
.label('SMTPEnvelope')
|
|
171
187
|
.when('mailMerge', {
|
|
172
188
|
is: Joi.exist().not(false, null),
|
|
@@ -177,9 +193,8 @@ async function init(args) {
|
|
|
177
193
|
.base64()
|
|
178
194
|
.max(MAX_ATTACHMENT_SIZE)
|
|
179
195
|
.example('TUlNRS1WZXJzaW9uOiAxLjANClN1YmplY3Q6IGhlbGxvIHdvcmxkDQoNCkhlbGxvIQ0K')
|
|
180
|
-
.description(
|
|
181
|
-
|
|
182
|
-
)
|
|
196
|
+
.description('A Base64-encoded email message in RFC 822 format')
|
|
197
|
+
.meta({ usage: FIELD_USAGE.messageRaw })
|
|
183
198
|
.label('RFC822Raw')
|
|
184
199
|
.when('mailMerge', {
|
|
185
200
|
is: Joi.exist().not(false, null),
|
|
@@ -237,12 +252,16 @@ async function init(args) {
|
|
|
237
252
|
format: Joi.string()
|
|
238
253
|
.valid('html', 'markdown')
|
|
239
254
|
.default('html')
|
|
240
|
-
.description('Markup language
|
|
255
|
+
.description('Markup language the template is written in')
|
|
256
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.renderFormat })
|
|
241
257
|
.label('RenderFormat'),
|
|
242
|
-
params: Joi.object()
|
|
258
|
+
params: Joi.object()
|
|
259
|
+
.label('RenderValues')
|
|
260
|
+
.example({ firstName: 'Nyan', orderId: '4815' })
|
|
261
|
+
.description('An object of variables for the template renderer')
|
|
243
262
|
})
|
|
244
263
|
.allow(false)
|
|
245
|
-
.description('Template rendering options')
|
|
264
|
+
.description('Template rendering options. Set to `false` to send the template as-is, without rendering it.')
|
|
246
265
|
.when('mailMerge', {
|
|
247
266
|
is: Joi.exist().not(false, null),
|
|
248
267
|
then: Joi.forbidden('y')
|
|
@@ -254,7 +273,10 @@ async function init(args) {
|
|
|
254
273
|
Joi.object({
|
|
255
274
|
to: addressSchema.label('ToAddress').required(),
|
|
256
275
|
messageId: Joi.string().max(996).example('<test123@example.com>').description('Message ID'),
|
|
257
|
-
params: Joi.object()
|
|
276
|
+
params: Joi.object()
|
|
277
|
+
.label('RenderValues')
|
|
278
|
+
.example({ firstName: 'Nyan', orderId: '4815' })
|
|
279
|
+
.description('An object of variables for the template renderer'),
|
|
258
280
|
sendAt: Joi.date()
|
|
259
281
|
.iso()
|
|
260
282
|
.example('2021-07-08T07:06:34.336Z')
|
|
@@ -262,9 +284,8 @@ async function init(args) {
|
|
|
262
284
|
}).label('MailMergeListEntry')
|
|
263
285
|
)
|
|
264
286
|
.min(1)
|
|
265
|
-
.description(
|
|
266
|
-
|
|
267
|
-
)
|
|
287
|
+
.description('Mail merge options. A separate email is generated for each recipient')
|
|
288
|
+
.meta({ usage: FIELD_USAGE.mailMerge })
|
|
268
289
|
.label('MailMergeList'),
|
|
269
290
|
|
|
270
291
|
attachments: Joi.array()
|
|
@@ -293,9 +314,8 @@ async function init(args) {
|
|
|
293
314
|
.max(256)
|
|
294
315
|
.allow(false, null)
|
|
295
316
|
.example('AAAAAQAACnAcde')
|
|
296
|
-
.description(
|
|
297
|
-
|
|
298
|
-
)
|
|
317
|
+
.description('References an existing attachment by its ID instead of providing new attachment content')
|
|
318
|
+
.meta({ usage: FIELD_USAGE.attachmentReference })
|
|
299
319
|
.label('AttachmentReference')
|
|
300
320
|
}).label('UploadAttachment')
|
|
301
321
|
)
|
|
@@ -318,9 +338,8 @@ async function init(args) {
|
|
|
318
338
|
copy: Joi.boolean()
|
|
319
339
|
.allow(null)
|
|
320
340
|
.example(null)
|
|
321
|
-
.description(
|
|
322
|
-
|
|
323
|
-
),
|
|
341
|
+
.description("If set then either copies the message to the Sent Mail folder or not. If not set then uses the account's default setting")
|
|
342
|
+
.meta({ usage: FIELD_USAGE.messageCopy }),
|
|
324
343
|
|
|
325
344
|
sentMailPath: Joi.string()
|
|
326
345
|
.empty('')
|
|
@@ -489,6 +508,8 @@ async function init(args) {
|
|
|
489
508
|
});
|
|
490
509
|
|
|
491
510
|
try {
|
|
511
|
+
assertNoNetworkOverride(request);
|
|
512
|
+
|
|
492
513
|
return await accountObject.queueMessage(request.payload || {}, {
|
|
493
514
|
source: 'api',
|
|
494
515
|
idempotencyKey: request.headers['idempotency-key'],
|
|
@@ -509,6 +530,7 @@ async function init(args) {
|
|
|
509
530
|
|
|
510
531
|
plugins: {
|
|
511
532
|
openapi: {
|
|
533
|
+
'x-ee-impact': IMPACT.SENDS,
|
|
512
534
|
'x-ee-behavior': [BEHAVIOR.QUEUED_DELIVERY, BEHAVIOR.SENT_FOLDER_UPLOAD],
|
|
513
535
|
|
|
514
536
|
// Every property of this payload is an optional override, so a snippet
|
|
@@ -570,16 +592,16 @@ async function init(args) {
|
|
|
570
592
|
to: Joi.array().items(Joi.string().email().required().example('recipient@example.com')).single().label('DraftSmtpEnvelopeTo')
|
|
571
593
|
})
|
|
572
594
|
.description(
|
|
573
|
-
|
|
595
|
+
'An optional object specifying the SMTP envelope used during email transmission. Only used when the message is delivered over SMTP'
|
|
574
596
|
)
|
|
597
|
+
.meta({ usage: FIELD_USAGE.messageEnvelope })
|
|
575
598
|
.label('DraftSMTPEnvelope'),
|
|
576
599
|
|
|
577
600
|
copy: Joi.boolean()
|
|
578
601
|
.allow(null)
|
|
579
602
|
.example(null)
|
|
580
|
-
.description(
|
|
581
|
-
|
|
582
|
-
),
|
|
603
|
+
.description("If set then either copies the message to the Sent Mail folder or not. If not set then uses the account's default setting")
|
|
604
|
+
.meta({ usage: FIELD_USAGE.messageCopy }),
|
|
583
605
|
|
|
584
606
|
sentMailPath: Joi.string()
|
|
585
607
|
.empty('')
|
|
@@ -9,6 +9,7 @@ const { failAction } = require('../tools');
|
|
|
9
9
|
const { handleError, throwNotFound } = require('./route-helpers');
|
|
10
10
|
|
|
11
11
|
const { templateSchemas, accountIdSchema, apiResponses } = require('../schemas');
|
|
12
|
+
const { IMPACT } = require('./operation-impact');
|
|
12
13
|
|
|
13
14
|
// Template owner field shared by all template response schemas
|
|
14
15
|
const templateAccountIdSchema = accountIdSchema.required().allow(null).description('Account ID. Null for public templates');
|
|
@@ -386,6 +387,7 @@ async function init(args) {
|
|
|
386
387
|
|
|
387
388
|
plugins: {
|
|
388
389
|
openapi: {
|
|
390
|
+
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
389
391
|
responses: apiResponses('Returns a deletion marker.', 400, 401, 403, 429, 500)
|
|
390
392
|
}
|
|
391
393
|
},
|
|
@@ -450,6 +452,7 @@ async function init(args) {
|
|
|
450
452
|
|
|
451
453
|
plugins: {
|
|
452
454
|
openapi: {
|
|
455
|
+
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
453
456
|
responses: apiResponses('Returns the number of templates removed.', 400, 401, 403, 404, 429, 500)
|
|
454
457
|
}
|
|
455
458
|
},
|