emailengine-app 2.76.0 → 2.77.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/.github/workflows/release.yaml +24 -19
- package/.ncurc.js +14 -2
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/data/google-crawlers.json +1 -1
- package/encrypt.js +71 -4
- package/lib/address-strategies.js +18 -0
- package/lib/api-reference/code-samples.js +194 -0
- package/lib/api-reference/format.js +179 -0
- package/lib/api-reference/index.js +205 -0
- package/lib/api-reference/model.js +336 -0
- package/lib/api-reference/schema-tree.js +366 -0
- package/lib/api-routes/account-routes.js +117 -37
- package/lib/api-routes/behavior-notes.js +54 -0
- package/lib/api-routes/blocklist-routes.js +9 -9
- package/lib/api-routes/changes-routes.js +6 -4
- package/lib/api-routes/chat-routes.js +3 -3
- package/lib/api-routes/delivery-test-routes.js +24 -6
- package/lib/api-routes/export-routes.js +14 -12
- package/lib/api-routes/gateway-routes.js +11 -11
- package/lib/api-routes/license-routes.js +7 -7
- package/lib/api-routes/mailbox-routes.js +18 -9
- package/lib/api-routes/message-routes.js +55 -35
- package/lib/api-routes/oauth2-app-routes.js +22 -16
- package/lib/api-routes/outbox-routes.js +7 -7
- package/lib/api-routes/pubsub-routes.js +3 -3
- package/lib/api-routes/settings-routes.js +10 -9
- package/lib/api-routes/stats-routes.js +3 -3
- package/lib/api-routes/submit-routes.js +58 -8
- package/lib/api-routes/template-routes.js +13 -13
- package/lib/api-routes/token-routes.js +15 -10
- package/lib/api-routes/webhook-route-routes.js +5 -5
- package/lib/consts.js +7 -0
- package/lib/email-client/base-client.js +66 -12
- package/lib/enum-descriptions.js +130 -0
- package/lib/imapproxy/imap-server.js +30 -26
- package/lib/imapproxy/upstream-client.js +38 -0
- package/lib/oauth2-apps.js +9 -3
- package/lib/openapi/build-document.js +318 -0
- package/lib/openapi/index.js +95 -0
- package/lib/openapi/joi-schema.js +523 -0
- package/lib/routes-ui.js +5 -1
- package/lib/schemas.js +76 -17
- package/lib/swagger-options.js +173 -0
- package/lib/tokens.js +69 -5
- package/lib/ui-routes/admin-entities-routes.js +3 -0
- package/lib/ui-routes/dashboard-routes.js +2 -26
- package/lib/ui-routes/reference-routes.js +195 -0
- package/lib/ui-routes/route-helpers.js +11 -0
- package/package.json +9 -11
- package/prepare-bundle-deps.sh +28 -0
- package/release-please-config.json +11 -0
- package/sbom.json +0 -1
- package/server.js +10 -2
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +90 -0
- package/static/js/ee-client.js +238 -8
- package/static/js/reference.js +736 -0
- package/static/js/ui.js +61 -33
- package/static/licenses.html +4 -4
- package/translations/messages.pot +27 -27
- package/views/config/ai.hbs +1 -1
- package/views/config/document-store/chat.hbs +5 -5
- package/views/config/document-store/index.hbs +2 -2
- package/views/config/document-store/pre-processing/index.hbs +1 -1
- package/views/config/email-processing.hbs +1 -1
- package/views/config/imap-proxy.hbs +1 -1
- package/views/config/license.hbs +1 -1
- package/views/config/oauth/index.hbs +3 -3
- package/views/config/security.hbs +1 -1
- package/views/config/smtp.hbs +2 -2
- package/views/dashboard.hbs +1 -1
- package/views/layout/app.hbs +18 -7
- package/views/partials/oauth_form.hbs +4 -4
- package/views/partials/reference/anchor-link.hbs +20 -0
- package/views/partials/reference/disclosure.hbs +37 -0
- package/views/partials/reference/nav.hbs +93 -0
- package/views/partials/reference/operation.hbs +127 -0
- package/views/partials/reference/params.hbs +20 -0
- package/views/partials/reference/schema-node.hbs +99 -0
- package/views/partials/reference/schema.hbs +19 -0
- package/views/partials/reference/section-heading.hbs +16 -0
- package/views/partials/reference/token-alert.hbs +24 -0
- package/views/partials/reference/try-field.hbs +31 -0
- package/views/partials/reference/try-it.hbs +78 -0
- package/views/partials/side_menu.hbs +1 -1
- package/views/partials/ui/badge.hbs +4 -2
- package/views/partials/ui/page-header.hbs +1 -1
- package/views/partials/ui/search-input.hbs +31 -0
- package/views/partials/ui/setting-ref.hbs +1 -1
- package/views/partials/ui/stat-card.hbs +4 -2
- package/views/partials/ui/tab.hbs +6 -1
- package/views/partials/ui/tabs.hbs +2 -2
- package/views/reference/index.hbs +76 -0
- package/views/reference/redirect.hbs +49 -0
- package/views/reference/tag.hbs +28 -0
- package/views/reference/token.hbs +49 -0
- package/views/tokens/index.hbs +9 -1
- package/views/webhooks/index.hbs +3 -3
- package/workers/api.js +37 -215
- package/views/swagger/index.hbs +0 -82
|
@@ -8,6 +8,7 @@ const Joi = require('joi');
|
|
|
8
8
|
const { failAction } = require('../tools');
|
|
9
9
|
const { COLLAPSE_CLASS } = require('../consts');
|
|
10
10
|
const { handleError } = require('./route-helpers');
|
|
11
|
+
const BEHAVIOR = require('./behavior-notes');
|
|
11
12
|
|
|
12
13
|
const {
|
|
13
14
|
accountIdSchema,
|
|
@@ -23,7 +24,8 @@ const {
|
|
|
23
24
|
messageReferenceSchema,
|
|
24
25
|
emailIdSchema,
|
|
25
26
|
threadIdSchema,
|
|
26
|
-
|
|
27
|
+
apiResponses,
|
|
28
|
+
ENUM_DESCRIPTIONS
|
|
27
29
|
} = require('../schemas');
|
|
28
30
|
|
|
29
31
|
const listMessageFolderPathDescription =
|
|
@@ -82,9 +84,9 @@ async function init(args) {
|
|
|
82
84
|
cors: CORS_CONFIG,
|
|
83
85
|
|
|
84
86
|
plugins: {
|
|
85
|
-
|
|
87
|
+
openapi: {
|
|
86
88
|
produces: ['message/rfc822'],
|
|
87
|
-
responses:
|
|
89
|
+
responses: apiResponses('Returns the raw RFC822 message source.', 400, 401, 403, 404, 429, 500, 503)
|
|
88
90
|
}
|
|
89
91
|
},
|
|
90
92
|
|
|
@@ -131,8 +133,17 @@ async function init(args) {
|
|
|
131
133
|
tags: ['api', 'Message'],
|
|
132
134
|
|
|
133
135
|
plugins: {
|
|
134
|
-
|
|
135
|
-
responses:
|
|
136
|
+
openapi: {
|
|
137
|
+
responses: apiResponses(
|
|
138
|
+
'Returns the message envelope and structure. Text content is only included when requested.',
|
|
139
|
+
400,
|
|
140
|
+
401,
|
|
141
|
+
403,
|
|
142
|
+
404,
|
|
143
|
+
429,
|
|
144
|
+
500,
|
|
145
|
+
503
|
|
146
|
+
)
|
|
136
147
|
}
|
|
137
148
|
},
|
|
138
149
|
|
|
@@ -238,12 +249,13 @@ async function init(args) {
|
|
|
238
249
|
},
|
|
239
250
|
|
|
240
251
|
description: 'Upload message',
|
|
241
|
-
notes: 'Upload a message structure, compile it into an EML file and store it into selected mailbox.',
|
|
252
|
+
notes: ['Upload a message structure, compile it into an EML file and store it into selected mailbox.', BEHAVIOR.UPLOAD_DRAFTS_ONLY_GRAPH],
|
|
242
253
|
tags: ['api', 'Message'],
|
|
243
254
|
|
|
244
255
|
plugins: {
|
|
245
|
-
|
|
246
|
-
|
|
256
|
+
openapi: {
|
|
257
|
+
'x-ee-behavior': [BEHAVIOR.UPLOAD_DRAFTS_ONLY_GRAPH],
|
|
258
|
+
responses: apiResponses('Returns the uploaded message with the identifiers the provider assigned to it.', 400, 401, 403, 404, 429, 500, 503)
|
|
247
259
|
}
|
|
248
260
|
},
|
|
249
261
|
|
|
@@ -322,7 +334,11 @@ async function init(args) {
|
|
|
322
334
|
}),
|
|
323
335
|
|
|
324
336
|
contentType: Joi.string().lowercase().max(256).example('image/gif'),
|
|
325
|
-
contentDisposition: Joi.string()
|
|
337
|
+
contentDisposition: Joi.string()
|
|
338
|
+
.lowercase()
|
|
339
|
+
.valid('inline', 'attachment')
|
|
340
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.messageUploadDisposition })
|
|
341
|
+
.label('MsgUploadContentDisposition'),
|
|
326
342
|
cid: Joi.string().max(256).example('unique-image-id@localhost').description('Content-ID value for embedded images'),
|
|
327
343
|
encoding: Joi.string().valid('base64').default('base64').label('MsgUploadEncoding'),
|
|
328
344
|
|
|
@@ -408,12 +424,13 @@ async function init(args) {
|
|
|
408
424
|
},
|
|
409
425
|
options: {
|
|
410
426
|
description: 'Update message',
|
|
411
|
-
notes: 'Update message information. Mainly this means changing message flag values',
|
|
427
|
+
notes: ['Update message information. Mainly this means changing message flag values', BEHAVIOR.NO_LABEL_SET_ON_GMAIL],
|
|
412
428
|
tags: ['api', 'Message'],
|
|
413
429
|
|
|
414
430
|
plugins: {
|
|
415
|
-
|
|
416
|
-
|
|
431
|
+
openapi: {
|
|
432
|
+
'x-ee-behavior': [BEHAVIOR.NO_LABEL_SET_ON_GMAIL],
|
|
433
|
+
responses: apiResponses('Returns which flag and label changes were applied.', 400, 401, 403, 404, 429, 500, 503)
|
|
417
434
|
}
|
|
418
435
|
},
|
|
419
436
|
|
|
@@ -488,12 +505,13 @@ async function init(args) {
|
|
|
488
505
|
},
|
|
489
506
|
options: {
|
|
490
507
|
description: 'Update messages',
|
|
491
|
-
notes: 'Update message information for matching emails',
|
|
508
|
+
notes: ['Update message information for matching emails', BEHAVIOR.NO_LABEL_SET_ON_GMAIL],
|
|
492
509
|
tags: ['api', 'Multi Message Actions'],
|
|
493
510
|
|
|
494
511
|
plugins: {
|
|
495
|
-
|
|
496
|
-
|
|
512
|
+
openapi: {
|
|
513
|
+
'x-ee-behavior': [BEHAVIOR.NO_LABEL_SET_ON_GMAIL],
|
|
514
|
+
responses: apiResponses('Returns which flag and label changes were applied to the matching messages.', 400, 401, 403, 404, 429, 500, 503)
|
|
497
515
|
}
|
|
498
516
|
},
|
|
499
517
|
|
|
@@ -576,8 +594,8 @@ async function init(args) {
|
|
|
576
594
|
tags: ['api', 'Message'],
|
|
577
595
|
|
|
578
596
|
plugins: {
|
|
579
|
-
|
|
580
|
-
responses:
|
|
597
|
+
openapi: {
|
|
598
|
+
responses: apiResponses('Returns the message identifiers in the target folder.', 400, 401, 403, 404, 429, 500, 503)
|
|
581
599
|
}
|
|
582
600
|
},
|
|
583
601
|
|
|
@@ -650,8 +668,8 @@ async function init(args) {
|
|
|
650
668
|
tags: ['api', 'Multi Message Actions'],
|
|
651
669
|
|
|
652
670
|
plugins: {
|
|
653
|
-
|
|
654
|
-
responses:
|
|
671
|
+
openapi: {
|
|
672
|
+
responses: apiResponses('Returns the number of messages moved.', 400, 401, 403, 404, 429, 500, 503)
|
|
655
673
|
}
|
|
656
674
|
},
|
|
657
675
|
|
|
@@ -724,12 +742,13 @@ async function init(args) {
|
|
|
724
742
|
},
|
|
725
743
|
options: {
|
|
726
744
|
description: 'Delete message',
|
|
727
|
-
notes: 'Move message to Trash or delete it if already in Trash',
|
|
745
|
+
notes: ['Move message to Trash or delete it if already in Trash', BEHAVIOR.GMAIL_DELETE_IS_TRASH],
|
|
728
746
|
tags: ['api', 'Message'],
|
|
729
747
|
|
|
730
748
|
plugins: {
|
|
731
|
-
|
|
732
|
-
|
|
749
|
+
openapi: {
|
|
750
|
+
'x-ee-behavior': [BEHAVIOR.GMAIL_DELETE_IS_TRASH],
|
|
751
|
+
responses: apiResponses('Returns whether the message was moved to Trash or permanently deleted.', 400, 401, 403, 404, 429, 500, 503)
|
|
733
752
|
}
|
|
734
753
|
},
|
|
735
754
|
|
|
@@ -808,12 +827,13 @@ async function init(args) {
|
|
|
808
827
|
},
|
|
809
828
|
options: {
|
|
810
829
|
description: 'Delete messages',
|
|
811
|
-
notes: 'Move messages to Trash or delete these if already in Trash',
|
|
830
|
+
notes: ['Move messages to Trash or delete these if already in Trash', BEHAVIOR.GMAIL_DELETE_IS_TRASH],
|
|
812
831
|
tags: ['api', 'Multi Message Actions'],
|
|
813
832
|
|
|
814
833
|
plugins: {
|
|
815
|
-
|
|
816
|
-
|
|
834
|
+
openapi: {
|
|
835
|
+
'x-ee-behavior': [BEHAVIOR.GMAIL_DELETE_IS_TRASH],
|
|
836
|
+
responses: apiResponses('Returns the number of messages deleted.', 400, 401, 403, 404, 429, 500, 503)
|
|
817
837
|
}
|
|
818
838
|
},
|
|
819
839
|
|
|
@@ -912,8 +932,8 @@ async function init(args) {
|
|
|
912
932
|
tags: ['api', 'Message'],
|
|
913
933
|
|
|
914
934
|
plugins: {
|
|
915
|
-
|
|
916
|
-
responses:
|
|
935
|
+
openapi: {
|
|
936
|
+
responses: apiResponses('Returns a page of messages from the folder, newest first.', 400, 401, 403, 404, 429, 500, 503)
|
|
917
937
|
}
|
|
918
938
|
},
|
|
919
939
|
|
|
@@ -1017,8 +1037,8 @@ async function init(args) {
|
|
|
1017
1037
|
tags: ['api', 'Message'],
|
|
1018
1038
|
|
|
1019
1039
|
plugins: {
|
|
1020
|
-
|
|
1021
|
-
responses:
|
|
1040
|
+
openapi: {
|
|
1041
|
+
responses: apiResponses('Returns a page of matching messages, newest first.', 400, 401, 403, 404, 422, 429, 500, 503)
|
|
1022
1042
|
}
|
|
1023
1043
|
},
|
|
1024
1044
|
|
|
@@ -1184,8 +1204,8 @@ async function init(args) {
|
|
|
1184
1204
|
tags: ['api', 'Deprecated endpoints (Document Store)'],
|
|
1185
1205
|
|
|
1186
1206
|
plugins: {
|
|
1187
|
-
|
|
1188
|
-
responses:
|
|
1207
|
+
openapi: {
|
|
1208
|
+
responses: apiResponses('Returns matching messages across all indexed accounts.', 400, 401, 403, 429, 500)
|
|
1189
1209
|
}
|
|
1190
1210
|
},
|
|
1191
1211
|
|
|
@@ -1299,8 +1319,8 @@ async function init(args) {
|
|
|
1299
1319
|
tags: ['api', 'Message'],
|
|
1300
1320
|
|
|
1301
1321
|
plugins: {
|
|
1302
|
-
|
|
1303
|
-
responses:
|
|
1322
|
+
openapi: {
|
|
1323
|
+
responses: apiResponses('Returns the message text content in the requested formats.', 400, 401, 403, 404, 429, 500, 503)
|
|
1304
1324
|
}
|
|
1305
1325
|
},
|
|
1306
1326
|
|
|
@@ -1391,9 +1411,9 @@ async function init(args) {
|
|
|
1391
1411
|
cors: CORS_CONFIG,
|
|
1392
1412
|
|
|
1393
1413
|
plugins: {
|
|
1394
|
-
|
|
1414
|
+
openapi: {
|
|
1395
1415
|
produces: ['application/octet-stream'],
|
|
1396
|
-
responses:
|
|
1416
|
+
responses: apiResponses('Returns the attachment content as a binary stream.', 400, 401, 403, 404, 429, 500, 503)
|
|
1397
1417
|
}
|
|
1398
1418
|
},
|
|
1399
1419
|
|
|
@@ -12,9 +12,11 @@ const {
|
|
|
12
12
|
googleWorkspaceAccountsSchema,
|
|
13
13
|
googleTopicNameSchema,
|
|
14
14
|
googleSubscriptionNameSchema,
|
|
15
|
-
|
|
15
|
+
apiResponses,
|
|
16
|
+
ENUM_DESCRIPTIONS
|
|
16
17
|
} = require('../schemas');
|
|
17
18
|
const { handleError, throwNotFound, flattenOAuthAppMeta } = require('./route-helpers');
|
|
19
|
+
const { ENCRYPTED_APP_KEYS } = require('../consts');
|
|
18
20
|
|
|
19
21
|
// Stored fields that are returned on OAuth2 application objects in addition to the basic fields
|
|
20
22
|
const oauth2AppExtraFields = {
|
|
@@ -26,7 +28,10 @@ const oauth2AppExtraFields = {
|
|
|
26
28
|
.items(Joi.string().example('SMTP.Send').label('SkipScopeEntry'))
|
|
27
29
|
.description('OAuth2 scopes excluded from the defaults for this app')
|
|
28
30
|
.label('AppSkipScopes'),
|
|
29
|
-
baseScopes: oauthCreateSchema.baseScopes
|
|
31
|
+
baseScopes: oauthCreateSchema.baseScopes
|
|
32
|
+
.description('OAuth2 base scopes for this app')
|
|
33
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.appBaseScopes })
|
|
34
|
+
.label('AppBaseScopes'),
|
|
30
35
|
pubSubApp: oauthCreateSchema.pubSubApp.description('Cloud Pub/Sub app ID used for Gmail change notifications').label('AppPubSubApp'),
|
|
31
36
|
authMethod: Joi.string().example('serviceKey').description('Authentication method for Gmail service accounts'),
|
|
32
37
|
cloud: Joi.string().example('global').description('Azure cloud type for Outlook OAuth2 applications'),
|
|
@@ -66,7 +71,7 @@ async function init(args) {
|
|
|
66
71
|
let response = await oauth2Apps.list(request.query.page, request.query.pageSize);
|
|
67
72
|
|
|
68
73
|
for (let app of response.apps) {
|
|
69
|
-
for (let secretKey of
|
|
74
|
+
for (let secretKey of ENCRYPTED_APP_KEYS) {
|
|
70
75
|
if (app[secretKey]) {
|
|
71
76
|
app[secretKey] = '******';
|
|
72
77
|
}
|
|
@@ -95,8 +100,8 @@ async function init(args) {
|
|
|
95
100
|
tags: ['api', 'OAuth2 Applications'],
|
|
96
101
|
|
|
97
102
|
plugins: {
|
|
98
|
-
|
|
99
|
-
responses:
|
|
103
|
+
openapi: {
|
|
104
|
+
responses: apiResponses('Returns a page of OAuth2 applications.', 400, 401, 403, 429, 500)
|
|
100
105
|
}
|
|
101
106
|
},
|
|
102
107
|
|
|
@@ -224,7 +229,7 @@ async function init(args) {
|
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
// remove secrets
|
|
227
|
-
for (let secretKey of
|
|
232
|
+
for (let secretKey of ENCRYPTED_APP_KEYS) {
|
|
228
233
|
if (app[secretKey]) {
|
|
229
234
|
app[secretKey] = '******';
|
|
230
235
|
}
|
|
@@ -251,8 +256,8 @@ async function init(args) {
|
|
|
251
256
|
tags: ['api', 'OAuth2 Applications'],
|
|
252
257
|
|
|
253
258
|
plugins: {
|
|
254
|
-
|
|
255
|
-
responses:
|
|
259
|
+
openapi: {
|
|
260
|
+
responses: apiResponses('Returns the OAuth2 application. Client secrets are masked.', 400, 401, 403, 404, 429, 500)
|
|
256
261
|
}
|
|
257
262
|
},
|
|
258
263
|
|
|
@@ -369,8 +374,8 @@ async function init(args) {
|
|
|
369
374
|
tags: ['api', 'OAuth2 Applications'],
|
|
370
375
|
|
|
371
376
|
plugins: {
|
|
372
|
-
|
|
373
|
-
responses:
|
|
377
|
+
openapi: {
|
|
378
|
+
responses: apiResponses('Returns the registered OAuth2 application.', 400, 401, 403, 429, 500)
|
|
374
379
|
}
|
|
375
380
|
},
|
|
376
381
|
|
|
@@ -419,8 +424,8 @@ async function init(args) {
|
|
|
419
424
|
tags: ['api', 'OAuth2 Applications'],
|
|
420
425
|
|
|
421
426
|
plugins: {
|
|
422
|
-
|
|
423
|
-
responses:
|
|
427
|
+
openapi: {
|
|
428
|
+
responses: apiResponses('Returns the updated OAuth2 application.', 400, 401, 403, 404, 429, 500)
|
|
424
429
|
}
|
|
425
430
|
},
|
|
426
431
|
|
|
@@ -521,6 +526,7 @@ async function init(args) {
|
|
|
521
526
|
.valid('global', 'gcc-high', 'dod', 'china')
|
|
522
527
|
.example('global')
|
|
523
528
|
.description('Azure cloud type for Outlook OAuth2 applications')
|
|
529
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.azureCloud })
|
|
524
530
|
.label('AzureCloud'),
|
|
525
531
|
|
|
526
532
|
tenant: Joi.string().trim().empty('').max(1024).example('f8cdef31-a31e-4b4a-93e4-5f571e91255a').label('Directorytenant'),
|
|
@@ -570,8 +576,8 @@ async function init(args) {
|
|
|
570
576
|
tags: ['api', 'OAuth2 Applications'],
|
|
571
577
|
|
|
572
578
|
plugins: {
|
|
573
|
-
|
|
574
|
-
responses:
|
|
579
|
+
openapi: {
|
|
580
|
+
responses: apiResponses('Returns a deletion marker.', 400, 401, 403, 404, 429, 500)
|
|
575
581
|
}
|
|
576
582
|
},
|
|
577
583
|
|
|
@@ -629,8 +635,8 @@ async function init(args) {
|
|
|
629
635
|
tags: ['api', 'OAuth2 Applications'],
|
|
630
636
|
|
|
631
637
|
plugins: {
|
|
632
|
-
|
|
633
|
-
responses:
|
|
638
|
+
openapi: {
|
|
639
|
+
responses: apiResponses('Returns the outcome of the credential check against the provider.', 400, 401, 403, 404, 429, 500)
|
|
634
640
|
}
|
|
635
641
|
},
|
|
636
642
|
|
|
@@ -6,7 +6,7 @@ const logger = require('../logger');
|
|
|
6
6
|
const outbox = require('../outbox');
|
|
7
7
|
const { failAction } = require('../tools');
|
|
8
8
|
const { handleError } = require('./route-helpers');
|
|
9
|
-
const { outboxEntrySchema,
|
|
9
|
+
const { outboxEntrySchema, apiResponses } = require('../schemas');
|
|
10
10
|
|
|
11
11
|
async function init(args) {
|
|
12
12
|
const { server, CORS_CONFIG } = args;
|
|
@@ -29,8 +29,8 @@ async function init(args) {
|
|
|
29
29
|
tags: ['api', 'Outbox'],
|
|
30
30
|
|
|
31
31
|
plugins: {
|
|
32
|
-
|
|
33
|
-
responses:
|
|
32
|
+
openapi: {
|
|
33
|
+
responses: apiResponses('Returns the messages currently queued for delivery.', 400, 401, 403, 429, 500)
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
|
|
@@ -98,8 +98,8 @@ async function init(args) {
|
|
|
98
98
|
tags: ['api', 'Outbox'],
|
|
99
99
|
|
|
100
100
|
plugins: {
|
|
101
|
-
|
|
102
|
-
responses:
|
|
101
|
+
openapi: {
|
|
102
|
+
responses: apiResponses('Returns the queued message, including its delivery attempts and last error.', 400, 401, 403, 404, 429, 500)
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
|
|
@@ -148,8 +148,8 @@ async function init(args) {
|
|
|
148
148
|
tags: ['api', 'Outbox'],
|
|
149
149
|
|
|
150
150
|
plugins: {
|
|
151
|
-
|
|
152
|
-
responses:
|
|
151
|
+
openapi: {
|
|
152
|
+
responses: apiResponses('Returns a deletion marker. A message already being delivered cannot be removed.', 400, 401, 403, 429, 500)
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
4
|
const { failAction } = require('../tools');
|
|
5
5
|
const { oauth2Apps } = require('../oauth2-apps');
|
|
6
|
-
const { pubSubErrorSchema,
|
|
6
|
+
const { pubSubErrorSchema, apiResponses } = require('../schemas');
|
|
7
7
|
const { handleError, flattenOAuthAppMeta } = require('./route-helpers');
|
|
8
8
|
|
|
9
9
|
async function init(args) {
|
|
@@ -39,8 +39,8 @@ async function init(args) {
|
|
|
39
39
|
tags: ['api', 'OAuth2 Applications'],
|
|
40
40
|
|
|
41
41
|
plugins: {
|
|
42
|
-
|
|
43
|
-
responses:
|
|
42
|
+
openapi: {
|
|
43
|
+
responses: apiResponses('Returns the Pub/Sub subscription state for each configured Gmail application.', 400, 401, 403, 429, 500)
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
|
|
@@ -7,7 +7,7 @@ const consts = require('../consts');
|
|
|
7
7
|
const { REDIS_PREFIX } = consts;
|
|
8
8
|
const { failAction } = require('../tools');
|
|
9
9
|
const { handleError } = require('./route-helpers');
|
|
10
|
-
const { settingsSchema, settingsQuerySchema,
|
|
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,
|
|
13
13
|
// any setting that has never been set is returned as null, and the virtual eventTypes key is
|
|
@@ -67,8 +67,8 @@ async function init(args) {
|
|
|
67
67
|
tags: ['api', 'Settings'],
|
|
68
68
|
|
|
69
69
|
plugins: {
|
|
70
|
-
|
|
71
|
-
responses:
|
|
70
|
+
openapi: {
|
|
71
|
+
responses: apiResponses('Returns the values of the settings requested via query arguments. Secrets are masked.', 400, 401, 403, 429, 500)
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
|
|
@@ -123,8 +123,8 @@ async function init(args) {
|
|
|
123
123
|
tags: ['api', 'Settings'],
|
|
124
124
|
|
|
125
125
|
plugins: {
|
|
126
|
-
|
|
127
|
-
responses:
|
|
126
|
+
openapi: {
|
|
127
|
+
responses: apiResponses('Returns the list of setting keys that were updated.', 400, 401, 403, 429, 500)
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
|
|
@@ -201,8 +201,8 @@ async function init(args) {
|
|
|
201
201
|
tags: ['api', 'Settings'],
|
|
202
202
|
|
|
203
203
|
plugins: {
|
|
204
|
-
|
|
205
|
-
responses:
|
|
204
|
+
openapi: {
|
|
205
|
+
responses: apiResponses('Returns the job counts and paused state for the queue.', 400, 401, 403, 429, 500)
|
|
206
206
|
}
|
|
207
207
|
},
|
|
208
208
|
|
|
@@ -241,6 +241,7 @@ async function init(args) {
|
|
|
241
241
|
.required()
|
|
242
242
|
.example('notify')
|
|
243
243
|
.description('Queue ID')
|
|
244
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.queueId })
|
|
244
245
|
.label('QueueIdResponse'),
|
|
245
246
|
jobs: Joi.object({
|
|
246
247
|
active: Joi.number().integer().example(123).description('Jobs that are currently being processed'),
|
|
@@ -301,8 +302,8 @@ async function init(args) {
|
|
|
301
302
|
tags: ['api', 'Settings'],
|
|
302
303
|
|
|
303
304
|
plugins: {
|
|
304
|
-
|
|
305
|
-
responses:
|
|
305
|
+
openapi: {
|
|
306
|
+
responses: apiResponses('Returns the queue state after the change.', 400, 401, 403, 429, 500)
|
|
306
307
|
}
|
|
307
308
|
},
|
|
308
309
|
|
|
@@ -4,7 +4,7 @@ const Joi = require('joi');
|
|
|
4
4
|
const { redis } = require('../db');
|
|
5
5
|
const { failAction, getStats } = require('../tools');
|
|
6
6
|
const { MAX_DAYS_STATS } = require('../consts');
|
|
7
|
-
const {
|
|
7
|
+
const { apiResponses } = require('../schemas');
|
|
8
8
|
const packageData = require('../../package.json');
|
|
9
9
|
|
|
10
10
|
async function init(args) {
|
|
@@ -23,8 +23,8 @@ async function init(args) {
|
|
|
23
23
|
tags: ['api', 'Stats'],
|
|
24
24
|
|
|
25
25
|
plugins: {
|
|
26
|
-
|
|
27
|
-
responses:
|
|
26
|
+
openapi: {
|
|
27
|
+
responses: apiResponses('Returns counters, connection states and process information for this instance.', 400, 401, 403, 429, 500)
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
|
|
@@ -6,6 +6,7 @@ const { Account } = require('../account');
|
|
|
6
6
|
const getSecret = require('../get-secret');
|
|
7
7
|
const { failAction } = require('../tools');
|
|
8
8
|
const { handleError } = require('./route-helpers');
|
|
9
|
+
const BEHAVIOR = require('./behavior-notes');
|
|
9
10
|
const {
|
|
10
11
|
messageReferenceSchema,
|
|
11
12
|
fromAddressSchema,
|
|
@@ -17,7 +18,8 @@ const {
|
|
|
17
18
|
settingsSchema,
|
|
18
19
|
ipSchema,
|
|
19
20
|
threadIdSchema,
|
|
20
|
-
|
|
21
|
+
apiResponses,
|
|
22
|
+
ENUM_DESCRIPTIONS
|
|
21
23
|
} = require('../schemas');
|
|
22
24
|
|
|
23
25
|
// Schema fragments shared between the message submit and the draft submit routes. Joi schemas
|
|
@@ -44,7 +46,7 @@ const dsnSchema = Joi.object({
|
|
|
44
46
|
.label('DsnReturn'),
|
|
45
47
|
notify: Joi.array()
|
|
46
48
|
.single()
|
|
47
|
-
.items(Joi.string().valid('never', 'success', 'failure', 'delay').label('NotifyEntry'))
|
|
49
|
+
.items(Joi.string().valid('never', 'success', 'failure', 'delay').meta({ enumDescriptions: ENUM_DESCRIPTIONS.dsnNotify }).label('NotifyEntry'))
|
|
48
50
|
.description('Defines the conditions under which a DSN response should be sent')
|
|
49
51
|
.label('DsnNotify'),
|
|
50
52
|
recipient: Joi.string().trim().empty('').email().description('The email address the DSN should be sent (ORCPT)')
|
|
@@ -97,12 +99,26 @@ async function init(args) {
|
|
|
97
99
|
},
|
|
98
100
|
|
|
99
101
|
description: 'Submit message for delivery',
|
|
100
|
-
notes:
|
|
102
|
+
notes: [
|
|
103
|
+
'Submit message for delivery. If reference message ID is provided then EmailEngine adds all headers and flags required for a reply/forward automatically.',
|
|
104
|
+
BEHAVIOR.QUEUED_DELIVERY,
|
|
105
|
+
BEHAVIOR.SENT_FOLDER_UPLOAD
|
|
106
|
+
],
|
|
101
107
|
tags: ['api', 'Submit'],
|
|
102
108
|
|
|
103
109
|
plugins: {
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
openapi: {
|
|
111
|
+
'x-ee-behavior': [BEHAVIOR.QUEUED_DELIVERY, BEHAVIOR.SENT_FOLDER_UPLOAD],
|
|
112
|
+
responses: apiResponses(
|
|
113
|
+
'Returns the queue ID the message was accepted under. Delivery happens asynchronously - a 200 means queued, not sent.',
|
|
114
|
+
400,
|
|
115
|
+
401,
|
|
116
|
+
403,
|
|
117
|
+
404,
|
|
118
|
+
429,
|
|
119
|
+
500,
|
|
120
|
+
503
|
|
121
|
+
)
|
|
106
122
|
}
|
|
107
123
|
},
|
|
108
124
|
|
|
@@ -484,12 +500,46 @@ async function init(args) {
|
|
|
484
500
|
},
|
|
485
501
|
options: {
|
|
486
502
|
description: 'Submit a stored draft for delivery',
|
|
487
|
-
notes:
|
|
503
|
+
notes: [
|
|
504
|
+
'Sends an existing draft message. The message must be a draft: stored in the Drafts folder or flagged as a draft (IMAP), carrying the DRAFT label (Gmail), or a draft message (MS Graph). Gmail and MS Graph accounts use the native draft-send call of the provider, which also files the message into the Sent Mail folder and removes the draft. For IMAP accounts the draft is downloaded, sent over SMTP, copied to the Sent Mail folder (unless disabled), and then removed from the Drafts folder.',
|
|
505
|
+
BEHAVIOR.QUEUED_DELIVERY,
|
|
506
|
+
BEHAVIOR.SENT_FOLDER_UPLOAD
|
|
507
|
+
],
|
|
488
508
|
tags: ['api', 'Submit'],
|
|
489
509
|
|
|
490
510
|
plugins: {
|
|
491
|
-
|
|
492
|
-
|
|
511
|
+
openapi: {
|
|
512
|
+
'x-ee-behavior': [BEHAVIOR.QUEUED_DELIVERY, BEHAVIOR.SENT_FOLDER_UPLOAD],
|
|
513
|
+
|
|
514
|
+
// Every property of this payload is an optional override, so a snippet
|
|
515
|
+
// synthesized from the schema shows an envelope, a DSN block and a proxy
|
|
516
|
+
// as if they were the request. The draft already carries its recipients
|
|
517
|
+
// and content; the call that matters is the empty one. Hand-written
|
|
518
|
+
// samples lead the tab strip on the reference page and reach every other
|
|
519
|
+
// consumer of /swagger.json through the standard extension.
|
|
520
|
+
'x-codeSamples': [
|
|
521
|
+
{
|
|
522
|
+
lang: 'bash',
|
|
523
|
+
label: 'Minimal',
|
|
524
|
+
source: [
|
|
525
|
+
`curl -X POST "$EMAILENGINE_URL/v1/account/example/message/AAAAAQAACnA/submit" \\`,
|
|
526
|
+
` -H "Authorization: Bearer $EMAILENGINE_TOKEN" \\`,
|
|
527
|
+
` -H "Content-Type: application/json" \\`,
|
|
528
|
+
` -d '{}'`
|
|
529
|
+
].join('\n')
|
|
530
|
+
}
|
|
531
|
+
],
|
|
532
|
+
|
|
533
|
+
responses: apiResponses(
|
|
534
|
+
'Returns the queue ID the stored draft was accepted under. Delivery happens asynchronously - a 200 means queued, not sent.',
|
|
535
|
+
400,
|
|
536
|
+
401,
|
|
537
|
+
403,
|
|
538
|
+
404,
|
|
539
|
+
429,
|
|
540
|
+
500,
|
|
541
|
+
503
|
|
542
|
+
)
|
|
493
543
|
}
|
|
494
544
|
},
|
|
495
545
|
|
|
@@ -8,7 +8,7 @@ const Joi = require('joi');
|
|
|
8
8
|
const { failAction } = require('../tools');
|
|
9
9
|
const { handleError, throwNotFound } = require('./route-helpers');
|
|
10
10
|
|
|
11
|
-
const { templateSchemas, accountIdSchema,
|
|
11
|
+
const { templateSchemas, accountIdSchema, apiResponses } = require('../schemas');
|
|
12
12
|
|
|
13
13
|
// Template owner field shared by all template response schemas
|
|
14
14
|
const templateAccountIdSchema = accountIdSchema.required().allow(null).description('Account ID. Null for public templates');
|
|
@@ -56,8 +56,8 @@ async function init(args) {
|
|
|
56
56
|
tags: ['api', 'Templates'],
|
|
57
57
|
|
|
58
58
|
plugins: {
|
|
59
|
-
|
|
60
|
-
responses:
|
|
59
|
+
openapi: {
|
|
60
|
+
responses: apiResponses('Returns the created template.', 400, 401, 403, 404, 429, 500)
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
|
|
@@ -144,8 +144,8 @@ async function init(args) {
|
|
|
144
144
|
tags: ['api', 'Templates'],
|
|
145
145
|
|
|
146
146
|
plugins: {
|
|
147
|
-
|
|
148
|
-
responses:
|
|
147
|
+
openapi: {
|
|
148
|
+
responses: apiResponses('Returns the updated template.', 400, 401, 403, 404, 429, 500)
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
|
|
@@ -225,8 +225,8 @@ async function init(args) {
|
|
|
225
225
|
tags: ['api', 'Templates'],
|
|
226
226
|
|
|
227
227
|
plugins: {
|
|
228
|
-
|
|
229
|
-
responses:
|
|
228
|
+
openapi: {
|
|
229
|
+
responses: apiResponses('Returns a page of stored templates for the account.', 400, 401, 403, 404, 429, 500)
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
232
|
|
|
@@ -315,8 +315,8 @@ async function init(args) {
|
|
|
315
315
|
tags: ['api', 'Templates'],
|
|
316
316
|
|
|
317
317
|
plugins: {
|
|
318
|
-
|
|
319
|
-
responses:
|
|
318
|
+
openapi: {
|
|
319
|
+
responses: apiResponses('Returns the template, including its content.', 400, 401, 403, 404, 429, 500)
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
322
|
|
|
@@ -385,8 +385,8 @@ async function init(args) {
|
|
|
385
385
|
tags: ['api', 'Templates'],
|
|
386
386
|
|
|
387
387
|
plugins: {
|
|
388
|
-
|
|
389
|
-
responses:
|
|
388
|
+
openapi: {
|
|
389
|
+
responses: apiResponses('Returns a deletion marker.', 400, 401, 403, 429, 500)
|
|
390
390
|
}
|
|
391
391
|
},
|
|
392
392
|
|
|
@@ -449,8 +449,8 @@ async function init(args) {
|
|
|
449
449
|
tags: ['api', 'Templates'],
|
|
450
450
|
|
|
451
451
|
plugins: {
|
|
452
|
-
|
|
453
|
-
responses:
|
|
452
|
+
openapi: {
|
|
453
|
+
responses: apiResponses('Returns the number of templates removed.', 400, 401, 403, 404, 429, 500)
|
|
454
454
|
}
|
|
455
455
|
},
|
|
456
456
|
|