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,876 @@
|
|
|
1
|
+
import { Stream } from 'node:stream';
|
|
2
|
+
import net from 'node:net';
|
|
3
|
+
import tls from 'node:tls';
|
|
4
|
+
import type { CompilerOptions, ParserOptions } from 'imap-handler';
|
|
5
|
+
import type { ResolvedCommandOptions } from './command-states.js';
|
|
6
|
+
import type { AppendCheck, AppendCheckOptions, AppendDataHandler, AppendMessage, CapabilityCheck, CheckResult, ClosedCheck, CommandCheck, CommandContext, CommandOptions, CommandHandler, ConnectionHandler, ConnectionState, CopyHandler, FetchHandler, IMAPResponse, IMAPServerOptions, ListedMailbox, LiteralFilter, Mailbox, MailboxHandler, MailboxStatus, Message, MessageFilter, MessageHandler, MessageRange, Namespace, Notification, NotifyEvent, NotifyFilter, OutputHandler, ParsedCommand, RangeLimit, Refusal, SearchAccessCheck, SearchHandler, SearchLimit, ServerStorage, StatusHandler, StorageMailbox, StorageMessage, StoreHandler, SubscriptionStandIn, Transport, UrlAccessCheck, UserData } from './types.js';
|
|
7
|
+
declare const TAG_REGEX: RegExp;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new IMAP server, call `listen()` on it to start accepting connections
|
|
10
|
+
*
|
|
11
|
+
* @param options Server options, the mailbox tree comes from `options.storage`
|
|
12
|
+
* @return Server instance
|
|
13
|
+
*/
|
|
14
|
+
export default function server(options?: IMAPServerOptions): IMAPServer;
|
|
15
|
+
declare class IMAPServer extends Stream {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
options: IMAPServerOptions;
|
|
18
|
+
server: net.Server | tls.Server;
|
|
19
|
+
connections: Set<IMAPConnection>;
|
|
20
|
+
connectionHandlers: ConnectionHandler[];
|
|
21
|
+
resetHandlers: ConnectionHandler[];
|
|
22
|
+
outputHandlers: OutputHandler[];
|
|
23
|
+
messageHandlers: MessageHandler[];
|
|
24
|
+
fetchHandlers: Record<string, FetchHandler>;
|
|
25
|
+
fetchFilters: MessageFilter[];
|
|
26
|
+
searchHandlers: Record<string, SearchHandler>;
|
|
27
|
+
storeHandlers: Record<string, StoreHandler>;
|
|
28
|
+
storeFilters: MessageFilter[];
|
|
29
|
+
notifyFilters: NotifyFilter[];
|
|
30
|
+
mailboxHandlers: MailboxHandler[];
|
|
31
|
+
appendChecks: AppendCheck[];
|
|
32
|
+
copyHandlers: CopyHandler[];
|
|
33
|
+
appendDataHandlers: Record<string, AppendDataHandler>;
|
|
34
|
+
literalFilters: LiteralFilter[];
|
|
35
|
+
urlAccessChecks: UrlAccessCheck[];
|
|
36
|
+
searchAccessChecks: SearchAccessCheck[];
|
|
37
|
+
commandChecks: CommandCheck[];
|
|
38
|
+
rangeLimits: RangeLimit[];
|
|
39
|
+
searchLimits: SearchLimit[];
|
|
40
|
+
closedChecks: ClosedCheck[];
|
|
41
|
+
multiAppend: boolean;
|
|
42
|
+
/** set by BINARY (RFC 3516 section 4.4), converts the octets of an APPEND literal8 to the stored message source */
|
|
43
|
+
appendLiteral8?: ((raw: string) => string) | undefined;
|
|
44
|
+
commandHandlers: Record<string, CommandHandler>;
|
|
45
|
+
commandOptions: Record<string, ResolvedCommandOptions>;
|
|
46
|
+
capabilities: Record<string, CapabilityCheck>;
|
|
47
|
+
allowedStatus: string[];
|
|
48
|
+
statusHandlers: Record<string, StatusHandler>;
|
|
49
|
+
literalPlus: boolean;
|
|
50
|
+
nonSyncLiteralLimit: number;
|
|
51
|
+
parserOptions: ParserOptions;
|
|
52
|
+
/** the personal namespace that an empty LIST reference stands for, set by indexFolders() */
|
|
53
|
+
referenceNamespace: string | false;
|
|
54
|
+
activeConnection: IMAPConnection | null;
|
|
55
|
+
users: Record<string, UserData>;
|
|
56
|
+
systemFlags: string[];
|
|
57
|
+
storage: ServerStorage;
|
|
58
|
+
uidvalidityCounter: number;
|
|
59
|
+
subscriptions: Set<string>;
|
|
60
|
+
folderCache: Record<string, Mailbox>;
|
|
61
|
+
constructor(options?: IMAPServerOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Starts accepting connections, takes the arguments of `net.Server#listen()`
|
|
64
|
+
*/
|
|
65
|
+
listen(port?: number, listeningListener?: () => void): void;
|
|
66
|
+
listen(port: number, hostname: string, listeningListener?: () => void): void;
|
|
67
|
+
listen(options: net.ListenOptions, listeningListener?: () => void): void;
|
|
68
|
+
close(callback?: (err?: Error) => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Returns TLS key and certificate. Without credentials in the options the
|
|
71
|
+
* bundled self-signed certificate for localhost is used.
|
|
72
|
+
*
|
|
73
|
+
* @return {Object} TLS options
|
|
74
|
+
*/
|
|
75
|
+
getCredentials(): {
|
|
76
|
+
key: string | Buffer;
|
|
77
|
+
cert: string | Buffer;
|
|
78
|
+
};
|
|
79
|
+
address(): ReturnType<net.Server['address']>;
|
|
80
|
+
createClient(socket: net.Socket): void;
|
|
81
|
+
registerCapability(keyword: string, handler?: CapabilityCheck | null): void;
|
|
82
|
+
/**
|
|
83
|
+
* Sets the handler of a command
|
|
84
|
+
*
|
|
85
|
+
* @param {String} command Command name, e.g. "UID MOVE"
|
|
86
|
+
* @param {Function} handler Command handler `(connection, parsed, data, callback)`
|
|
87
|
+
* @param {Object|Array} [options] `{ states, noArguments, mailboxArguments, astringArguments, searchCriteria, sequenceSet,
|
|
88
|
+
* noExpunge, literal8, noPipelining }`: the connection states the command is valid in (any state if not set), if it takes
|
|
89
|
+
* no arguments, the positions of its mailbox name arguments and of its other astring arguments, the position where its search criteria start, the position of its argument
|
|
90
|
+
* with message sequence numbers, if EXPUNGE responses
|
|
91
|
+
* are not allowed while it runs, if it accepts literal8 arguments (true, or the name of the capability that
|
|
92
|
+
* allows them), and if it is refused when the client sent more input after it. A list is read as the states.
|
|
93
|
+
* Without options, a command keeps its earlier settings
|
|
94
|
+
*/
|
|
95
|
+
setCommandHandler(command: string, handler: CommandHandler, options?: CommandOptions | string[] | null): void;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the options of a command, see setCommandHandler
|
|
98
|
+
*
|
|
99
|
+
* @param {String} command Command name
|
|
100
|
+
* @return {Object} the command options, see setCommandHandler, states is false if any state is fine
|
|
101
|
+
*/
|
|
102
|
+
getCommandOptions(command: string | null | undefined): ResolvedCommandOptions;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the connection states a command may be used in. Public API for custom plugins (see README), the server
|
|
105
|
+
* itself reads getCommandOptions
|
|
106
|
+
*
|
|
107
|
+
* @param {String} command Command name
|
|
108
|
+
* @return {Array|Boolean} List of states, or false if any state is fine
|
|
109
|
+
*/
|
|
110
|
+
getCommandStates(command: string): string[] | false;
|
|
111
|
+
/**
|
|
112
|
+
* Returns a user account
|
|
113
|
+
*
|
|
114
|
+
* @param {String} username User name
|
|
115
|
+
* @return {Object|false} User data or false if there is no such user
|
|
116
|
+
*/
|
|
117
|
+
getUser(username: unknown): UserData | false;
|
|
118
|
+
/**
|
|
119
|
+
* Returns a mailbox object from folderCache
|
|
120
|
+
*
|
|
121
|
+
* @param {String} path Pathname for the mailbox
|
|
122
|
+
* @return {Object} mailbox object or undefined
|
|
123
|
+
*/
|
|
124
|
+
getMailbox(path: string): Mailbox | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Schedules a notifying message
|
|
127
|
+
*
|
|
128
|
+
* @param {Object} command An object of untagged response message
|
|
129
|
+
* @param {Object|String} mailbox Mailbox the message is related to
|
|
130
|
+
* @param {Object} ignoreConnection if set the selected connection ignores this notification
|
|
131
|
+
* @param {Function} [filter] if set, only connections for which `filter(connection)` is true get the notification
|
|
132
|
+
*/
|
|
133
|
+
notify(command: Notification, mailbox: Mailbox | string | false | null | undefined, ignoreConnection?: IMAPConnection | false | null, filter?: ((connection: IMAPConnection) => boolean) | false | null): void;
|
|
134
|
+
/**
|
|
135
|
+
* Tells plugins that a mailbox was created, deleted, renamed, subscribed or unsubscribed, with a
|
|
136
|
+
* `mailbox` event: `{ type, path, oldPath, mailbox, origin }`. `type` is "create", "delete", "rename",
|
|
137
|
+
* "subscribe" or "unsubscribe", `origin` is the session that made the change
|
|
138
|
+
*
|
|
139
|
+
* @param {String} type Kind of change
|
|
140
|
+
* @param {String} path Storage name of the mailbox
|
|
141
|
+
* @param {Object} [details] `{ oldPath, mailbox }`: the earlier name of a renamed mailbox, the mailbox
|
|
142
|
+
* object that a DELETE removed
|
|
143
|
+
*/
|
|
144
|
+
mailboxChanged(type: string, path: string, details?: {
|
|
145
|
+
oldPath?: string | undefined;
|
|
146
|
+
mailbox?: Mailbox | undefined;
|
|
147
|
+
}): void;
|
|
148
|
+
/**
|
|
149
|
+
* Retrieves the handler of an IMAP command
|
|
150
|
+
*
|
|
151
|
+
* @param {String} command Command name
|
|
152
|
+
* @return {Function} handler for the specified command
|
|
153
|
+
*/
|
|
154
|
+
getCommandHandler(command: string | null | undefined): CommandHandler | false;
|
|
155
|
+
/**
|
|
156
|
+
* Returns some useful information about a mailbox that can be used with STATUS, SELECT and EXAMINE
|
|
157
|
+
*
|
|
158
|
+
* @param {Object|String} mailbox Mailbox object or path
|
|
159
|
+
*/
|
|
160
|
+
getStatus(path: Mailbox | string): MailboxStatus | false;
|
|
161
|
+
/**
|
|
162
|
+
* Validates a date value. Useful for validating APPEND dates
|
|
163
|
+
*
|
|
164
|
+
* @param {String} date Date value to be validated
|
|
165
|
+
* @return {Boolean} Returns true if the date string is in IMAP date-time format
|
|
166
|
+
*/
|
|
167
|
+
validateInternalDate(date: unknown): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Converts a date object to a valid date-time string format
|
|
170
|
+
*
|
|
171
|
+
* @param {Object} date Date object to be converted
|
|
172
|
+
* @return {String} Returns a valid date-time formatted string
|
|
173
|
+
*/
|
|
174
|
+
formatInternalDate(date: Date): string;
|
|
175
|
+
/**
|
|
176
|
+
* Creates a mailbox with specified path
|
|
177
|
+
*
|
|
178
|
+
* @param {String} path Pathname for the mailbox
|
|
179
|
+
* @param {Object} [defaultMailbox] use this object as the mailbox to add instead of empty'
|
|
180
|
+
* @return {Object} the created mailbox
|
|
181
|
+
*/
|
|
182
|
+
createMailbox(path: string, defaultMailbox?: StorageMailbox | null): Mailbox;
|
|
183
|
+
/**
|
|
184
|
+
* Deletes a mailbox with specified path
|
|
185
|
+
*
|
|
186
|
+
* @param {String} path Pathname for the mailbox
|
|
187
|
+
* @param {boolean} keepContents If true do not delete messages
|
|
188
|
+
*/
|
|
189
|
+
deleteMailbox(path: string, keepContents?: boolean): void;
|
|
190
|
+
/**
|
|
191
|
+
* Finds the personal namespace that a new or existing mailbox name belongs to, for CREATE and DELETE
|
|
192
|
+
*
|
|
193
|
+
* @param {String} path Mailbox path
|
|
194
|
+
* @return {Object} `{ namespace, storage }`, the namespace key and its storage object
|
|
195
|
+
* @throws {Error} CANNOT for a namespace prefix or a name in no namespace, NOPERM outside personal namespaces
|
|
196
|
+
*/
|
|
197
|
+
getPersonalNamespace(path: string): {
|
|
198
|
+
namespace: string;
|
|
199
|
+
storage: Namespace;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Removes a trailing hierarchy separator from a mailbox name, "foo/" names the mailbox "foo"
|
|
203
|
+
*
|
|
204
|
+
* @param {String} path Mailbox path
|
|
205
|
+
* @param {String} separator Hierarchy separator
|
|
206
|
+
* @return {String} path without the separator at the end
|
|
207
|
+
*/
|
|
208
|
+
stripSeparator(path: string, separator: string): string;
|
|
209
|
+
/**
|
|
210
|
+
* Checks if the personal namespace is below INBOX (e.g. "INBOX."), then the mailboxes of that namespace are
|
|
211
|
+
* the children of INBOX
|
|
212
|
+
*
|
|
213
|
+
* @return {Boolean} true if the reference namespace is INBOX followed by the separator
|
|
214
|
+
*/
|
|
215
|
+
inboxHoldsNamespace(): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Rebuilds folderCache and the path, namespace and flags of every mailbox from storage.
|
|
218
|
+
* INBOX has its own namespace
|
|
219
|
+
*
|
|
220
|
+
* @param {Boolean} [processMessages] If true, messages are prepared as well. Only needed for
|
|
221
|
+
* messages from the initial storage, as message handlers must not run twice for a message
|
|
222
|
+
*/
|
|
223
|
+
indexFolders(processMessages?: boolean): void;
|
|
224
|
+
/**
|
|
225
|
+
* Ensures uid, flags and internaldate for every message of a mailbox and
|
|
226
|
+
* keeps the message list ordered by UID
|
|
227
|
+
*
|
|
228
|
+
* @param {Object} mailbox Mailbox object
|
|
229
|
+
*/
|
|
230
|
+
processMessages(mailbox: Mailbox): void;
|
|
231
|
+
/**
|
|
232
|
+
* Sets the path, namespace, flags and counters of a mailbox from storage or a new one, and runs the
|
|
233
|
+
* mailbox handlers of plugins on it
|
|
234
|
+
*
|
|
235
|
+
* @param path Mailbox path
|
|
236
|
+
* @param mailbox Mailbox object, completed in place
|
|
237
|
+
* @param namespace Namespace key of the mailbox
|
|
238
|
+
*/
|
|
239
|
+
processMailbox(path: string, mailbox: StorageMailbox, namespace: string): asserts mailbox is Mailbox;
|
|
240
|
+
/**
|
|
241
|
+
* Makes `mailbox.subscribed` read and change the subscription of the mailbox name in
|
|
242
|
+
* `server.subscriptions`, so that the subscription stays with the name when the mailbox is deleted
|
|
243
|
+
* or renamed (RFC 3501 section 6.3.6, RFC 9051 section 6.3.6). A `subscribed` value the mailbox
|
|
244
|
+
* already has (from storage) is moved over to the subscription list.
|
|
245
|
+
*
|
|
246
|
+
* @param {Object} mailbox Mailbox object, its `path` is read whenever the subscription is used
|
|
247
|
+
* @param {Boolean} [defaultValue] Subscription of a mailbox without a `subscribed` value. If not
|
|
248
|
+
* set, the subscription list is left as it is
|
|
249
|
+
*/
|
|
250
|
+
trackSubscription(mailbox: StorageMailbox, defaultValue?: boolean): void;
|
|
251
|
+
/**
|
|
252
|
+
* Sets the stored children attribute of a mailbox (RFC 3348 section 3). A \Noinferiors mailbox gets
|
|
253
|
+
* neither, \Noinferiors already implies \HasNoChildren (RFC 5258 section 3.4)
|
|
254
|
+
*
|
|
255
|
+
* @param {Object} mailbox Mailbox object
|
|
256
|
+
* @param {Boolean} hasChildren true if the mailbox has child mailboxes
|
|
257
|
+
*/
|
|
258
|
+
setChildrenFlags(mailbox: Mailbox, hasChildren: boolean): void;
|
|
259
|
+
/**
|
|
260
|
+
* Ensures that a list of flags includes selected flag
|
|
261
|
+
*
|
|
262
|
+
* @param {Array} flags An array of flags to check
|
|
263
|
+
* @param {String} flag If the flag is missing, add it
|
|
264
|
+
*/
|
|
265
|
+
ensureFlag(flags: string[], flag: string): void;
|
|
266
|
+
/**
|
|
267
|
+
* Removes a flag from a list of flags
|
|
268
|
+
*
|
|
269
|
+
* @param {Array} flags An array of flags to check
|
|
270
|
+
* @param {String} flag If the flag is in the list, remove it
|
|
271
|
+
*/
|
|
272
|
+
removeFlag(flags: string[], flag: string): void;
|
|
273
|
+
/**
|
|
274
|
+
* Remembers the flags of a message as flags of the mailbox. A keyword stays in the FLAGS and
|
|
275
|
+
* PERMANENTFLAGS of the mailbox after the last message with it is expunged or loses it, like a
|
|
276
|
+
* keyword a client defined (RFC 3501 section 2.3.2, FLAGS lists the flags applicable for the
|
|
277
|
+
* mailbox, section 7.2.6)
|
|
278
|
+
*
|
|
279
|
+
* @param {Object} mailbox Mailbox object
|
|
280
|
+
* @param {Array} flags Flags of a message
|
|
281
|
+
*/
|
|
282
|
+
rememberFlags(mailbox: Mailbox, flags: string[]): void;
|
|
283
|
+
/**
|
|
284
|
+
* Converts a date-time value from storage or a client to the form it is sent in
|
|
285
|
+
*
|
|
286
|
+
* @param {Date|String} value Date object or date-time string
|
|
287
|
+
* @return {String|*} date-time string, other values are returned as they are
|
|
288
|
+
*/
|
|
289
|
+
normalizeDateTime(value: string | Date): string;
|
|
290
|
+
normalizeDateTime(value: unknown): unknown;
|
|
291
|
+
/**
|
|
292
|
+
* Sets the UID, flags, internal date and source of a message from storage or a new one, and runs the
|
|
293
|
+
* message handlers of plugins on it
|
|
294
|
+
*
|
|
295
|
+
* @param message Message object, completed in place
|
|
296
|
+
* @param mailbox Mailbox of the message
|
|
297
|
+
*/
|
|
298
|
+
processMessage(message: StorageMessage, mailbox: Mailbox): asserts message is Message;
|
|
299
|
+
/**
|
|
300
|
+
* Appends a message to a mailbox
|
|
301
|
+
*
|
|
302
|
+
* @param {Object|String} mailbox Mailbox to append to
|
|
303
|
+
* @param {Array} flags Flags for the message
|
|
304
|
+
* @param {String|Date} internaldate Receive date-time for the message
|
|
305
|
+
* @param {String} raw Message source
|
|
306
|
+
* @param {Object} [ignoreConnection] To not advertise new message to selected connection
|
|
307
|
+
* @param {Object} [properties] More properties of the new message, set before message handlers run
|
|
308
|
+
* @return An object of the form { mailbox, message }
|
|
309
|
+
*/
|
|
310
|
+
appendMessage(path: Mailbox | string, flags: string[], internaldate: string | Date | false | null | undefined, raw: string, ignoreConnection?: IMAPConnection | false | null, properties?: Record<string, any>): {
|
|
311
|
+
mailbox: Mailbox;
|
|
312
|
+
message: Message;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Copies a message to a mailbox (COPY, MOVE, RENAME INBOX). The copy is a new message that
|
|
316
|
+
* keeps the flags, internal date and content of the source. `copyHandlers` can carry over more
|
|
317
|
+
* properties of the source, they run before the message handlers see the copy
|
|
318
|
+
*
|
|
319
|
+
* @param {Object} mailbox Target mailbox
|
|
320
|
+
* @param {Object} source Message to copy
|
|
321
|
+
* @return An object of the form { mailbox, message }
|
|
322
|
+
*/
|
|
323
|
+
copyMessage(mailbox: Mailbox, source: Message): {
|
|
324
|
+
mailbox: Mailbox;
|
|
325
|
+
message: Message;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Returns the namespace a mailbox path belongs to by its prefix, INBOX not included
|
|
329
|
+
*
|
|
330
|
+
* @param {String} path Mailbox path, it does not have to exist
|
|
331
|
+
* @return {String|Boolean} the longest matching namespace key, or false
|
|
332
|
+
*/
|
|
333
|
+
getNamespace(path: string): string | false;
|
|
334
|
+
/**
|
|
335
|
+
* Checks if messages can be added to a mailbox (APPEND, COPY, MOVE). TRYCREATE tells the client that CREATE would
|
|
336
|
+
* help (RFC 3501 sections 6.3.11 and 6.4.7), also for a \\Noselect name, which CREATE turns into a mailbox (RFC 9051
|
|
337
|
+
* sections 6.3.12 and 6.4.7: unless it is certain that the target can not be created)
|
|
338
|
+
*
|
|
339
|
+
* @param {String} path Storage name of the target mailbox
|
|
340
|
+
* @return {Object|Boolean} `{ command, code, text }` of the refusal, or false if the mailbox can take messages
|
|
341
|
+
*/
|
|
342
|
+
targetRefusal(path: string): Refusal | false;
|
|
343
|
+
/**
|
|
344
|
+
* Returns the namespace of a mailbox name: "INBOX" for INBOX, the namespace of the mailbox if it
|
|
345
|
+
* exists (the children of INBOX belong to the personal namespace), otherwise the one of its prefix
|
|
346
|
+
*
|
|
347
|
+
* @param {String|Object} path Mailbox path, it does not have to exist, or a mailbox object
|
|
348
|
+
* @return {String|Boolean} namespace key, or false if the name is in no namespace
|
|
349
|
+
*/
|
|
350
|
+
getMailboxNamespace(path: string | {
|
|
351
|
+
namespace: string | false;
|
|
352
|
+
}): string | false;
|
|
353
|
+
/**
|
|
354
|
+
* Checks if a mailbox name is in a personal namespace, INBOX included
|
|
355
|
+
*
|
|
356
|
+
* @param {String|Object} path Mailbox path, it does not have to exist, or a mailbox object
|
|
357
|
+
* @return {Boolean} true for a personal mailbox
|
|
358
|
+
*/
|
|
359
|
+
isPersonal(path: string | {
|
|
360
|
+
namespace: string | false;
|
|
361
|
+
}): boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Returns the hierarchy separator of a mailbox name, from its namespace
|
|
364
|
+
*
|
|
365
|
+
* @param {String|Object} path Mailbox path, it does not have to exist, or a mailbox object
|
|
366
|
+
* @return {String} separator
|
|
367
|
+
*/
|
|
368
|
+
getSeparator(path: string | {
|
|
369
|
+
namespace: string | false;
|
|
370
|
+
}): string;
|
|
371
|
+
/**
|
|
372
|
+
* Returns the name one hierarchy level up from a mailbox name. A trailing separator is ignored, the
|
|
373
|
+
* prefix of a namespace (e.g. "#shared" of "#shared/") is not a mailbox name
|
|
374
|
+
*
|
|
375
|
+
* @param {String} path Mailbox path, it does not have to exist
|
|
376
|
+
* @return {String|Boolean} parent name, "INBOX" for the children of INBOX, or false at the top level
|
|
377
|
+
*/
|
|
378
|
+
getParentPath(path: string): string | false;
|
|
379
|
+
/**
|
|
380
|
+
* Returns the mailboxes below a mailbox name, at any depth
|
|
381
|
+
*
|
|
382
|
+
* @param {String} path Mailbox path
|
|
383
|
+
* @param {Object} [folders] Mailboxes to choose from by path, defaults to all mailboxes (folderCache)
|
|
384
|
+
* @return {Array} mailbox objects
|
|
385
|
+
*/
|
|
386
|
+
getDescendants(path: string): Mailbox[];
|
|
387
|
+
getDescendants<T extends ListedMailbox>(path: string, folders: Record<string, T> | null | undefined): T[];
|
|
388
|
+
/**
|
|
389
|
+
* Checks if any mailbox below a mailbox name passes a test, stops at the first one that does
|
|
390
|
+
*
|
|
391
|
+
* @param {String} path Mailbox path
|
|
392
|
+
* @param {Function} predicate `(mailbox)` returns true for a match
|
|
393
|
+
* @return {Boolean} true if a mailbox below the name matches
|
|
394
|
+
*/
|
|
395
|
+
hasDescendant(path: string, predicate: (mailbox: Mailbox) => unknown): boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Returns the mailbox attributes of a LIST response with computed children attributes (RFC 3348, RFC 5258
|
|
398
|
+
* section 4), for extended and unsolicited LIST responses. The stored \HasChildren and \HasNoChildren are
|
|
399
|
+
* replaced, a name that does not exist is \NonExistent (RFC 5258 section 3, it implies \Noselect)
|
|
400
|
+
*
|
|
401
|
+
* @param {Object} [mailbox] Mailbox object, can be left out for a name that does not exist
|
|
402
|
+
* @param {Object} options `{ exists, subscribed, hasChildren, extra }`: false `exists` lists the name as
|
|
403
|
+
* \NonExistent, `subscribed` adds \Subscribed, `extra` lists more attributes (e.g. \NoAccess)
|
|
404
|
+
* @return {Array} attribute names
|
|
405
|
+
*/
|
|
406
|
+
listAttributes(mailbox: {
|
|
407
|
+
flags?: string[] | undefined;
|
|
408
|
+
} | null | undefined, options: {
|
|
409
|
+
exists?: boolean | undefined;
|
|
410
|
+
subscribed?: boolean | undefined;
|
|
411
|
+
hasChildren?: boolean | undefined;
|
|
412
|
+
extra?: string[] | undefined;
|
|
413
|
+
}): string[];
|
|
414
|
+
/**
|
|
415
|
+
* Lists the mailboxes that match a LIST or LSUB reference and pattern (RFC 3501 section 6.3.8)
|
|
416
|
+
*
|
|
417
|
+
* @param {String} reference Reference name
|
|
418
|
+
* @param {String} match Mailbox name with possible wildcards
|
|
419
|
+
* @param {Function} [exportName] Converts storage names to the form the client uses, so that the
|
|
420
|
+
* wildcards match whole characters, see IMAPConnection#exportMailboxName
|
|
421
|
+
* @param {Object} [folders] Mailboxes to choose from by path, defaults to all mailboxes (folderCache)
|
|
422
|
+
* @return {Array} Matching mailbox objects
|
|
423
|
+
*/
|
|
424
|
+
matchFolders(reference: string | null | undefined, match: string, exportName?: ((name: string) => string) | null): Mailbox[];
|
|
425
|
+
matchFolders<T extends ListedMailbox>(reference: string | null | undefined, match: string, exportName: ((name: string) => string) | null | undefined, folders: Record<string, T> | null | undefined): T[];
|
|
426
|
+
/**
|
|
427
|
+
* Returns the subscribed names with their superior hierarchy levels, for LSUB and LIST (SUBSCRIBED).
|
|
428
|
+
* Names that are not mailboxes get a stand-in object with \Noselect, which LIST-EXTENDED reports as
|
|
429
|
+
* \NonExistent (RFC 5258 section 3), and `subscribed` false for a level that is only listed because
|
|
430
|
+
* of a subscribed name below it
|
|
431
|
+
*
|
|
432
|
+
* @return {Object} path to mailbox object or stand-in, usable as the `folders` of matchFolders
|
|
433
|
+
*/
|
|
434
|
+
getSubscriptionTree(): Record<string, Mailbox | SubscriptionStandIn>;
|
|
435
|
+
/**
|
|
436
|
+
* Retrieves an array of messages that fit in the specified range criteria
|
|
437
|
+
*
|
|
438
|
+
* @param {Object|String} mailbox Mailbox to look for the messages
|
|
439
|
+
* @param {String} range Message range (eg. "*:4,5,7:9")
|
|
440
|
+
* @param {Boolean} isUid If true, use UID values, not sequence indexes for comparison
|
|
441
|
+
* @return {Array} An array of messages in the form of [[seqIndex, message]]
|
|
442
|
+
*/
|
|
443
|
+
getMessageRange(source: Mailbox | Message[] | string, sequence: string | number | null | undefined, isUid: boolean): MessageRange;
|
|
444
|
+
}
|
|
445
|
+
/** A queued client command */
|
|
446
|
+
interface QueuedCommand {
|
|
447
|
+
parsed: ParsedCommand;
|
|
448
|
+
data: string;
|
|
449
|
+
}
|
|
450
|
+
declare class IMAPConnection {
|
|
451
|
+
[key: string]: any;
|
|
452
|
+
server: IMAPServer;
|
|
453
|
+
socket: net.Socket | null;
|
|
454
|
+
options: IMAPServerOptions;
|
|
455
|
+
state: ConnectionState;
|
|
456
|
+
/** the authenticated user, set by LOGIN and the AUTHENTICATE plugins */
|
|
457
|
+
username: string | false | undefined;
|
|
458
|
+
selectedMailbox: Mailbox | false | undefined;
|
|
459
|
+
readOnly: boolean | undefined;
|
|
460
|
+
/** messages that are \Recent in this session, while a mailbox is selected */
|
|
461
|
+
recent: Set<Message> | null | undefined;
|
|
462
|
+
everSelected: boolean | undefined;
|
|
463
|
+
secureConnection: boolean;
|
|
464
|
+
upgrading: boolean | undefined;
|
|
465
|
+
/** takes over raw input lines from the command parser (IDLE, AUTHENTICATE) */
|
|
466
|
+
inputHandler: ((line: string) => void) | false;
|
|
467
|
+
transport: Transport | null;
|
|
468
|
+
parserOptions: ParserOptions;
|
|
469
|
+
compilerOptions: CompilerOptions;
|
|
470
|
+
messageGlobal: boolean;
|
|
471
|
+
/** notifications are sent right away instead of before the next tagged response (IDLE) */
|
|
472
|
+
directNotifications: boolean;
|
|
473
|
+
notificationQueue: Notification[];
|
|
474
|
+
_remainder: string;
|
|
475
|
+
_command: string;
|
|
476
|
+
_literalRemaining: number;
|
|
477
|
+
_commandQueue: QueuedCommand[];
|
|
478
|
+
_processing: boolean;
|
|
479
|
+
_runningCommand: QueuedCommand | null | undefined;
|
|
480
|
+
_notificationCallback: (event: NotifyEvent) => void;
|
|
481
|
+
_closing: boolean | undefined;
|
|
482
|
+
_readCount: number | undefined;
|
|
483
|
+
_unsafeCompletedRead: number | undefined;
|
|
484
|
+
_discardLine: string | false | undefined;
|
|
485
|
+
_skipCommand: boolean | undefined;
|
|
486
|
+
_earlyLiteral: boolean | undefined;
|
|
487
|
+
_pipelinedAfter: {
|
|
488
|
+
command: string;
|
|
489
|
+
read: number | undefined;
|
|
490
|
+
} | undefined;
|
|
491
|
+
constructor(server: IMAPServer, socket: net.Socket);
|
|
492
|
+
/**
|
|
493
|
+
* Writes protocol output to the client, through the transport layer if there is one
|
|
494
|
+
*
|
|
495
|
+
* @param {Buffer|String} data Data to send, a string is sent as a binary string
|
|
496
|
+
*/
|
|
497
|
+
write(data: Buffer | string): void;
|
|
498
|
+
/**
|
|
499
|
+
* Writes data to the socket, below the transport layer
|
|
500
|
+
*
|
|
501
|
+
* @param {Buffer} data Data to send
|
|
502
|
+
*/
|
|
503
|
+
writeRaw(data: Buffer | string): void;
|
|
504
|
+
/**
|
|
505
|
+
* Handles data from the socket, through the transport layer if there is one
|
|
506
|
+
*
|
|
507
|
+
* @param {Buffer} chunk Received data
|
|
508
|
+
*/
|
|
509
|
+
receive(chunk: Buffer): void;
|
|
510
|
+
/**
|
|
511
|
+
* Closes the connection once everything sent so far, including data a transport layer still
|
|
512
|
+
* holds, is written out
|
|
513
|
+
*/
|
|
514
|
+
end(): void;
|
|
515
|
+
/**
|
|
516
|
+
* Sends an untagged BYE, drops unprocessed input and closes the connection (RFC 3501 section 7.1.5)
|
|
517
|
+
*
|
|
518
|
+
* @param {String} text Human readable explanation
|
|
519
|
+
* @param {String} [description] Description for output handlers
|
|
520
|
+
*/
|
|
521
|
+
bye(text: string, description?: string): void;
|
|
522
|
+
/**
|
|
523
|
+
* Checks if the client sent anything after the command that is running, that is not processed yet
|
|
524
|
+
*
|
|
525
|
+
* @return {Boolean} true if there is unprocessed input or a queued command
|
|
526
|
+
*/
|
|
527
|
+
hasPendingInput(): boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Checks if a command is running or waiting, for checks that must not run ahead of earlier commands
|
|
530
|
+
*
|
|
531
|
+
* @return {Boolean} true if a command is running or queued
|
|
532
|
+
*/
|
|
533
|
+
isBusy(): boolean;
|
|
534
|
+
/**
|
|
535
|
+
* Checks if a command was sent together with a command that was refused for the noPipelining option (STARTTLS,
|
|
536
|
+
* COMPRESS): it arrived in the same read, before the client could see the refusal
|
|
537
|
+
*
|
|
538
|
+
* @return {Boolean} true if the command must be refused
|
|
539
|
+
*/
|
|
540
|
+
isPipelinedAfterRefusal(): boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Refuses a command that was pipelined after a refused noPipelining command, without running it
|
|
543
|
+
*
|
|
544
|
+
* @param {Object} parsed Parsed command
|
|
545
|
+
* @param {String} data Raw command
|
|
546
|
+
*/
|
|
547
|
+
refusePipelined(parsed: CommandContext, data: string): void;
|
|
548
|
+
/**
|
|
549
|
+
* Drops input that is not processed yet, including queued commands
|
|
550
|
+
*/
|
|
551
|
+
discardInput(): void;
|
|
552
|
+
/**
|
|
553
|
+
* Returns the connection to the Not Authenticated state and resets everything but the TLS
|
|
554
|
+
* layer (RFC 8437 section 3): the selected mailbox is closed without EXPUNGE responses, and the
|
|
555
|
+
* plugins clear their session state (ENABLEd extensions, CONDSTORE, COMPRESS, ...) with
|
|
556
|
+
* server.resetHandlers. Call it after the response that ends the session was sent.
|
|
557
|
+
*/
|
|
558
|
+
resetSession(): void;
|
|
559
|
+
/**
|
|
560
|
+
* Closes the selected mailbox, if there is one, and returns to the Authenticated state (CLOSE, UNSELECT, a failed
|
|
561
|
+
* SELECT or EXAMINE, RFC 3501 section 6.3.1). The read-only mode, the \Recent set of the session and the
|
|
562
|
+
* notifications that were not sent yet are dropped. Sends nothing, the caller answers the command
|
|
563
|
+
*/
|
|
564
|
+
closeMailbox(): void;
|
|
565
|
+
onClose(): void;
|
|
566
|
+
onError(err: Error): void;
|
|
567
|
+
onData(chunk: Buffer): void;
|
|
568
|
+
/**
|
|
569
|
+
* Reads literal data that the current command is waiting for. The data of a command that was
|
|
570
|
+
* refused is dropped.
|
|
571
|
+
*
|
|
572
|
+
* @param {String} str Received data
|
|
573
|
+
* @return {String} the data that follows the literal
|
|
574
|
+
*/
|
|
575
|
+
readLiteral(str: string): string;
|
|
576
|
+
/**
|
|
577
|
+
* Sends a BAD response to input that did not make it to a command handler
|
|
578
|
+
*
|
|
579
|
+
* @param {String} tag Tag to answer with, "*" for an untagged response
|
|
580
|
+
* @param {String} text Human readable text
|
|
581
|
+
* @param {String} description Description for output handlers
|
|
582
|
+
* @param {String} [data] Raw input
|
|
583
|
+
*/
|
|
584
|
+
sendBad(tag: string, text: string, description: string, data?: string): void;
|
|
585
|
+
/**
|
|
586
|
+
* Checks if a literal may be accepted for the command line received so far. Literals are
|
|
587
|
+
* refused before they are read when they are too large, or when the command is unknown or
|
|
588
|
+
* not allowed in the current state, so the client does not get a continuation request for
|
|
589
|
+
* a command that is going to fail anyway.
|
|
590
|
+
*
|
|
591
|
+
* @param {String} line The command received so far (with earlier literals), up to the literal size marker
|
|
592
|
+
* @param {Number} literalSize Size of the literal in octets
|
|
593
|
+
* @param {Boolean} [synchronizing] true if the literal can still be refused without reading it
|
|
594
|
+
* @param {Boolean} [literal8] The literal is a literal8 `~{n}`
|
|
595
|
+
* @return {Object|Boolean} `{ command, code, text }` for the response that refuses the literal, or false.
|
|
596
|
+
* Responses from `server.literalFilters` have the same form
|
|
597
|
+
*/
|
|
598
|
+
checkLiteral(line: string, literalSize: number, synchronizing?: boolean, literal8?: boolean): Refusal | false;
|
|
599
|
+
/**
|
|
600
|
+
* Returns the largest literal the client may send in its current state. Before
|
|
601
|
+
* authentication only small literals (user names, passwords) make sense.
|
|
602
|
+
*
|
|
603
|
+
* @return {Number} Size in bytes
|
|
604
|
+
*/
|
|
605
|
+
getMaxLiteralSize(): number;
|
|
606
|
+
/**
|
|
607
|
+
* Returns the message list of the selected mailbox as this session currently
|
|
608
|
+
* sees it. When another session has expunged messages that this session has
|
|
609
|
+
* not been told about yet, sequence numbers must still refer to the old list.
|
|
610
|
+
*
|
|
611
|
+
* @return {Array} List of messages
|
|
612
|
+
*/
|
|
613
|
+
getSessionMessages(): Message[];
|
|
614
|
+
/**
|
|
615
|
+
* Resolves the sequence set argument of a command to messages of the selected mailbox, as this
|
|
616
|
+
* session sees it. Plugins can replace it per connection to support other forms of sequence sets
|
|
617
|
+
* (e.g. "$" of SEARCHRES)
|
|
618
|
+
*
|
|
619
|
+
* @param {String} range Sequence set
|
|
620
|
+
* @param {Boolean} isUid If true, the set lists UIDs instead of sequence numbers
|
|
621
|
+
* @return {Array} An array of messages in the form of [[seqIndex, message]]
|
|
622
|
+
*/
|
|
623
|
+
getMessageRange(range: string | number | null | undefined, isUid: boolean): MessageRange;
|
|
624
|
+
/**
|
|
625
|
+
* Lets `server.rangeLimits` cut the messages a command operates on, after its sequence set argument was resolved.
|
|
626
|
+
* A limit that returns the messages from the highest UID down sets `parsed.highestFirst`, then MOVE and UID EXPUNGE
|
|
627
|
+
* send their EXPUNGE responses in that order too
|
|
628
|
+
*
|
|
629
|
+
* @param {Object} parsed Parsed command
|
|
630
|
+
* @param {Array} range Messages of the sequence set, in the form of [[seqIndex, message]]
|
|
631
|
+
* @return {Array} the messages to operate on, in the same form
|
|
632
|
+
*/
|
|
633
|
+
limitRange(parsed: ParsedCommand, range: MessageRange): MessageRange;
|
|
634
|
+
/**
|
|
635
|
+
* Resolves the sequence set argument of a command like getMessageRange, but refuses message sequence
|
|
636
|
+
* numbers past the end of the selected mailbox, as this session sees it. RFC 3501 and RFC 9051 section 9
|
|
637
|
+
* (seq-number): "The server should respond with a tagged BAD response to a command that uses a message
|
|
638
|
+
* sequence number greater than the number of messages in the selected mailbox. This includes "*" if the
|
|
639
|
+
* selected mailbox is empty." For the sequence set argument of FETCH, STORE, COPY and MOVE, SEARCH keys
|
|
640
|
+
* use getMessageRange
|
|
641
|
+
*
|
|
642
|
+
* @param {String} range Sequence set
|
|
643
|
+
* @param {Boolean} isUid If true, the set lists UIDs, these can point past the end
|
|
644
|
+
* @return {Array} An array of messages in the form of [[seqIndex, message]], see getMessageRange
|
|
645
|
+
* @throws {Error} BAD error if a sequence number is out of range
|
|
646
|
+
*/
|
|
647
|
+
getCommandRange(range: string | number | null | undefined, isUid: boolean): MessageRange;
|
|
648
|
+
/**
|
|
649
|
+
* Checks if this session has EXPUNGE notifications that it has not been told about yet
|
|
650
|
+
*
|
|
651
|
+
* @return {Boolean} true if an EXPUNGE response is pending
|
|
652
|
+
*/
|
|
653
|
+
hasPendingExpunge(): boolean;
|
|
654
|
+
/**
|
|
655
|
+
* Tells the other sessions that have the selected mailbox open about changed flags, they get
|
|
656
|
+
* an untagged FETCH with the new flags (RFC 3501 section 5.2)
|
|
657
|
+
*
|
|
658
|
+
* @param {Array} messages Messages with changed flags
|
|
659
|
+
*/
|
|
660
|
+
notifyFlagChanges(messages: Message[]): void;
|
|
661
|
+
/**
|
|
662
|
+
* Sends unsolicited FETCH responses with the flags another session changed. The UID is always
|
|
663
|
+
* included, RFC 9051 section 6.3.13 requires it for unsolicited FETCH responses and it is valid
|
|
664
|
+
* in IMAP4rev1 as well.
|
|
665
|
+
*
|
|
666
|
+
* @param {Array} messages Messages with changed flags
|
|
667
|
+
* @param {Map} sequence Message to the sequence number this session knows it by
|
|
668
|
+
* @param {Set} [reported] Messages already reported, these are skipped and the sent ones are added
|
|
669
|
+
*/
|
|
670
|
+
sendFlagUpdate(messages: Message[], sequence: Map<Message, number>, reported?: Set<Message>): void;
|
|
671
|
+
/**
|
|
672
|
+
* Checks if a message has the \Recent flag in this session
|
|
673
|
+
*
|
|
674
|
+
* @param {Object} message Message object
|
|
675
|
+
* @return {Boolean} true if the message is recent for this session
|
|
676
|
+
*/
|
|
677
|
+
isRecent(message: Message): boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Returns the flags of a message as seen by this session, including \Recent
|
|
680
|
+
*
|
|
681
|
+
* @param {Object} message Message object
|
|
682
|
+
* @return {Array} List of flags
|
|
683
|
+
*/
|
|
684
|
+
getFlags(message: Message): string[];
|
|
685
|
+
/**
|
|
686
|
+
* Checks if FETCH may set the \Seen flag in the selected mailbox (RFC 3501 section 6.4.5).
|
|
687
|
+
* Plugins can override it for a connection, e.g. ACL without the "s" right
|
|
688
|
+
*
|
|
689
|
+
* @return {Boolean} true if \Seen may be set
|
|
690
|
+
*/
|
|
691
|
+
canSetSeen(): boolean;
|
|
692
|
+
/**
|
|
693
|
+
* The refusal of a command that would change a mailbox selected read-only (EXAMINE, or SELECT answered with
|
|
694
|
+
* [READ-ONLY], RFC 3501 sections 6.3.1 and 6.3.2): STORE, EXPUNGE, UID EXPUNGE, MOVE and REPLACE. RFC 5530 section 3:
|
|
695
|
+
* CLIENTBUG, the client was told that the mailbox is read-only
|
|
696
|
+
*
|
|
697
|
+
* @return {Object|Boolean} `{ command, code, text }` if the selected mailbox is read-only, otherwise false
|
|
698
|
+
*/
|
|
699
|
+
readOnlyRefusal(): Refusal | false;
|
|
700
|
+
/**
|
|
701
|
+
* Sends the refusal of readOnlyRefusal() if the selected mailbox is read-only
|
|
702
|
+
*
|
|
703
|
+
* @param {Object} parsed Parsed command
|
|
704
|
+
* @param {String} data Raw command
|
|
705
|
+
* @param {String} description Description for output handlers
|
|
706
|
+
* @return {Boolean} true if the command was refused
|
|
707
|
+
*/
|
|
708
|
+
refuseReadOnly(parsed: ParsedCommand, data: string, description?: string): boolean;
|
|
709
|
+
/**
|
|
710
|
+
* Checks if CLOSE may expunge the selected mailbox (RFC 3501 section 6.4.2). Plugins can
|
|
711
|
+
* override it for a connection, e.g. ACL without the "e" right
|
|
712
|
+
*
|
|
713
|
+
* @return {Boolean} true if messages may be expunged
|
|
714
|
+
*/
|
|
715
|
+
canExpunge(): boolean;
|
|
716
|
+
onNotify(notification: NotifyEvent): void;
|
|
717
|
+
/**
|
|
718
|
+
* Queues a notification for this session, it is sent before the next tagged response that allows it, or
|
|
719
|
+
* right away while notifications are direct (IDLE). Plugins can replace it per connection to drop
|
|
720
|
+
* notifications or send them at other times (e.g. NOTIFY)
|
|
721
|
+
*
|
|
722
|
+
* @param {Object} command Untagged response
|
|
723
|
+
* @param {Object} notification The `notify` event, `{ command, mailbox, ignoreConnection, filter, origin }`
|
|
724
|
+
*/
|
|
725
|
+
queueNotification(command: Notification, notification?: NotifyEvent): void;
|
|
726
|
+
upgradeConnection(callback: () => void): void;
|
|
727
|
+
/**
|
|
728
|
+
* Turns the queued notifications into the responses to send. Plugins can replace it per connection
|
|
729
|
+
* to report changes in another form (e.g. VANISHED instead of EXPUNGE with QRESYNC)
|
|
730
|
+
*
|
|
731
|
+
* @param {Array} queue Queued notifications
|
|
732
|
+
* @return {Array} Notifications to send
|
|
733
|
+
*/
|
|
734
|
+
prepareNotifications(queue: Notification[]): Notification[];
|
|
735
|
+
processNotifications(data?: CommandContext | null): void;
|
|
736
|
+
/**
|
|
737
|
+
* Compile a command object to a response string and write it to socket.
|
|
738
|
+
* If the command object has a skipResponse property, the command is
|
|
739
|
+
* ignored
|
|
740
|
+
*
|
|
741
|
+
* @param {Object} response Response IMAP command object to be compiled.
|
|
742
|
+
* @param {String} description
|
|
743
|
+
* An upper-case string uniquely identifying the response for the benefit of
|
|
744
|
+
* output handlers that wish to augment/replace the given response.
|
|
745
|
+
* @param {Object} parsed
|
|
746
|
+
* Original parsed IMAP command that this is in response to.
|
|
747
|
+
* @param {String} data
|
|
748
|
+
* Original raw IMAP command as a binary string.
|
|
749
|
+
* @param {Object} extra
|
|
750
|
+
* Response-specific payload, usually the subject of the response. For
|
|
751
|
+
* example, the STORE command will pass the impacted message for each updated
|
|
752
|
+
* FETCH result. (This may have other names when used, like "affected".)
|
|
753
|
+
*/
|
|
754
|
+
send(response: IMAPResponse, description?: string, parsed?: CommandContext | null, data?: string | null, ...extra: any[]): void;
|
|
755
|
+
/**
|
|
756
|
+
* Sends a tagged status response to a command
|
|
757
|
+
*
|
|
758
|
+
* @param {Object} parsed Parsed command
|
|
759
|
+
* @param {String} data Raw command
|
|
760
|
+
* @param {String} command Response type: OK, NO or BAD
|
|
761
|
+
* @param {String} text Human readable text
|
|
762
|
+
* @param {String|Array} [code] Response code, eg. "TRYCREATE", sent as [TRYCREATE], or a list of
|
|
763
|
+
* atoms like ["METADATA", "MAXSIZE", 1024], sent as [METADATA MAXSIZE 1024]
|
|
764
|
+
* @param {String} [description] Description for output handlers, defaults to the command name,
|
|
765
|
+
* with " FAILED" appended for NO and BAD
|
|
766
|
+
*/
|
|
767
|
+
sendStatus(parsed: CommandContext, data: string | null | undefined, command: string, text: string, code?: string | number | (string | number)[] | false | null, description?: string | null): void;
|
|
768
|
+
/**
|
|
769
|
+
* Checks if a command was sent without waiting for an earlier command in a way that RFC 3501
|
|
770
|
+
* section 5.5 forbids: after any command other than FETCH, STORE or SEARCH (or another command with
|
|
771
|
+
* the noExpunge option, like SORT and THREAD from RFC 5256) the client must
|
|
772
|
+
* wait for the completion result before it sends a command with message sequence numbers,
|
|
773
|
+
* because an EXPUNGE response could change what the numbers refer to. A command was sent
|
|
774
|
+
* without waiting if such a command is still queued or running, or if it completed in the
|
|
775
|
+
* same read as this command arrived in.
|
|
776
|
+
*
|
|
777
|
+
* @param {Object} parsed Parsed command
|
|
778
|
+
* @return {Boolean} true if the command is ambiguous
|
|
779
|
+
*/
|
|
780
|
+
isAmbiguous(parsed: ParsedCommand): boolean;
|
|
781
|
+
/**
|
|
782
|
+
* Checks if a command refers to messages by sequence number (RFC 3501 section 5.5)
|
|
783
|
+
*
|
|
784
|
+
* @param {Object} parsed Parsed command
|
|
785
|
+
* @return {Boolean} true if the command uses message sequence numbers
|
|
786
|
+
*/
|
|
787
|
+
usesSequenceNumbers(parsed: CommandContext): boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Decodes a SASL client response. It must be valid base64 by the RFC 3501 section 9 grammar,
|
|
790
|
+
* "=" stands for an empty initial response (RFC 4959 section 3).
|
|
791
|
+
*
|
|
792
|
+
* @param {String} str Client response
|
|
793
|
+
* @return {Buffer|Boolean} Decoded value, or false if the input is not valid base64
|
|
794
|
+
*/
|
|
795
|
+
decodeSaslResponse(str: unknown): Buffer | false;
|
|
796
|
+
/**
|
|
797
|
+
* Returns the target mailbox of APPEND, COPY or MOVE. If messages can not be added
|
|
798
|
+
* to it, a tagged NO is sent and false is returned
|
|
799
|
+
*
|
|
800
|
+
* @param {String} path Mailbox path
|
|
801
|
+
* @param {Object} parsed Parsed command
|
|
802
|
+
* @param {String} data Raw command
|
|
803
|
+
* @param {String} description Description for the failure response
|
|
804
|
+
* @return {Object|false} Mailbox object
|
|
805
|
+
*/
|
|
806
|
+
getTargetMailbox(path: string, parsed: ParsedCommand, data: string, description?: string): Mailbox | false;
|
|
807
|
+
/**
|
|
808
|
+
* Runs the checks of `server.appendChecks` before messages are added to a mailbox. A check
|
|
809
|
+
* returns nothing if the messages may be added, or `{ code, text, soft }`: a hard failure is
|
|
810
|
+
* sent as a tagged NO with the response code and false is returned, a soft one (`soft: true`)
|
|
811
|
+
* only as an untagged NO warning, e.g. `* NO [OVERQUOTA] ...` (RFC 9208 section 4.3.1).
|
|
812
|
+
*
|
|
813
|
+
* @param {Object} mailbox Target mailbox
|
|
814
|
+
* @param {Array} messages Messages to add, objects with the message source as `raw`
|
|
815
|
+
* @param {Object} parsed Parsed command
|
|
816
|
+
* @param {String} data Raw command
|
|
817
|
+
* @param {String} description Description for the failure response
|
|
818
|
+
* @param {Object} [options] `{ move, source }`, set for MOVE with the source mailbox, or `{ command, replaced }`
|
|
819
|
+
* for APPEND like commands (APPEND, REPLACE), `replaced` is the message that REPLACE removes
|
|
820
|
+
* @return {Boolean} true if the messages may be added
|
|
821
|
+
*/
|
|
822
|
+
checkAppend(mailbox: Mailbox, messages: AppendMessage[], parsed: ParsedCommand, data: string, description?: string, options?: AppendCheckOptions | null): boolean;
|
|
823
|
+
/**
|
|
824
|
+
* Reports the results of checks like `server.appendChecks`: the first hard failure as a tagged
|
|
825
|
+
* NO, or soft ones as untagged NO warnings
|
|
826
|
+
*
|
|
827
|
+
* @param {Array} results Check results, `{ code, text, soft }` or nothing
|
|
828
|
+
* @param {Object} parsed Parsed command
|
|
829
|
+
* @param {String} data Raw command
|
|
830
|
+
* @param {String} description Description for the failure response
|
|
831
|
+
* @return {Boolean} false if the command failed
|
|
832
|
+
*/
|
|
833
|
+
applyChecks(results: (CheckResult | false | null | undefined | void)[], parsed: ParsedCommand, data: string, description?: string): boolean;
|
|
834
|
+
/**
|
|
835
|
+
* Converts a mailbox name from a command to the name used in storage, which is modified UTF-7
|
|
836
|
+
* (RFC 3501 section 5.1.3). A plugin can replace this per connection, e.g. UTF8=ACCEPT.
|
|
837
|
+
*
|
|
838
|
+
* @param {String} name Mailbox name as a binary string
|
|
839
|
+
* @return {String} Storage name
|
|
840
|
+
* @throws {Error} BAD error if the name is not valid
|
|
841
|
+
*/
|
|
842
|
+
importMailboxName(name: string): string;
|
|
843
|
+
/**
|
|
844
|
+
* Converts a mailbox name from storage to the form sent to the client. Every response that
|
|
845
|
+
* includes a mailbox name must use this. A plugin can replace this per connection.
|
|
846
|
+
*
|
|
847
|
+
* @param {String} path Storage name
|
|
848
|
+
* @return {String} Mailbox name as a binary string
|
|
849
|
+
*/
|
|
850
|
+
exportMailboxName(path: string): string;
|
|
851
|
+
scheduleCommand(data: string): void;
|
|
852
|
+
processQueue(force?: boolean): void;
|
|
853
|
+
/**
|
|
854
|
+
* Removes messages with \Deleted flag
|
|
855
|
+
*
|
|
856
|
+
* @param {Object} mailbox Mailbox to check for
|
|
857
|
+
* @param {Boolean} [ignoreSelf] If set to true, does not send any notices to itself
|
|
858
|
+
* @param {Boolean} [ignoreSelf] If set to true, does not send EXISTS notice to itself
|
|
859
|
+
*/
|
|
860
|
+
expungeDeleted(mailbox: Mailbox, ignoreSelf?: boolean, ignoreExists?: boolean): void;
|
|
861
|
+
/**
|
|
862
|
+
* Given a set of messages in a mailbox (possibly via getMessageRange), remove
|
|
863
|
+
* them from the mailbox and generate EXPUNGE notifications.
|
|
864
|
+
*
|
|
865
|
+
* @param {Object} mailbox Mailbox to check for
|
|
866
|
+
* @param {Function|Array} messagesOrFilterFunc An Array of messages in the
|
|
867
|
+
* folder that should be removed or a filtering function that indicates
|
|
868
|
+
* messages to be removed by returning true.
|
|
869
|
+
* @param {Boolean} [ignoreSelf] If set to true, does not send any notices to itself
|
|
870
|
+
* @param {Boolean} [ignoreSelf] If set to true, does not send EXISTS notice to itself
|
|
871
|
+
* @param {Boolean} [highestFirst] If set to true, the EXPUNGE responses go from the highest UID to the lowest
|
|
872
|
+
* (MESSAGELIMIT, RFC 9738 section 3.1), otherwise from the lowest
|
|
873
|
+
*/
|
|
874
|
+
expungeSpecificMessages(mailbox: Mailbox, messagesOrFilterFunc: Message[] | ((message: Message) => unknown), ignoreSelf?: boolean, ignoreExists?: boolean, highestFirst?: boolean): void;
|
|
875
|
+
}
|
|
876
|
+
export { TAG_REGEX, IMAPServer, IMAPConnection };
|