imapkit 4.0.3 → 4.1.1
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/README.md +32 -19
- package/bin/imapkit.js +12 -16
- package/dist/cjs/addressparser.d.ts +21 -0
- package/dist/cjs/addressparser.js +271 -0
- package/dist/cjs/arguments.d.ts +31 -0
- package/{lib → dist/cjs}/arguments.js +9 -21
- package/dist/cjs/bodystructure.d.ts +25 -0
- package/dist/cjs/bodystructure.js +150 -0
- package/dist/cjs/cert.d.ts +2 -0
- package/dist/cjs/cert.js +7 -0
- package/dist/cjs/command-states.d.ts +36 -0
- package/dist/cjs/command-states.js +102 -0
- package/dist/cjs/commands/append.d.ts +88 -0
- package/dist/cjs/commands/append.js +299 -0
- package/dist/cjs/commands/capability.d.ts +2 -0
- package/dist/cjs/commands/capability.js +44 -0
- package/dist/cjs/commands/check.d.ts +2 -0
- package/dist/cjs/commands/check.js +28 -0
- package/dist/cjs/commands/close.d.ts +2 -0
- package/dist/cjs/commands/close.js +35 -0
- package/dist/cjs/commands/copy.d.ts +30 -0
- package/dist/cjs/commands/copy.js +107 -0
- package/dist/cjs/commands/create.d.ts +2 -0
- package/dist/cjs/commands/create.js +53 -0
- package/dist/cjs/commands/delete.d.ts +2 -0
- package/dist/cjs/commands/delete.js +63 -0
- package/dist/cjs/commands/examine.d.ts +2 -0
- package/dist/cjs/commands/examine.js +19 -0
- package/dist/cjs/commands/expunge.d.ts +2 -0
- package/dist/cjs/commands/expunge.js +32 -0
- package/dist/cjs/commands/fetch.d.ts +23 -0
- package/dist/cjs/commands/fetch.js +208 -0
- package/dist/cjs/commands/handlers/fetch.d.ts +12 -0
- package/dist/cjs/commands/handlers/fetch.js +195 -0
- package/dist/cjs/commands/handlers/flags.d.ts +17 -0
- package/dist/cjs/commands/handlers/flags.js +39 -0
- package/dist/cjs/commands/handlers/search.d.ts +85 -0
- package/dist/cjs/commands/handlers/search.js +504 -0
- package/dist/cjs/commands/handlers/status.d.ts +34 -0
- package/dist/cjs/commands/handlers/status.js +81 -0
- package/dist/cjs/commands/handlers/store.d.ts +3 -0
- package/dist/cjs/commands/handlers/store.js +117 -0
- package/dist/cjs/commands/index.d.ts +2 -0
- package/dist/cjs/commands/index.js +61 -0
- package/dist/cjs/commands/list.d.ts +2 -0
- package/dist/cjs/commands/list.js +86 -0
- package/dist/cjs/commands/login.d.ts +2 -0
- package/dist/cjs/commands/login.js +62 -0
- package/dist/cjs/commands/logout.d.ts +2 -0
- package/dist/cjs/commands/logout.js +40 -0
- package/dist/cjs/commands/lsub.d.ts +2 -0
- package/dist/cjs/commands/lsub.js +79 -0
- package/dist/cjs/commands/noop.d.ts +2 -0
- package/dist/cjs/commands/noop.js +28 -0
- package/dist/cjs/commands/rename.d.ts +2 -0
- package/dist/cjs/commands/rename.js +98 -0
- package/dist/cjs/commands/search.d.ts +10 -0
- package/dist/cjs/commands/search.js +71 -0
- package/dist/cjs/commands/select.d.ts +19 -0
- package/dist/cjs/commands/select.js +230 -0
- package/dist/cjs/commands/status.d.ts +2 -0
- package/dist/cjs/commands/status.js +57 -0
- package/dist/cjs/commands/store.d.ts +10 -0
- package/dist/cjs/commands/store.js +134 -0
- package/dist/cjs/commands/subscribe.d.ts +2 -0
- package/dist/cjs/commands/subscribe.js +51 -0
- package/dist/cjs/commands/uid-copy.d.ts +2 -0
- package/dist/cjs/commands/uid-copy.js +19 -0
- package/dist/cjs/commands/uid-fetch.d.ts +3 -0
- package/dist/cjs/commands/uid-fetch.js +17 -0
- package/dist/cjs/commands/uid-search.d.ts +3 -0
- package/dist/cjs/commands/uid-search.js +17 -0
- package/dist/cjs/commands/uid-store.d.ts +3 -0
- package/dist/cjs/commands/uid-store.js +17 -0
- package/dist/cjs/commands/unsubscribe.d.ts +2 -0
- package/dist/cjs/commands/unsubscribe.js +50 -0
- package/dist/cjs/dates.d.ts +64 -0
- package/dist/cjs/dates.js +124 -0
- package/dist/cjs/deflate-layer.d.ts +83 -0
- package/dist/cjs/deflate-layer.js +232 -0
- package/dist/cjs/encoded-words.d.ts +15 -0
- package/dist/cjs/encoded-words.js +85 -0
- package/dist/cjs/envelope.d.ts +33 -0
- package/dist/cjs/envelope.js +86 -0
- package/dist/cjs/esearch.d.ts +96 -0
- package/dist/cjs/esearch.js +190 -0
- package/dist/cjs/framing.d.ts +66 -0
- package/{lib → dist/cjs}/framing.js +9 -26
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +56 -0
- package/dist/cjs/list-extensions.d.ts +50 -0
- package/dist/cjs/list-extensions.js +35 -0
- package/dist/cjs/load-plugins.d.ts +21 -0
- package/dist/cjs/load-plugins.js +89 -0
- package/dist/cjs/mailbox-name.d.ts +26 -0
- package/dist/cjs/mailbox-name.js +127 -0
- package/dist/cjs/mimeparser.d.ts +137 -0
- package/dist/cjs/mimeparser.js +727 -0
- package/dist/cjs/mock-client.d.ts +39 -0
- package/dist/cjs/mock-client.js +236 -0
- package/dist/cjs/numbers.d.ts +28 -0
- package/dist/cjs/numbers.js +52 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/plugins/acl.d.ts +2 -0
- package/dist/cjs/plugins/acl.js +888 -0
- package/dist/cjs/plugins/appendlimit.d.ts +16 -0
- package/dist/cjs/plugins/appendlimit.js +87 -0
- package/dist/cjs/plugins/auth-plain.d.ts +2 -0
- package/dist/cjs/plugins/auth-plain.js +89 -0
- package/dist/cjs/plugins/binary.d.ts +30 -0
- package/dist/cjs/plugins/binary.js +247 -0
- package/dist/cjs/plugins/catenate.d.ts +14 -0
- package/dist/cjs/plugins/catenate.js +250 -0
- package/dist/cjs/plugins/compress.d.ts +7 -0
- package/dist/cjs/plugins/compress.js +79 -0
- package/dist/cjs/plugins/condstore.d.ts +5 -0
- package/dist/cjs/plugins/condstore.js +492 -0
- package/dist/cjs/plugins/context-search.d.ts +8 -0
- package/dist/cjs/plugins/context-search.js +304 -0
- package/dist/cjs/plugins/context-sort.d.ts +6 -0
- package/dist/cjs/plugins/context-sort.js +32 -0
- package/dist/cjs/plugins/create-special-use.d.ts +7 -0
- package/dist/cjs/plugins/create-special-use.js +101 -0
- package/dist/cjs/plugins/enable.d.ts +23 -0
- package/dist/cjs/plugins/enable.js +127 -0
- package/dist/cjs/plugins/esearch.d.ts +6 -0
- package/dist/cjs/plugins/esearch.js +142 -0
- package/dist/cjs/plugins/esort.d.ts +6 -0
- package/dist/cjs/plugins/esort.js +60 -0
- package/dist/cjs/plugins/id.d.ts +5 -0
- package/dist/cjs/plugins/id.js +123 -0
- package/dist/cjs/plugins/idle.d.ts +5 -0
- package/dist/cjs/plugins/idle.js +85 -0
- package/dist/cjs/plugins/imap4rev2.d.ts +6 -0
- package/dist/cjs/plugins/imap4rev2.js +184 -0
- package/dist/cjs/plugins/index.d.ts +2 -0
- package/dist/cjs/plugins/index.js +119 -0
- package/dist/cjs/plugins/list-extended.d.ts +2 -0
- package/dist/cjs/plugins/list-extended.js +235 -0
- package/dist/cjs/plugins/list-status.d.ts +6 -0
- package/dist/cjs/plugins/list-status.js +42 -0
- package/dist/cjs/plugins/literalminus.d.ts +8 -0
- package/dist/cjs/plugins/literalminus.js +32 -0
- package/dist/cjs/plugins/literalplus.d.ts +6 -0
- package/dist/cjs/plugins/literalplus.js +30 -0
- package/dist/cjs/plugins/logindisabled.d.ts +5 -0
- package/dist/cjs/plugins/logindisabled.js +54 -0
- package/dist/cjs/plugins/messagelimit.d.ts +19 -0
- package/dist/cjs/plugins/messagelimit.js +227 -0
- package/dist/cjs/plugins/metadata-server.d.ts +7 -0
- package/dist/cjs/plugins/metadata-server.js +24 -0
- package/dist/cjs/plugins/metadata.d.ts +11 -0
- package/dist/cjs/plugins/metadata.js +436 -0
- package/dist/cjs/plugins/move.d.ts +11 -0
- package/dist/cjs/plugins/move.js +96 -0
- package/dist/cjs/plugins/multiappend.d.ts +12 -0
- package/dist/cjs/plugins/multiappend.js +38 -0
- package/dist/cjs/plugins/multisearch.d.ts +6 -0
- package/dist/cjs/plugins/multisearch.js +263 -0
- package/dist/cjs/plugins/namespace.d.ts +5 -0
- package/dist/cjs/plugins/namespace.js +57 -0
- package/dist/cjs/plugins/notify.d.ts +2 -0
- package/dist/cjs/plugins/notify.js +628 -0
- package/dist/cjs/plugins/oauthbearer.d.ts +32 -0
- package/dist/cjs/plugins/oauthbearer.js +202 -0
- package/dist/cjs/plugins/objectid.d.ts +23 -0
- package/dist/cjs/plugins/objectid.js +221 -0
- package/dist/cjs/plugins/partial.d.ts +6 -0
- package/dist/cjs/plugins/partial.js +78 -0
- package/dist/cjs/plugins/preview.d.ts +31 -0
- package/dist/cjs/plugins/preview.js +378 -0
- package/dist/cjs/plugins/qresync.d.ts +11 -0
- package/dist/cjs/plugins/qresync.js +473 -0
- package/dist/cjs/plugins/quota.d.ts +18 -0
- package/dist/cjs/plugins/quota.js +254 -0
- package/dist/cjs/plugins/replace.d.ts +14 -0
- package/dist/cjs/plugins/replace.js +130 -0
- package/dist/cjs/plugins/sasl-ir.d.ts +5 -0
- package/dist/cjs/plugins/sasl-ir.js +24 -0
- package/dist/cjs/plugins/savedate.d.ts +17 -0
- package/dist/cjs/plugins/savedate.js +64 -0
- package/dist/cjs/plugins/savelimit.d.ts +10 -0
- package/dist/cjs/plugins/savelimit.js +30 -0
- package/dist/cjs/plugins/searchres.d.ts +6 -0
- package/dist/cjs/plugins/searchres.js +91 -0
- package/dist/cjs/plugins/sort-display.d.ts +11 -0
- package/dist/cjs/plugins/sort-display.js +37 -0
- package/dist/cjs/plugins/sort.d.ts +11 -0
- package/dist/cjs/plugins/sort.js +125 -0
- package/dist/cjs/plugins/special-use.d.ts +10 -0
- package/dist/cjs/plugins/special-use.js +95 -0
- package/dist/cjs/plugins/starttls.d.ts +5 -0
- package/dist/cjs/plugins/starttls.js +55 -0
- package/dist/cjs/plugins/status-size.d.ts +7 -0
- package/dist/cjs/plugins/status-size.js +30 -0
- package/dist/cjs/plugins/thread-orderedsubject.d.ts +11 -0
- package/dist/cjs/plugins/thread-orderedsubject.js +28 -0
- package/dist/cjs/plugins/thread-references.d.ts +11 -0
- package/dist/cjs/plugins/thread-references.js +28 -0
- package/dist/cjs/plugins/uidonly.d.ts +15 -0
- package/dist/cjs/plugins/uidonly.js +126 -0
- package/dist/cjs/plugins/uidplus.d.ts +15 -0
- package/dist/cjs/plugins/uidplus.js +119 -0
- package/dist/cjs/plugins/unauthenticate.d.ts +7 -0
- package/dist/cjs/plugins/unauthenticate.js +32 -0
- package/dist/cjs/plugins/unselect.d.ts +5 -0
- package/dist/cjs/plugins/unselect.js +36 -0
- package/dist/cjs/plugins/utf8-accept.d.ts +6 -0
- package/dist/cjs/plugins/utf8-accept.js +72 -0
- package/dist/cjs/plugins/x-gm-ext-1.d.ts +26 -0
- package/dist/cjs/plugins/x-gm-ext-1.js +422 -0
- package/dist/cjs/plugins/xoauth2.d.ts +2 -0
- package/dist/cjs/plugins/xoauth2.js +155 -0
- package/dist/cjs/plugins/xtoybird.d.ts +2 -0
- package/dist/cjs/plugins/xtoybird.js +236 -0
- package/dist/cjs/server.d.ts +876 -0
- package/dist/cjs/server.js +2597 -0
- package/dist/cjs/smtp-listener.d.ts +13 -0
- package/dist/cjs/smtp-listener.js +47 -0
- package/dist/cjs/sorting.d.ts +77 -0
- package/dist/cjs/sorting.js +290 -0
- package/dist/cjs/threading.d.ts +30 -0
- package/dist/cjs/threading.js +318 -0
- package/dist/cjs/types.d.ts +327 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/utf8-session.d.ts +17 -0
- package/dist/cjs/utf8-session.js +148 -0
- package/dist/cjs/vanished.d.ts +21 -0
- package/dist/cjs/vanished.js +55 -0
- package/dist/esm/addressparser.d.ts +21 -0
- package/{lib → dist/esm}/addressparser.js +106 -133
- package/dist/esm/arguments.d.ts +31 -0
- package/dist/esm/arguments.js +96 -0
- package/dist/esm/bodystructure.d.ts +25 -0
- package/{lib → dist/esm}/bodystructure.js +17 -33
- package/dist/esm/cert.d.ts +2 -0
- package/dist/esm/cert.js +4 -0
- package/dist/esm/command-states.d.ts +36 -0
- package/{lib → dist/esm}/command-states.js +4 -16
- package/dist/esm/commands/append.d.ts +88 -0
- package/{lib → dist/esm}/commands/append.js +47 -85
- package/dist/esm/commands/capability.d.ts +2 -0
- package/dist/esm/commands/capability.js +29 -0
- package/dist/esm/commands/check.d.ts +2 -0
- package/dist/esm/commands/check.js +13 -0
- package/dist/esm/commands/close.d.ts +2 -0
- package/dist/esm/commands/close.js +20 -0
- package/dist/esm/commands/copy.d.ts +30 -0
- package/{lib → dist/esm}/commands/copy.js +31 -55
- package/dist/esm/commands/create.d.ts +2 -0
- package/{lib → dist/esm}/commands/create.js +25 -39
- package/dist/esm/commands/delete.d.ts +2 -0
- package/{lib → dist/esm}/commands/delete.js +25 -41
- package/dist/esm/commands/examine.d.ts +2 -0
- package/dist/esm/commands/examine.js +4 -0
- package/dist/esm/commands/expunge.d.ts +2 -0
- package/dist/esm/commands/expunge.js +17 -0
- package/dist/esm/commands/fetch.d.ts +23 -0
- package/{lib → dist/esm}/commands/fetch.js +33 -74
- package/dist/esm/commands/handlers/fetch.d.ts +12 -0
- package/{lib → dist/esm}/commands/handlers/fetch.js +11 -42
- package/dist/esm/commands/handlers/flags.d.ts +17 -0
- package/{lib → dist/esm}/commands/handlers/flags.js +3 -11
- package/dist/esm/commands/handlers/search.d.ts +85 -0
- package/{lib → dist/esm}/commands/handlers/search.js +33 -71
- package/dist/esm/commands/handlers/status.d.ts +34 -0
- package/{lib → dist/esm}/commands/handlers/status.js +1 -9
- package/dist/esm/commands/handlers/store.d.ts +3 -0
- package/{lib → dist/esm}/commands/handlers/store.js +20 -44
- package/dist/esm/commands/index.d.ts +2 -0
- package/dist/esm/commands/index.js +55 -0
- package/dist/esm/commands/list.d.ts +2 -0
- package/dist/esm/commands/list.js +71 -0
- package/dist/esm/commands/login.d.ts +2 -0
- package/{lib → dist/esm}/commands/login.js +24 -44
- package/dist/esm/commands/logout.d.ts +2 -0
- package/dist/esm/commands/logout.js +25 -0
- package/dist/esm/commands/lsub.d.ts +2 -0
- package/dist/esm/commands/lsub.js +64 -0
- package/dist/esm/commands/noop.d.ts +2 -0
- package/dist/esm/commands/noop.js +13 -0
- package/dist/esm/commands/rename.d.ts +2 -0
- package/{lib → dist/esm}/commands/rename.js +32 -51
- package/dist/esm/commands/search.d.ts +10 -0
- package/dist/esm/commands/search.js +54 -0
- package/dist/esm/commands/select.d.ts +19 -0
- package/dist/esm/commands/select.js +214 -0
- package/dist/esm/commands/status.d.ts +2 -0
- package/{lib → dist/esm}/commands/status.js +18 -39
- package/dist/esm/commands/store.d.ts +10 -0
- package/{lib → dist/esm}/commands/store.js +39 -73
- package/dist/esm/commands/subscribe.d.ts +2 -0
- package/{lib → dist/esm}/commands/subscribe.js +22 -39
- package/dist/esm/commands/uid-copy.d.ts +2 -0
- package/dist/esm/commands/uid-copy.js +4 -0
- package/dist/esm/commands/uid-fetch.d.ts +3 -0
- package/dist/esm/commands/uid-fetch.js +3 -0
- package/dist/esm/commands/uid-search.d.ts +3 -0
- package/dist/esm/commands/uid-search.js +3 -0
- package/dist/esm/commands/uid-store.d.ts +3 -0
- package/dist/esm/commands/uid-store.js +3 -0
- package/dist/esm/commands/unsubscribe.d.ts +2 -0
- package/{lib → dist/esm}/commands/unsubscribe.js +22 -37
- package/dist/esm/dates.d.ts +64 -0
- package/{lib → dist/esm}/dates.js +6 -14
- package/dist/esm/deflate-layer.d.ts +83 -0
- package/{lib → dist/esm}/deflate-layer.js +9 -26
- package/dist/esm/encoded-words.d.ts +15 -0
- package/{lib → dist/esm}/encoded-words.js +9 -25
- package/dist/esm/envelope.d.ts +33 -0
- package/{lib → dist/esm}/envelope.js +8 -19
- package/dist/esm/esearch.d.ts +96 -0
- package/{lib → dist/esm}/esearch.js +12 -39
- package/dist/esm/framing.d.ts +66 -0
- package/dist/esm/framing.js +82 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/list-extensions.d.ts +50 -0
- package/{lib → dist/esm}/list-extensions.js +1 -4
- package/dist/esm/load-plugins.d.ts +21 -0
- package/{lib → dist/esm}/load-plugins.js +9 -43
- package/dist/esm/mailbox-name.d.ts +26 -0
- package/{lib → dist/esm}/mailbox-name.js +5 -26
- package/dist/esm/mimeparser.d.ts +137 -0
- package/{lib → dist/esm}/mimeparser.js +74 -152
- package/dist/esm/mock-client.d.ts +39 -0
- package/{lib → dist/esm}/mock-client.js +26 -40
- package/dist/esm/numbers.d.ts +28 -0
- package/{lib → dist/esm}/numbers.js +1 -8
- package/dist/esm/package.json +3 -0
- package/dist/esm/plugins/acl.d.ts +2 -0
- package/{lib → dist/esm}/plugins/acl.js +146 -240
- package/dist/esm/plugins/appendlimit.d.ts +16 -0
- package/{lib → dist/esm}/plugins/appendlimit.js +5 -16
- package/dist/esm/plugins/auth-plain.d.ts +2 -0
- package/{lib → dist/esm}/plugins/auth-plain.js +11 -31
- package/dist/esm/plugins/binary.d.ts +30 -0
- package/{lib → dist/esm}/plugins/binary.js +17 -43
- package/dist/esm/plugins/catenate.d.ts +14 -0
- package/{lib → dist/esm}/plugins/catenate.js +19 -40
- package/dist/esm/plugins/compress.d.ts +7 -0
- package/dist/esm/plugins/compress.js +61 -0
- package/dist/esm/plugins/condstore.d.ts +5 -0
- package/{lib → dist/esm}/plugins/condstore.js +66 -152
- package/dist/esm/plugins/context-search.d.ts +8 -0
- package/{lib → dist/esm}/plugins/context-search.js +53 -88
- package/dist/esm/plugins/context-sort.d.ts +6 -0
- package/{lib → dist/esm}/plugins/context-sort.js +4 -9
- package/dist/esm/plugins/create-special-use.d.ts +7 -0
- package/{lib → dist/esm}/plugins/create-special-use.js +33 -55
- package/dist/esm/plugins/enable.d.ts +23 -0
- package/dist/esm/plugins/enable.js +111 -0
- package/dist/esm/plugins/esearch.d.ts +6 -0
- package/{lib → dist/esm}/plugins/esearch.js +13 -42
- package/dist/esm/plugins/esort.d.ts +6 -0
- package/{lib → dist/esm}/plugins/esort.js +7 -25
- package/dist/esm/plugins/id.d.ts +5 -0
- package/dist/esm/plugins/id.js +108 -0
- package/dist/esm/plugins/idle.d.ts +5 -0
- package/dist/esm/plugins/idle.js +70 -0
- package/dist/esm/plugins/imap4rev2.d.ts +6 -0
- package/{lib → dist/esm}/plugins/imap4rev2.js +24 -60
- package/dist/esm/plugins/index.d.ts +2 -0
- package/dist/esm/plugins/index.js +113 -0
- package/dist/esm/plugins/list-extended.d.ts +2 -0
- package/{lib → dist/esm}/plugins/list-extended.js +28 -66
- package/dist/esm/plugins/list-status.d.ts +6 -0
- package/{lib → dist/esm}/plugins/list-status.js +5 -12
- package/dist/esm/plugins/literalminus.d.ts +8 -0
- package/{lib → dist/esm}/plugins/literalminus.js +2 -5
- package/dist/esm/plugins/literalplus.d.ts +6 -0
- package/{lib → dist/esm}/plugins/literalplus.js +2 -5
- package/dist/esm/plugins/logindisabled.d.ts +5 -0
- package/dist/esm/plugins/logindisabled.js +39 -0
- package/dist/esm/plugins/messagelimit.d.ts +19 -0
- package/{lib → dist/esm}/plugins/messagelimit.js +18 -41
- package/dist/esm/plugins/metadata-server.d.ts +7 -0
- package/{lib → dist/esm}/plugins/metadata-server.js +3 -7
- package/dist/esm/plugins/metadata.d.ts +11 -0
- package/dist/esm/plugins/metadata.js +421 -0
- package/dist/esm/plugins/move.d.ts +11 -0
- package/{lib → dist/esm}/plugins/move.js +37 -66
- package/dist/esm/plugins/multiappend.d.ts +12 -0
- package/{lib → dist/esm}/plugins/multiappend.js +2 -5
- package/dist/esm/plugins/multisearch.d.ts +6 -0
- package/{lib → dist/esm}/plugins/multisearch.js +24 -48
- package/dist/esm/plugins/namespace.d.ts +5 -0
- package/dist/esm/plugins/namespace.js +42 -0
- package/dist/esm/plugins/notify.d.ts +2 -0
- package/{lib → dist/esm}/plugins/notify.js +90 -134
- package/dist/esm/plugins/oauthbearer.d.ts +32 -0
- package/{lib → dist/esm}/plugins/oauthbearer.js +18 -48
- package/dist/esm/plugins/objectid.d.ts +23 -0
- package/{lib → dist/esm}/plugins/objectid.js +21 -58
- package/dist/esm/plugins/partial.d.ts +6 -0
- package/{lib → dist/esm}/plugins/partial.js +7 -15
- package/dist/esm/plugins/preview.d.ts +31 -0
- package/{lib → dist/esm}/plugins/preview.js +28 -66
- package/dist/esm/plugins/qresync.d.ts +11 -0
- package/{lib → dist/esm}/plugins/qresync.js +64 -134
- package/dist/esm/plugins/quota.d.ts +18 -0
- package/{lib → dist/esm}/plugins/quota.js +89 -135
- package/dist/esm/plugins/replace.d.ts +14 -0
- package/{lib → dist/esm}/plugins/replace.js +21 -51
- package/dist/esm/plugins/sasl-ir.d.ts +5 -0
- package/{lib → dist/esm}/plugins/sasl-ir.js +3 -6
- package/dist/esm/plugins/savedate.d.ts +17 -0
- package/{lib → dist/esm}/plugins/savedate.js +5 -15
- package/dist/esm/plugins/savelimit.d.ts +10 -0
- package/{lib → dist/esm}/plugins/savelimit.js +3 -6
- package/dist/esm/plugins/searchres.d.ts +6 -0
- package/{lib → dist/esm}/plugins/searchres.js +13 -22
- package/dist/esm/plugins/sort-display.d.ts +11 -0
- package/{lib → dist/esm}/plugins/sort-display.js +6 -10
- package/dist/esm/plugins/sort.d.ts +11 -0
- package/{lib → dist/esm}/plugins/sort.js +24 -46
- package/dist/esm/plugins/special-use.d.ts +10 -0
- package/{lib → dist/esm}/plugins/special-use.js +9 -24
- package/dist/esm/plugins/starttls.d.ts +5 -0
- package/{lib → dist/esm}/plugins/starttls.js +20 -37
- package/dist/esm/plugins/status-size.d.ts +7 -0
- package/{lib → dist/esm}/plugins/status-size.js +4 -11
- package/dist/esm/plugins/thread-orderedsubject.d.ts +11 -0
- package/{lib → dist/esm}/plugins/thread-orderedsubject.js +3 -6
- package/dist/esm/plugins/thread-references.d.ts +11 -0
- package/{lib → dist/esm}/plugins/thread-references.js +3 -6
- package/dist/esm/plugins/uidonly.d.ts +15 -0
- package/{lib → dist/esm}/plugins/uidonly.js +11 -35
- package/dist/esm/plugins/uidplus.d.ts +15 -0
- package/{lib → dist/esm}/plugins/uidplus.js +25 -45
- package/dist/esm/plugins/unauthenticate.d.ts +7 -0
- package/dist/esm/plugins/unauthenticate.js +17 -0
- package/dist/esm/plugins/unselect.d.ts +5 -0
- package/dist/esm/plugins/unselect.js +21 -0
- package/dist/esm/plugins/utf8-accept.d.ts +6 -0
- package/{lib → dist/esm}/plugins/utf8-accept.js +10 -21
- package/dist/esm/plugins/x-gm-ext-1.d.ts +26 -0
- package/{lib → dist/esm}/plugins/x-gm-ext-1.js +48 -100
- package/dist/esm/plugins/xoauth2.d.ts +2 -0
- package/dist/esm/plugins/xoauth2.js +140 -0
- package/dist/esm/plugins/xtoybird.d.ts +2 -0
- package/dist/esm/plugins/xtoybird.js +218 -0
- package/dist/esm/server.d.ts +876 -0
- package/dist/esm/server.js +2543 -0
- package/dist/esm/smtp-listener.d.ts +13 -0
- package/{lib → dist/esm}/smtp-listener.js +5 -12
- package/dist/esm/sorting.d.ts +77 -0
- package/{lib → dist/esm}/sorting.js +40 -53
- package/dist/esm/threading.d.ts +30 -0
- package/{lib → dist/esm}/threading.js +29 -70
- package/dist/esm/types.d.ts +327 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/utf8-session.d.ts +17 -0
- package/{lib → dist/esm}/utf8-session.js +15 -25
- package/dist/esm/vanished.d.ts +21 -0
- package/{lib → dist/esm}/vanished.js +16 -21
- package/dist/plugin-help.json +298 -0
- package/package.json +55 -12
- package/lib/commands/capability.js +0 -47
- package/lib/commands/check.js +0 -21
- package/lib/commands/close.js +0 -30
- package/lib/commands/examine.js +0 -7
- package/lib/commands/expunge.js +0 -27
- package/lib/commands/list.js +0 -100
- package/lib/commands/logout.js +0 -41
- package/lib/commands/lsub.js +0 -87
- package/lib/commands/noop.js +0 -21
- package/lib/commands/search.js +0 -76
- package/lib/commands/select.js +0 -289
- package/lib/commands/uid copy.js +0 -7
- package/lib/commands/uid fetch.js +0 -5
- package/lib/commands/uid search.js +0 -5
- package/lib/commands/uid store.js +0 -5
- package/lib/plugins/compress.js +0 -76
- package/lib/plugins/enable.js +0 -155
- package/lib/plugins/id.js +0 -138
- package/lib/plugins/idle.js +0 -105
- package/lib/plugins/logindisabled.js +0 -50
- package/lib/plugins/metadata.js +0 -475
- package/lib/plugins/namespace.js +0 -67
- package/lib/plugins/unauthenticate.js +0 -28
- package/lib/plugins/unselect.js +0 -36
- package/lib/plugins/xoauth2.js +0 -188
- package/lib/plugins/xtoybird.js +0 -282
- package/lib/server.js +0 -2880
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds SORT=DISPLAY [RFC5957] capability, also loads SORT
|
|
4
|
+
*
|
|
5
|
+
* SORT=DISPLAY: https://tools.ietf.org/html/rfc5957
|
|
6
|
+
*
|
|
7
|
+
* Additional sort keys for SORT and UID SORT:
|
|
8
|
+
* - DISPLAYFROM
|
|
9
|
+
* - DISPLAYTO
|
|
10
|
+
*/
|
|
11
|
+
export default function sortDisplayPlugin(server: IMAPServer): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = sortDisplayPlugin;
|
|
7
|
+
const sorting_js_1 = require("../sorting.js");
|
|
8
|
+
const sort_js_1 = __importDefault(require("./sort.js"));
|
|
9
|
+
/**
|
|
10
|
+
* @help Adds SORT=DISPLAY [RFC5957] capability, also loads SORT
|
|
11
|
+
*
|
|
12
|
+
* SORT=DISPLAY: https://tools.ietf.org/html/rfc5957
|
|
13
|
+
*
|
|
14
|
+
* Additional sort keys for SORT and UID SORT:
|
|
15
|
+
* - DISPLAYFROM
|
|
16
|
+
* - DISPLAYTO
|
|
17
|
+
*/
|
|
18
|
+
function sortDisplayPlugin(server) {
|
|
19
|
+
// RFC 5957 section 1: SORT=DISPLAY means the full SORT extension plus both sort keys
|
|
20
|
+
(0, sort_js_1.default)(server);
|
|
21
|
+
server.registerCapability('SORT=DISPLAY');
|
|
22
|
+
// RFC 5957 section 4: the DISPLAY sort value of the first address of env-from and env-to
|
|
23
|
+
server.sortKeys.DISPLAYFROM = (message) => (0, sorting_js_1.collationKey)((0, sorting_js_1.displayAddress)(message, 'from'));
|
|
24
|
+
server.sortKeys.DISPLAYTO = (message) => (0, sorting_js_1.collationKey)((0, sorting_js_1.displayAddress)(message, 'to'));
|
|
25
|
+
}
|
|
26
|
+
{
|
|
27
|
+
const defaultExport = exports.default;
|
|
28
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
29
|
+
for (const key of Object.keys(exports)) {
|
|
30
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
31
|
+
defaultExport[key] = exports[key];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
35
|
+
module.exports = defaultExport;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds SORT [RFC5256] capability
|
|
4
|
+
*
|
|
5
|
+
* SORT: https://tools.ietf.org/html/rfc5256
|
|
6
|
+
*
|
|
7
|
+
* Additional commands:
|
|
8
|
+
* - SORT
|
|
9
|
+
* - UID SORT
|
|
10
|
+
*/
|
|
11
|
+
export default function sortPlugin(server: IMAPServer): void;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = sortPlugin;
|
|
4
|
+
const command_states_js_1 = require("../command-states.js");
|
|
5
|
+
const mimeparser_js_1 = require("../mimeparser.js");
|
|
6
|
+
const sorting_js_1 = require("../sorting.js");
|
|
7
|
+
/**
|
|
8
|
+
* @help Adds SORT [RFC5256] capability
|
|
9
|
+
*
|
|
10
|
+
* SORT: https://tools.ietf.org/html/rfc5256
|
|
11
|
+
*
|
|
12
|
+
* Additional commands:
|
|
13
|
+
* - SORT
|
|
14
|
+
* - UID SORT
|
|
15
|
+
*/
|
|
16
|
+
function sortPlugin(server) {
|
|
17
|
+
if (server.sortKeys) {
|
|
18
|
+
// already loaded, e.g. by the SORT=DISPLAY plugin
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
server.registerCapability('SORT');
|
|
22
|
+
// RFC 5256 section 3: sort keys and the value of a message for each. A value is a number or the
|
|
23
|
+
// collation key of a string, see sorting.collationKey. SORT=DISPLAY adds its keys here
|
|
24
|
+
server.sortKeys = {
|
|
25
|
+
ARRIVAL: (message) => (0, sorting_js_1.arrivalTime)(message),
|
|
26
|
+
CC: (message) => (0, sorting_js_1.collationKey)((0, sorting_js_1.addressMailbox)(message, 'cc')),
|
|
27
|
+
DATE: (message) => (0, sorting_js_1.sentTime)(message),
|
|
28
|
+
FROM: (message) => (0, sorting_js_1.collationKey)((0, sorting_js_1.addressMailbox)(message, 'from')),
|
|
29
|
+
SIZE: (message) => (0, mimeparser_js_1.getMessageData)(message).raw.length,
|
|
30
|
+
SUBJECT: (message) => (0, sorting_js_1.collationKey)((0, sorting_js_1.baseSubject)((0, mimeparser_js_1.getMessageData)(message).tree.parsedHeader.subject).subject),
|
|
31
|
+
TO: (message) => (0, sorting_js_1.collationKey)((0, sorting_js_1.addressMailbox)(message, 'to'))
|
|
32
|
+
};
|
|
33
|
+
const compareValues = (a, b) => (Buffer.isBuffer(a) ? Buffer.compare(a, b) : a - b);
|
|
34
|
+
/**
|
|
35
|
+
* Returns a comparator of messages for parsed sort criteria: ascending order, REVERSE turns one
|
|
36
|
+
* criterion around, and mailbox order (the sequence number) breaks ties (RFC 5256 section 3).
|
|
37
|
+
* Every value is computed once per message. Plugins (ESORT, CONTEXT=SORT) use it to sort again later
|
|
38
|
+
*
|
|
39
|
+
* @param {Array} criteria List of `{ key, reverse }`
|
|
40
|
+
* @return {Function} comparator for two messages of the same mailbox
|
|
41
|
+
*/
|
|
42
|
+
server.sortComparator = (criteria) => {
|
|
43
|
+
const cache = new WeakMap();
|
|
44
|
+
const getValues = (message) => {
|
|
45
|
+
if (!cache.has(message)) {
|
|
46
|
+
cache.set(message, criteria.map((criterion) => server.sortKeys[criterion.key](message)));
|
|
47
|
+
}
|
|
48
|
+
return cache.get(message);
|
|
49
|
+
};
|
|
50
|
+
return (a, b) => {
|
|
51
|
+
const aValues = getValues(a);
|
|
52
|
+
const bValues = getValues(b);
|
|
53
|
+
for (let i = 0; i < criteria.length; i++) {
|
|
54
|
+
const diff = compareValues(aValues[i], bValues[i]);
|
|
55
|
+
if (diff) {
|
|
56
|
+
return criteria[i].reverse ? -diff : diff;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// messages are kept in UID order, so this is the order of sequence numbers
|
|
60
|
+
return a.uid - b.uid;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const sortHandler = (isUid, connection, parsed, data, callback) => {
|
|
64
|
+
const command = isUid ? 'UID SORT' : 'SORT';
|
|
65
|
+
const attributes = parsed.attributes || [];
|
|
66
|
+
const fail = (text) => {
|
|
67
|
+
connection.sendStatus(parsed, data, 'BAD', text, false, command + ' FAILED');
|
|
68
|
+
return callback();
|
|
69
|
+
};
|
|
70
|
+
// RFC 5256 section 5: sort-criteria = "(" sort-criterion *(SP sort-criterion) ")",
|
|
71
|
+
// sort-criterion = ["REVERSE" SP] sort-key
|
|
72
|
+
if (!Array.isArray(attributes[0]) || !attributes[0].length) {
|
|
73
|
+
return fail(command + ' expects a list of sort criteria');
|
|
74
|
+
}
|
|
75
|
+
const criteria = [];
|
|
76
|
+
let reverse = false;
|
|
77
|
+
for (const item of attributes[0]) {
|
|
78
|
+
const key = item && item.type === 'ATOM' ? item.value.toUpperCase() : '';
|
|
79
|
+
if (key === 'REVERSE' && !reverse) {
|
|
80
|
+
reverse = true;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (!Object.hasOwn(server.sortKeys, key)) {
|
|
84
|
+
return fail('Invalid sort criterion ' + (item && typeof item.value === 'string' ? item.value : ''));
|
|
85
|
+
}
|
|
86
|
+
criteria.push({ key, reverse });
|
|
87
|
+
reverse = false;
|
|
88
|
+
}
|
|
89
|
+
if (reverse) {
|
|
90
|
+
return fail('REVERSE must be followed by a sort key');
|
|
91
|
+
}
|
|
92
|
+
const result = (0, sorting_js_1.searchMessages)(connection, parsed, data, attributes.slice(1));
|
|
93
|
+
if (!result) {
|
|
94
|
+
return callback();
|
|
95
|
+
}
|
|
96
|
+
const compare = server.sortComparator(criteria);
|
|
97
|
+
const sorted = result.list.slice().sort(compare);
|
|
98
|
+
connection.send({
|
|
99
|
+
tag: '*',
|
|
100
|
+
command: 'SORT',
|
|
101
|
+
attributes: sorted.map(message => (isUid ? message.uid : result.numbers[message.uid]))
|
|
102
|
+
}, command, parsed, data,
|
|
103
|
+
// the search result, for CONDSTORE to append the highest mod-sequence (RFC 7162 section 3.1.9), with the
|
|
104
|
+
// sorted messages and the comparator for ESORT and CONTEXT=SORT
|
|
105
|
+
Object.assign(result, { sorted, compare }));
|
|
106
|
+
connection.sendStatus(parsed, data, 'OK', command + ' completed', false, command);
|
|
107
|
+
return callback();
|
|
108
|
+
};
|
|
109
|
+
// RFC 5256 section 3: EXPUNGE responses are not permitted while responding to SORT, but are during UID SORT.
|
|
110
|
+
// The search criteria start after the sort criteria and the charset
|
|
111
|
+
server.setCommandHandler('SORT', sortHandler.bind(null, false), { states: command_states_js_1.states.SELECTED, searchCriteria: 2, noExpunge: true });
|
|
112
|
+
server.setCommandHandler('UID SORT', sortHandler.bind(null, true), { states: command_states_js_1.states.SELECTED, searchCriteria: 2 });
|
|
113
|
+
}
|
|
114
|
+
{
|
|
115
|
+
const defaultExport = exports.default;
|
|
116
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
117
|
+
for (const key of Object.keys(exports)) {
|
|
118
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
119
|
+
defaultExport[key] = exports[key];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
123
|
+
module.exports = defaultExport;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Enables SPECIAL-USE [RFC6154] capability
|
|
4
|
+
* @help Mailboxes need to have a "special-use"
|
|
5
|
+
* @help property (String or Array) that will be used
|
|
6
|
+
* @help as extra flag for LIST and LSUB responses.
|
|
7
|
+
* @help With LIST-EXTENDED the SPECIAL-USE selection and
|
|
8
|
+
* @help return options work with the other LIST options
|
|
9
|
+
*/
|
|
10
|
+
export default function specialUsePlugin(server: IMAPServer): void;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = specialUsePlugin;
|
|
4
|
+
const list_extensions_js_1 = require("../list-extensions.js");
|
|
5
|
+
/**
|
|
6
|
+
* @help Enables SPECIAL-USE [RFC6154] capability
|
|
7
|
+
* @help Mailboxes need to have a "special-use"
|
|
8
|
+
* @help property (String or Array) that will be used
|
|
9
|
+
* @help as extra flag for LIST and LSUB responses.
|
|
10
|
+
* @help With LIST-EXTENDED the SPECIAL-USE selection and
|
|
11
|
+
* @help return options work with the other LIST options
|
|
12
|
+
*/
|
|
13
|
+
function specialUsePlugin(server) {
|
|
14
|
+
// Register capability
|
|
15
|
+
server.registerCapability('SPECIAL-USE');
|
|
16
|
+
const getSpecialUse = (folder) => [].concat((folder && folder['special-use']) || []);
|
|
17
|
+
// RFC 6154 section 2: with LIST-EXTENDED, SPECIAL-USE is a list-select-independent-opt that
|
|
18
|
+
// implies the SPECIAL-USE return option. The LIST-EXTENDED plugin may be loaded before or after this one
|
|
19
|
+
const listExtensions = (0, list_extensions_js_1.getListExtensions)(server);
|
|
20
|
+
listExtensions.selectionOptions['SPECIAL-USE'] = {
|
|
21
|
+
type: 'independent',
|
|
22
|
+
returnOption: 'SPECIAL-USE',
|
|
23
|
+
match: (folder) => folder.flags.indexOf('\\Noselect') < 0 && getSpecialUse(folder).length > 0
|
|
24
|
+
};
|
|
25
|
+
// special-use attributes are always included, so the return option needs no extra handling
|
|
26
|
+
listExtensions.returnOptions['SPECIAL-USE'] = {};
|
|
27
|
+
const listHandler = server.getCommandHandler('LIST');
|
|
28
|
+
server.setCommandHandler('LIST', (connection, parsed, data, callback) => {
|
|
29
|
+
if (listExtensions.enabled) {
|
|
30
|
+
// LIST-EXTENDED handles the options
|
|
31
|
+
return listHandler(connection, parsed, data, callback);
|
|
32
|
+
}
|
|
33
|
+
// without LIST-EXTENDED only the SPECIAL-USE options are understood
|
|
34
|
+
let i;
|
|
35
|
+
if (parsed.attributes && Array.isArray(parsed.attributes[0])) {
|
|
36
|
+
for (i = parsed.attributes[0].length - 1; i >= 0; i--) {
|
|
37
|
+
if (parsed.attributes[0][i] && parsed.attributes[0][i].type === 'ATOM' && parsed.attributes[0][i].value.toUpperCase() === 'SPECIAL-USE') {
|
|
38
|
+
parsed.attributes[0].splice(i, 1);
|
|
39
|
+
parsed.listSpecialUseOnly = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// remove parameter if no other memebers were left
|
|
43
|
+
if (!parsed.attributes[0].length) {
|
|
44
|
+
parsed.attributes.splice(0, 1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (parsed.attributes &&
|
|
48
|
+
parsed.attributes[2] &&
|
|
49
|
+
parsed.attributes[2].type === 'ATOM' &&
|
|
50
|
+
parsed.attributes[2].value.toUpperCase() === 'RETURN' &&
|
|
51
|
+
Array.isArray(parsed.attributes[3])) {
|
|
52
|
+
for (i = parsed.attributes[3].length - 1; i >= 0; i--) {
|
|
53
|
+
if (parsed.attributes[3][i] && parsed.attributes[3][i].type === 'ATOM' && parsed.attributes[3][i].value.toUpperCase() === 'SPECIAL-USE') {
|
|
54
|
+
// special-use attributes are always included, so the return option needs no extra handling
|
|
55
|
+
parsed.attributes[3].splice(i, 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Remove RETURN (List) if no members were left
|
|
59
|
+
if (!parsed.attributes[3].length) {
|
|
60
|
+
parsed.attributes.splice(2, 2);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
listHandler(connection, parsed, data, callback);
|
|
64
|
+
});
|
|
65
|
+
server.outputHandlers.push((connection, response, description, parsed, data, folder) => {
|
|
66
|
+
const specialUseList = getSpecialUse(folder).map(specialUse => {
|
|
67
|
+
return {
|
|
68
|
+
type: 'ATOM',
|
|
69
|
+
value: specialUse
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
if ((description === 'LIST ITEM' || description === 'LSUB ITEM') && folder && response.attributes && Array.isArray(response.attributes[0])) {
|
|
73
|
+
if (specialUseList.length) {
|
|
74
|
+
// special-use attributes are added to the other mailbox attributes, also with RETURN (SPECIAL-USE)
|
|
75
|
+
response.attributes[0] = response.attributes[0].concat(specialUseList);
|
|
76
|
+
}
|
|
77
|
+
else if (parsed.listSpecialUseOnly) {
|
|
78
|
+
// Do not show this response
|
|
79
|
+
response.skipResponse = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
{
|
|
85
|
+
const defaultExport = exports.default;
|
|
86
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
87
|
+
for (const key of Object.keys(exports)) {
|
|
88
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
89
|
+
defaultExport[key] = exports[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
93
|
+
module.exports = defaultExport;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = starttlsPlugin;
|
|
4
|
+
/**
|
|
5
|
+
* @help Adds STARTTLS command
|
|
6
|
+
*/
|
|
7
|
+
function starttlsPlugin(server) {
|
|
8
|
+
// Register capability, usable with unsecure connection
|
|
9
|
+
server.registerCapability('STARTTLS', (connection) => {
|
|
10
|
+
return !connection.secureConnection;
|
|
11
|
+
});
|
|
12
|
+
// Add STARTTLS command
|
|
13
|
+
server.setCommandHandler('STARTTLS', (connection, parsed, data, callback) => {
|
|
14
|
+
// only works in insecure setting
|
|
15
|
+
if (connection.secureConnection) {
|
|
16
|
+
return sendError('Connection is already secured', connection, parsed, data, callback);
|
|
17
|
+
}
|
|
18
|
+
connection.send({
|
|
19
|
+
tag: parsed.tag,
|
|
20
|
+
command: 'OK',
|
|
21
|
+
attributes: [
|
|
22
|
+
{
|
|
23
|
+
type: 'TEXT',
|
|
24
|
+
value: 'Server ready to start TLS negotiation'
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}, 'STARTTLS INIT', parsed, data);
|
|
28
|
+
connection.upgradeConnection(callback);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function sendError(message, connection, parsed, data, callback) {
|
|
32
|
+
connection.send({
|
|
33
|
+
tag: parsed.tag,
|
|
34
|
+
command: 'BAD',
|
|
35
|
+
attributes: [
|
|
36
|
+
{
|
|
37
|
+
type: 'TEXT',
|
|
38
|
+
value: message
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}, 'INVALID COMMAND', parsed, data);
|
|
42
|
+
return callback();
|
|
43
|
+
}
|
|
44
|
+
{
|
|
45
|
+
const defaultExport = exports.default;
|
|
46
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
47
|
+
for (const key of Object.keys(exports)) {
|
|
48
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
49
|
+
defaultExport[key] = exports[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
53
|
+
module.exports = defaultExport;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds STATUS=SIZE [RFC8438] capability. The SIZE status item
|
|
4
|
+
* @help is the sum of the RFC822.SIZE values of the messages, it can
|
|
5
|
+
* @help also be used with LIST-STATUS
|
|
6
|
+
*/
|
|
7
|
+
export default function statusSizePlugin(server: IMAPServer): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = statusSizePlugin;
|
|
7
|
+
const fetch_js_1 = __importDefault(require("../commands/handlers/fetch.js"));
|
|
8
|
+
/**
|
|
9
|
+
* @help Adds STATUS=SIZE [RFC8438] capability. The SIZE status item
|
|
10
|
+
* @help is the sum of the RFC822.SIZE values of the messages, it can
|
|
11
|
+
* @help also be used with LIST-STATUS
|
|
12
|
+
*/
|
|
13
|
+
function statusSizePlugin(server) {
|
|
14
|
+
server.registerCapability('STATUS=SIZE');
|
|
15
|
+
server.allowedStatus.push('SIZE');
|
|
16
|
+
// RFC 8438 section 3: at least the sum of the RFC822.SIZE values of all messages in the mailbox
|
|
17
|
+
server.statusHandlers.SIZE = (connection, mailbox) => mailbox.messages.reduce((size, message) => size + fetch_js_1.default['RFC822.SIZE'](connection, message), 0);
|
|
18
|
+
}
|
|
19
|
+
{
|
|
20
|
+
const defaultExport = exports.default;
|
|
21
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
22
|
+
for (const key of Object.keys(exports)) {
|
|
23
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
24
|
+
defaultExport[key] = exports[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
28
|
+
module.exports = defaultExport;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds THREAD=ORDEREDSUBJECT [RFC5256] capability
|
|
4
|
+
*
|
|
5
|
+
* THREAD: https://tools.ietf.org/html/rfc5256
|
|
6
|
+
*
|
|
7
|
+
* Additional commands:
|
|
8
|
+
* - THREAD ORDEREDSUBJECT
|
|
9
|
+
* - UID THREAD ORDEREDSUBJECT
|
|
10
|
+
*/
|
|
11
|
+
export default function threadOrderedsubjectPlugin(server: IMAPServer): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = threadOrderedsubjectPlugin;
|
|
4
|
+
const threading_js_1 = require("../threading.js");
|
|
5
|
+
/**
|
|
6
|
+
* @help Adds THREAD=ORDEREDSUBJECT [RFC5256] capability
|
|
7
|
+
*
|
|
8
|
+
* THREAD: https://tools.ietf.org/html/rfc5256
|
|
9
|
+
*
|
|
10
|
+
* Additional commands:
|
|
11
|
+
* - THREAD ORDEREDSUBJECT
|
|
12
|
+
* - UID THREAD ORDEREDSUBJECT
|
|
13
|
+
*/
|
|
14
|
+
function threadOrderedsubjectPlugin(server) {
|
|
15
|
+
(0, threading_js_1.addThreadAlgorithm)(server, 'ORDEREDSUBJECT');
|
|
16
|
+
}
|
|
17
|
+
{
|
|
18
|
+
const defaultExport = exports.default;
|
|
19
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
20
|
+
for (const key of Object.keys(exports)) {
|
|
21
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
22
|
+
defaultExport[key] = exports[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
26
|
+
module.exports = defaultExport;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds THREAD=REFERENCES [RFC5256] capability
|
|
4
|
+
*
|
|
5
|
+
* THREAD: https://tools.ietf.org/html/rfc5256
|
|
6
|
+
*
|
|
7
|
+
* Additional commands:
|
|
8
|
+
* - THREAD REFERENCES
|
|
9
|
+
* - UID THREAD REFERENCES
|
|
10
|
+
*/
|
|
11
|
+
export default function threadReferencesPlugin(server: IMAPServer): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = threadReferencesPlugin;
|
|
4
|
+
const threading_js_1 = require("../threading.js");
|
|
5
|
+
/**
|
|
6
|
+
* @help Adds THREAD=REFERENCES [RFC5256] capability
|
|
7
|
+
*
|
|
8
|
+
* THREAD: https://tools.ietf.org/html/rfc5256
|
|
9
|
+
*
|
|
10
|
+
* Additional commands:
|
|
11
|
+
* - THREAD REFERENCES
|
|
12
|
+
* - UID THREAD REFERENCES
|
|
13
|
+
*/
|
|
14
|
+
function threadReferencesPlugin(server) {
|
|
15
|
+
(0, threading_js_1.addThreadAlgorithm)(server, 'REFERENCES');
|
|
16
|
+
}
|
|
17
|
+
{
|
|
18
|
+
const defaultExport = exports.default;
|
|
19
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
20
|
+
for (const key of Object.keys(exports)) {
|
|
21
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
22
|
+
defaultExport[key] = exports[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
26
|
+
module.exports = defaultExport;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds UIDONLY [RFC9586] capability, loads ENABLE as well
|
|
4
|
+
* @help After ENABLE UIDONLY: FETCH, STORE, SEARCH, COPY, MOVE, SORT, THREAD, REPLACE and
|
|
5
|
+
* @help message numbers in UID SEARCH (SORT, THREAD) criteria are refused with BAD [UIDREQUIRED],
|
|
6
|
+
* @help UIDFETCH responses replace FETCH responses and VANISHED replaces EXPUNGE.
|
|
7
|
+
* @help Load UIDPLUS for COPYUID and UID EXPUNGE
|
|
8
|
+
*
|
|
9
|
+
* UIDONLY: https://www.rfc-editor.org/rfc/rfc9586
|
|
10
|
+
*/
|
|
11
|
+
declare function uidonlyPlugin(server: IMAPServer): void;
|
|
12
|
+
declare namespace uidonlyPlugin {
|
|
13
|
+
var requires: string[];
|
|
14
|
+
}
|
|
15
|
+
export default uidonlyPlugin;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = uidonlyPlugin;
|
|
4
|
+
const vanished_js_1 = require("../vanished.js");
|
|
5
|
+
const arguments_js_1 = require("../arguments.js");
|
|
6
|
+
const enable_js_1 = require("./enable.js");
|
|
7
|
+
/**
|
|
8
|
+
* @help Adds UIDONLY [RFC9586] capability, loads ENABLE as well
|
|
9
|
+
* @help After ENABLE UIDONLY: FETCH, STORE, SEARCH, COPY, MOVE, SORT, THREAD, REPLACE and
|
|
10
|
+
* @help message numbers in UID SEARCH (SORT, THREAD) criteria are refused with BAD [UIDREQUIRED],
|
|
11
|
+
* @help UIDFETCH responses replace FETCH responses and VANISHED replaces EXPUNGE.
|
|
12
|
+
* @help Load UIDPLUS for COPYUID and UID EXPUNGE
|
|
13
|
+
*
|
|
14
|
+
* UIDONLY: https://www.rfc-editor.org/rfc/rfc9586
|
|
15
|
+
*/
|
|
16
|
+
function uidonlyPlugin(server) {
|
|
17
|
+
server.registerCapability('UIDONLY');
|
|
18
|
+
(0, enable_js_1.registerEnable)(server, 'UIDONLY');
|
|
19
|
+
// UNAUTHENTICATE clears the ENABLEd extensions (RFC 8437 section 4.1)
|
|
20
|
+
const isUidonly = (connection) => (0, enable_js_1.isEnabled)(connection, 'UIDONLY');
|
|
21
|
+
const refuse = (text) => ({ command: 'BAD', code: 'UIDREQUIRED', text });
|
|
22
|
+
// RFC 9586 section 3: once UIDONLY is enabled, message numbers in any argument MUST be answered with a
|
|
23
|
+
// tagged BAD that has the UIDREQUIRED response code
|
|
24
|
+
const getRefusal = (connection, parsed) => {
|
|
25
|
+
const command = String(parsed.command || '').toUpperCase();
|
|
26
|
+
const options = server.getCommandOptions(command);
|
|
27
|
+
// the ESEARCH command of MULTISEARCH always returns UIDs (RFC 7377 section 2), like a UID command
|
|
28
|
+
const isUid = /^UID /.test(command) || command === 'ESEARCH';
|
|
29
|
+
// sections 3.2 and 3.8: FETCH, STORE, SEARCH, COPY, MOVE, SORT and THREAD are prohibited, also REPLACE
|
|
30
|
+
// (RFC 8508), its message argument is a sequence number. These have the sequenceSet or searchCriteria
|
|
31
|
+
// command option
|
|
32
|
+
if (!isUid && (options.sequenceSet !== false || options.searchCriteria !== false)) {
|
|
33
|
+
return refuse(command + ' is not allowed once UIDONLY is enabled, use UID ' + command);
|
|
34
|
+
}
|
|
35
|
+
// section 3.5: the <sequence set> search key is prohibited, also in UID SORT and UID THREAD
|
|
36
|
+
if (isUid && options.searchCriteria !== false && connection.usesSequenceNumbers(parsed)) {
|
|
37
|
+
return refuse('Message numbers are not allowed in the search criteria once UIDONLY is enabled, use UID <sequence set>');
|
|
38
|
+
}
|
|
39
|
+
// section 3.7: the fourth QRESYNC parameter (message sequence match data) MUST NOT be used
|
|
40
|
+
if ((command === 'SELECT' || command === 'EXAMINE') && parsed.attributes && Array.isArray(parsed.attributes[1])) {
|
|
41
|
+
const params = parsed.attributes[1];
|
|
42
|
+
const position = params.findIndex((param) => (0, arguments_js_1.isAtom)(param, 'QRESYNC'));
|
|
43
|
+
const value = position >= 0 && params[position + 1];
|
|
44
|
+
if (Array.isArray(value) && value.slice(2).some(Array.isArray)) {
|
|
45
|
+
return refuse('QRESYNC message sequence match data is not allowed once UIDONLY is enabled');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
};
|
|
50
|
+
server.commandChecks.push((connection, parsed) => isUidonly(connection) && getRefusal(connection, parsed));
|
|
51
|
+
// a prohibited command is refused before its literal is sent, before other checks that would answer NO
|
|
52
|
+
server.literalFilters.unshift((connection, command) => isUidonly(connection) && getRefusal(connection, { command }));
|
|
53
|
+
server.connectionHandlers.push((connection) => {
|
|
54
|
+
// RFC 3501 section 5.5 is about commands with message numbers, these are all refused with
|
|
55
|
+
// BAD [UIDREQUIRED] once UIDONLY is enabled, as if they had waited
|
|
56
|
+
const isAmbiguous = connection.isAmbiguous;
|
|
57
|
+
connection.isAmbiguous = function (parsed) {
|
|
58
|
+
return !isUidonly(this) && isAmbiguous.call(this, parsed);
|
|
59
|
+
};
|
|
60
|
+
// RFC 9586 sections 3.4 and 3.6: expunges are announced with VANISHED instead of EXPUNGE, EXISTS and
|
|
61
|
+
// RECENT stay as they are
|
|
62
|
+
const prepareNotifications = connection.prepareNotifications;
|
|
63
|
+
connection.prepareNotifications = function (queue) {
|
|
64
|
+
queue = prepareNotifications.call(this, queue);
|
|
65
|
+
return isUidonly(this) ? (0, vanished_js_1.toVanished)(queue) : queue;
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
// RFC 9586 section 3: the server MUST NOT return message sequence numbers in any response
|
|
69
|
+
const outputHandler = (connection, response, description, parsed, data, extra) => {
|
|
70
|
+
if (!response || response.tag !== '*' || !Array.isArray(response.attributes) || !isUidonly(connection)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const attributes = response.attributes;
|
|
74
|
+
// the UNSEEN response code of SELECT and EXAMINE is a message number (RFC 3501 section 7.1)
|
|
75
|
+
if (response.command === 'OK' && attributes[0] && attributes[0].type === 'SECTION' && (0, arguments_js_1.isAtom)(attributes[0].section[0], 'UNSEEN')) {
|
|
76
|
+
response.skipResponse = true;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (!(0, arguments_js_1.isAtom)(attributes[1], 'FETCH') || !Array.isArray(attributes[2])) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// section 3.3: uidfetch-resp = uniqueid SP "UIDFETCH" SP msg-att
|
|
83
|
+
// FETCH responses pass their message as `extra`, notifications like the MessageNew FETCH of NOTIFY carry it
|
|
84
|
+
const list = attributes[2];
|
|
85
|
+
const uidPos = list.findIndex((item, i) => !(i % 2) && (0, arguments_js_1.isAtom)(item, 'UID'));
|
|
86
|
+
const message = (extra && typeof extra.uid === 'number' && extra) || response.fetchedMessage;
|
|
87
|
+
const uid = message ? message.uid : uidPos >= 0 && list[uidPos + 1];
|
|
88
|
+
if (!uid) {
|
|
89
|
+
// never send a sequence number instead
|
|
90
|
+
response.skipResponse = true;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// the UID data item is only included if the client asked for it, like in the examples of section 3.3
|
|
94
|
+
if (parsed && !('uidonlyKeepUid' in parsed)) {
|
|
95
|
+
parsed.uidonlyKeepUid = requestsUid(parsed);
|
|
96
|
+
}
|
|
97
|
+
let items = list;
|
|
98
|
+
if (uidPos >= 0 && list.length > 2 && !(parsed && parsed.uidonlyKeepUid)) {
|
|
99
|
+
items = list.slice(0, uidPos).concat(list.slice(uidPos + 2));
|
|
100
|
+
}
|
|
101
|
+
response.attributes = [uid, { type: 'ATOM', value: 'UIDFETCH' }, items];
|
|
102
|
+
};
|
|
103
|
+
// registered once every plugin is loaded, so that the other output handlers see the FETCH responses they
|
|
104
|
+
// know before these are turned into UIDFETCH responses
|
|
105
|
+
server.once('pluginsLoaded', () => server.outputHandlers.push(outputHandler));
|
|
106
|
+
}
|
|
107
|
+
// Checks if a UID FETCH command lists the UID data item
|
|
108
|
+
function requestsUid(parsed) {
|
|
109
|
+
if (String(parsed.command || '').toUpperCase() !== 'UID FETCH' || !parsed.attributes) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return [].concat(parsed.attributes[1] || []).some(item => (0, arguments_js_1.isAtom)(item, 'UID'));
|
|
113
|
+
}
|
|
114
|
+
uidonlyPlugin.requires = ['ENABLE'];
|
|
115
|
+
{
|
|
116
|
+
const defaultExport = exports.default;
|
|
117
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
118
|
+
for (const key of Object.keys(exports)) {
|
|
119
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
120
|
+
defaultExport[key] = exports[key];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
124
|
+
module.exports = defaultExport;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IMAPServer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @help Adds UIDPLUS [RFC4315] capability
|
|
4
|
+
*
|
|
5
|
+
* UIDPLUS: http://tools.ietf.org/html/rfc4315
|
|
6
|
+
*
|
|
7
|
+
* Additional commands:
|
|
8
|
+
* - UID EXPUNGE
|
|
9
|
+
*
|
|
10
|
+
* Additional response codes:
|
|
11
|
+
* - APPENDUID (with a UID set for MULTIAPPEND, and in an untagged OK for REPLACE)
|
|
12
|
+
* - COPYUID
|
|
13
|
+
* - Not implemented: UIDNOTSTICKY
|
|
14
|
+
*/
|
|
15
|
+
export default function uidplusPlugin(server: IMAPServer): void;
|