imapkit 4.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -19
- package/bin/imapkit.js +12 -16
- package/dist/cjs/addressparser.d.ts +21 -0
- package/dist/cjs/addressparser.js +277 -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 +102 -123
- 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 +34 -75
- 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 +54 -11
- 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,96 @@
|
|
|
1
|
+
// Checks of parsed command arguments (imap-handler parser output)
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a parsed argument is an atom, optionally a specific one
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} value Parsed argument
|
|
6
|
+
* @param {String} [name] Upper case atom to match, the value is compared case-insensitively
|
|
7
|
+
* @return {Boolean} true for an atom (with that name)
|
|
8
|
+
*/
|
|
9
|
+
function isAtom(value, name) {
|
|
10
|
+
return !!value && !Array.isArray(value) && value.type === 'ATOM' && (name === undefined || String(value.value).toUpperCase() === name);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a parsed argument is an astring (RFC 3501 section 9): an atom, a quoted string or a literal. An
|
|
14
|
+
* atom the parser split into a section or partial range (like BODY[1]<0.5>) is not
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} value Parsed argument
|
|
17
|
+
* @return {Boolean} true for an astring
|
|
18
|
+
*/
|
|
19
|
+
function isAstring(value) {
|
|
20
|
+
return !!value && !Array.isArray(value) && ['ATOM', 'STRING', 'LITERAL'].indexOf(value.type) >= 0 && !value.section && !value.partial;
|
|
21
|
+
}
|
|
22
|
+
// characters that end an atom in a command line (RFC 3501 section 9 atom-specials, and "[" "]" of sections)
|
|
23
|
+
const ATOM_END = /[\s()[\]{"%*\\<]/;
|
|
24
|
+
/**
|
|
25
|
+
* Lists how the client spelled the NIL atoms of a command line, in order. Quoted strings and literals are skipped
|
|
26
|
+
*
|
|
27
|
+
* @param {String} data Raw command line with its literals
|
|
28
|
+
* @return {Array} spellings, e.g. ["nil", "NIL"]
|
|
29
|
+
*/
|
|
30
|
+
function nilSpellings(data) {
|
|
31
|
+
const result = [];
|
|
32
|
+
let i = 0;
|
|
33
|
+
while (i < data.length) {
|
|
34
|
+
const ch = data.charAt(i);
|
|
35
|
+
if (ch === '"') {
|
|
36
|
+
for (i++; i < data.length && data.charAt(i) !== '"'; i++) {
|
|
37
|
+
if (data.charAt(i) === '\\') {
|
|
38
|
+
i++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
i++;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const literal = (ch === '{' || ch === '~') && data.substr(i, 32).match(/^~?\{(\d+)\+?\}\r\n/);
|
|
45
|
+
if (literal) {
|
|
46
|
+
i += literal[0].length + Number(literal[1]);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (ATOM_END.test(ch)) {
|
|
50
|
+
i++;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
let end = i;
|
|
54
|
+
while (end < data.length && !ATOM_END.test(data.charAt(end))) {
|
|
55
|
+
end++;
|
|
56
|
+
}
|
|
57
|
+
const token = data.substring(i, end);
|
|
58
|
+
if (/^nil$/i.test(token)) {
|
|
59
|
+
result.push(token);
|
|
60
|
+
}
|
|
61
|
+
i = end;
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
function restoreNilAtoms(parsed, data, select) {
|
|
66
|
+
if (!parsed.attributes || !/nil/i.test(data || '')) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// every null in the order the parser met them, sections included
|
|
70
|
+
const nulls = [];
|
|
71
|
+
const walk = (list, path) => {
|
|
72
|
+
list.forEach((item, i) => {
|
|
73
|
+
if (item === null) {
|
|
74
|
+
nulls.push({ list, index: i, path: path.concat(i) });
|
|
75
|
+
}
|
|
76
|
+
else if (Array.isArray(item)) {
|
|
77
|
+
walk(item, path.concat(i));
|
|
78
|
+
}
|
|
79
|
+
else if (item && Array.isArray(item.section)) {
|
|
80
|
+
walk(item.section, path.concat(i, 'section'));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
walk(parsed.attributes, []);
|
|
85
|
+
if (!nulls.length) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// the tag and the command name come first, so the arguments are the last NIL atoms of the line
|
|
89
|
+
const spellings = nilSpellings(data).slice(-nulls.length);
|
|
90
|
+
nulls.forEach((entry, i) => {
|
|
91
|
+
if (select(entry.path)) {
|
|
92
|
+
entry.list[entry.index] = { type: 'ATOM', value: spellings.length === nulls.length ? spellings[i] : 'NIL' };
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export { isAtom, isAstring, restoreNilAtoms };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MimeNode } from './mimeparser.js';
|
|
2
|
+
import type { Attribute } from './types.js';
|
|
3
|
+
/** Options of createBodystructure() */
|
|
4
|
+
export interface BodystructureOptions {
|
|
5
|
+
upperCaseKeys?: boolean | undefined;
|
|
6
|
+
skipContentLocation?: boolean | undefined;
|
|
7
|
+
body?: boolean | undefined;
|
|
8
|
+
messageGlobal?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** A BODY or BODYSTRUCTURE list, nested lists for the parts, compiled by imap-handler */
|
|
11
|
+
export type Bodystructure = Attribute[];
|
|
12
|
+
export default createBodystructure;
|
|
13
|
+
/**
|
|
14
|
+
* Generates an object out of parsed mime tree, that can be
|
|
15
|
+
* serialized into a BODYSTRUCTURE string
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} tree Parsed mime tree (see mimeparser.ts for input)
|
|
18
|
+
* @param {Object} [options] Optional options object
|
|
19
|
+
* @param {Boolean} [options.upperCaseKeys] If true, use only upper case key names
|
|
20
|
+
* @param {Boolean} [options.skipContentLocation] If true, do not include Content-Location in the output
|
|
21
|
+
* @param {Boolean} [options.body] If true, skip extension fields (needed for BODY)
|
|
22
|
+
* @param {Boolean} [options.messageGlobal] If true, describe message/global like message/rfc822 (IMAP4rev2, RFC 9051 section 7.5.2)
|
|
23
|
+
* @return {Array} Object structure in the form of BODYSTRUCTURE
|
|
24
|
+
*/
|
|
25
|
+
declare function createBodystructure(tree: MimeNode, options?: BodystructureOptions | null): Bodystructure;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// Converts a parsed MIME tree into BODY and BODYSTRUCTURE data. Ported from WildDuck
|
|
4
2
|
// (imap-core/lib/indexer/body-structure.js)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { partsOf, embeddedMessage } = require('./mimeparser');
|
|
8
|
-
|
|
3
|
+
import envelope from './envelope.js';
|
|
4
|
+
import { partsOf, embeddedMessage } from './mimeparser.js';
|
|
9
5
|
// Expose to the world
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export default createBodystructure;
|
|
12
7
|
/**
|
|
13
8
|
* Generates an object out of parsed mime tree, that can be
|
|
14
9
|
* serialized into a BODYSTRUCTURE string
|
|
15
10
|
*
|
|
16
|
-
* @param {Object} tree Parsed mime tree (see mimeparser.
|
|
11
|
+
* @param {Object} tree Parsed mime tree (see mimeparser.ts for input)
|
|
17
12
|
* @param {Object} [options] Optional options object
|
|
18
13
|
* @param {Boolean} [options.upperCaseKeys] If true, use only upper case key names
|
|
19
14
|
* @param {Boolean} [options.skipContentLocation] If true, do not include Content-Location in the output
|
|
@@ -23,37 +18,35 @@ module.exports = createBodystructure;
|
|
|
23
18
|
*/
|
|
24
19
|
function createBodystructure(tree, options) {
|
|
25
20
|
options = options || {};
|
|
26
|
-
|
|
27
|
-
const key = name => (options.upperCaseKeys && typeof name === 'string' ? name.toUpperCase() : name);
|
|
28
|
-
|
|
21
|
+
const key = (name) => (options.upperCaseKeys && typeof name === 'string' ? name.toUpperCase() : name);
|
|
29
22
|
// Parameter list of a parsed structured header value, as the flat `(key value key value)` list
|
|
30
|
-
const paramList = parsed => {
|
|
23
|
+
const paramList = (parsed) => {
|
|
31
24
|
if (!parsed || !parsed.hasParams) {
|
|
32
25
|
return null;
|
|
33
26
|
}
|
|
34
27
|
const list = [];
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
// hasParams is only set together with params
|
|
29
|
+
const params = parsed.params;
|
|
30
|
+
Object.keys(params).forEach(name => {
|
|
31
|
+
list.push(key(name), params[name]);
|
|
37
32
|
});
|
|
38
33
|
return list.length ? list : null;
|
|
39
34
|
};
|
|
40
|
-
|
|
41
|
-
const getBasicFields = node => {
|
|
35
|
+
const getBasicFields = (node) => {
|
|
42
36
|
const contentType = node.parsedHeader['content-type'] || {};
|
|
43
37
|
let bodyType = contentType.type || null;
|
|
44
38
|
let bodySubtype = contentType.subtype || null;
|
|
45
|
-
|
|
46
39
|
if (!bodyType || !bodySubtype) {
|
|
47
40
|
// prevent strange content types like (NIL "/ms-word") that may break some clients
|
|
48
41
|
if (bodyType === 'text' || bodySubtype === 'plain') {
|
|
49
42
|
bodyType = 'text';
|
|
50
43
|
bodySubtype = 'plain';
|
|
51
|
-
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
52
46
|
bodyType = 'application';
|
|
53
47
|
bodySubtype = 'octet-stream';
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
|
-
|
|
57
50
|
return [
|
|
58
51
|
key(bodyType),
|
|
59
52
|
key(bodySubtype),
|
|
@@ -69,20 +62,17 @@ function createBodystructure(tree, options) {
|
|
|
69
62
|
node.size
|
|
70
63
|
];
|
|
71
64
|
};
|
|
72
|
-
|
|
73
65
|
// The extension fields every part has (a non-multipart part also has an MD5 before them)
|
|
74
|
-
const getExtensionFields = node => {
|
|
66
|
+
const getExtensionFields = (node) => {
|
|
75
67
|
const languageString = node.parsedHeader['content-language'] && node.parsedHeader['content-language'].replace(/[ ,]+/g, ',').replace(/^,+|,+$/g, '');
|
|
76
68
|
const language = (languageString && languageString.split(',')) || null;
|
|
77
69
|
const disposition = node.parsedHeader['content-disposition'];
|
|
78
|
-
|
|
79
70
|
const data = [
|
|
80
71
|
// body disposition
|
|
81
72
|
(disposition && [key(disposition.value), paramList(disposition)]) || null,
|
|
82
73
|
// body language
|
|
83
74
|
language
|
|
84
75
|
];
|
|
85
|
-
|
|
86
76
|
// NB! RFC3501 has an errata with content-location type, it is described as
|
|
87
77
|
// "A string list" (eg. an array) in RFC but the errata page states
|
|
88
78
|
// that it is a string (http://www.rfc-editor.org/errata_search.php?rfc=3501)
|
|
@@ -90,10 +80,8 @@ function createBodystructure(tree, options) {
|
|
|
90
80
|
if (!options.skipContentLocation) {
|
|
91
81
|
data.push(node.parsedHeader['content-location'] || null);
|
|
92
82
|
}
|
|
93
|
-
|
|
94
83
|
return data;
|
|
95
84
|
};
|
|
96
|
-
|
|
97
85
|
// A non-multipart node: the basic fields, the fields of its type (line count for text, envelope and
|
|
98
86
|
// structure for message/rfc822), and the extension fields unless BODY was asked for
|
|
99
87
|
const processLeaf = (node, extra) => {
|
|
@@ -103,24 +91,21 @@ function createBodystructure(tree, options) {
|
|
|
103
91
|
}
|
|
104
92
|
return data;
|
|
105
93
|
};
|
|
106
|
-
|
|
107
|
-
|
|
94
|
+
const processMultipartNode = (node) => {
|
|
95
|
+
// only called for a node with parts
|
|
108
96
|
let data = partsOf(node)
|
|
109
97
|
.map(walker)
|
|
110
98
|
.concat([key(node.multipart)]);
|
|
111
|
-
|
|
112
99
|
if (!options.body) {
|
|
113
100
|
// RFC 3501 7.4.2: BODY is BODYSTRUCTURE without extension data, and for a multipart the
|
|
114
101
|
// parameter list is the first extension field (body-ext-mpart)
|
|
115
102
|
data = data.concat([paramList(node.parsedHeader['content-type'])], getExtensionFields(node));
|
|
116
103
|
}
|
|
117
|
-
|
|
118
104
|
// body-type-mpart = 1*body SP media-subtype, there is no SP between the bodies (RFC 3501 section 9)
|
|
119
105
|
Object.defineProperty(data, 'adjacentLists', { value: true });
|
|
120
106
|
return data;
|
|
121
107
|
};
|
|
122
|
-
|
|
123
|
-
const walker = node => {
|
|
108
|
+
const walker = (node) => {
|
|
124
109
|
const contentType = node.parsedHeader['content-type'] || {};
|
|
125
110
|
switch (contentType.type) {
|
|
126
111
|
case 'multipart':
|
|
@@ -144,6 +129,5 @@ function createBodystructure(tree, options) {
|
|
|
144
129
|
return processLeaf(node, []);
|
|
145
130
|
}
|
|
146
131
|
};
|
|
147
|
-
|
|
148
132
|
return walker(tree);
|
|
149
133
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const key = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDN0THQ8qpf3mMo\nNlVzVvjfsw/QHo22ojmmUO+3QjZDeB7mSmniyGOFw0M8f2g3FM0Kfa51rKMYXWQV\ncqRTDFkk9zBnCagFIWCi2DI4VgArzWlu4TqOHfRIHcbAH1bTKVh5KnVmQA6j6leK\njvSW2021Ntp8VX+KV5nXM3rRUWaPUSGj1+n6Pcj8ZrMdm2bd6Q4UscCvKrCi1dBP\nTPt9BNVO0CXL8zsiQfNOveN4nTBmF4T1+P/vvzSqHr199XDkjlhd8j3Pm2LKNS5O\nnPERgwZhgIg15G7Y/vz9N0vZGmIU7ApunyrgOhV1o4AlOzdo31xbVYIVn7/fv44D\nG7hvX8DVAgMBAAECggEABIVNSlEiM+PfGrGC0/s7kTJOLRyWsUXD7WbGtShDp9y6\nFQXaaIxNP1FoJyqHP/p5fHsBO310waK/gYcYm+hgBuNVEVZRdfdjN4B3LeyZqVyk\nLbbNwfRferwIswydLBsy4cpwdLQAflI15Qm5zpx3ivzu9J8uI3xEGUl8r59RmOE9\ntXb+sA9YtWRXUR4mhqApGxMI5ZP1/WbmhlDvLUnartyBNilfS3RTWY7nWMKk3U0N\nyFmYX17WZYnXbJtXQmOX/LHd1nM2NFS2B6yJ6JKY0/jPOGCaTBcVmFgO3x/aDgiJ\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nEF3engvuSVRtcV8eyxM=\n-----END CERTIFICATE-----\n";
|
package/dist/esm/cert.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated by scripts/build.js from cert/. Do not edit by hand.
|
|
2
|
+
// Self-signed certificate for localhost, used when the server options give no credentials
|
|
3
|
+
export const key = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDN0THQ8qpf3mMo\nNlVzVvjfsw/QHo22ojmmUO+3QjZDeB7mSmniyGOFw0M8f2g3FM0Kfa51rKMYXWQV\ncqRTDFkk9zBnCagFIWCi2DI4VgArzWlu4TqOHfRIHcbAH1bTKVh5KnVmQA6j6leK\njvSW2021Ntp8VX+KV5nXM3rRUWaPUSGj1+n6Pcj8ZrMdm2bd6Q4UscCvKrCi1dBP\nTPt9BNVO0CXL8zsiQfNOveN4nTBmF4T1+P/vvzSqHr199XDkjlhd8j3Pm2LKNS5O\nnPERgwZhgIg15G7Y/vz9N0vZGmIU7ApunyrgOhV1o4AlOzdo31xbVYIVn7/fv44D\nG7hvX8DVAgMBAAECggEABIVNSlEiM+PfGrGC0/s7kTJOLRyWsUXD7WbGtShDp9y6\nFQXaaIxNP1FoJyqHP/p5fHsBO310waK/gYcYm+hgBuNVEVZRdfdjN4B3LeyZqVyk\nLbbNwfRferwIswydLBsy4cpwdLQAflI15Qm5zpx3ivzu9J8uI3xEGUl8r59RmOE9\ntXb+sA9YtWRXUR4mhqApGxMI5ZP1/WbmhlDvLUnartyBNilfS3RTWY7nWMKk3U0N\nyFmYX17WZYnXbJtXQmOX/LHd1nM2NFS2B6yJ6JKY0/jPOGCaTBcVmFgO3x/aDgiJ\nm0XL1mpGBIUugQTio5N1Ewznrg6SA7rzsOzN1g3ZqwKBgQD48+lGyQmFAaaXzf+9\nWiG6F6hQtsiWDwhQ3C1m1fOMk2Fgi/eVPEWxIRbf18XBwgvt4Q7PoyojzR730YZl\n5WsEpliGyaBdrR4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EKAoIBAQDN0THQ8qpf3mMoNlVzVvjfsw/QHo22ojmmUO+3QjZD\neB7mSmniyGOFw0M8f2g3FM0Kfa51rKMYXWQVcqRTDFkk9zBnCagFIWCi2DI4VgAr\nzWlu4TqOHfRIHcbAH1bTKVh5KnVmQA6j6leKjvSW2021Ntp8VX+KV5nXM3rRUWaP\nUSGj1+n6Pcj8ZrMdm2bd6Q4UscCvKrCi1dBPTPt9BNVO0CXL8zsiQfNOveN4nTBm\nF4T1+P/vvzSqHr199XDkjlhd8j3Pm2LKNS5OnPERgwZhgIg15G7Y/vz9N0vZGmIU\n7ApunyrgOhV1o4AlOzdo31xbVYIVn7/fv44DG7hvX8DVAgMBAAGjgYEwfzAdBgNV\nHQ4EFgQUzO7Y5K1NaU+/GXZJi2C47uK0+tQwHwYDVR0jBBgwFoAUzO7Y5K1NaU+/\nGXZJi2C47uK0+tQwDwYDVR0TAQH/BAUwAwEB/zAsBgNVHREEJTAjgglsb2NhbGhv\nc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAEwDQYJKoZIhvcNAQELBQADggEBAL/P\np3lI83Fcw8EpVyzr9QPYA7JZVmy8YlJ7vouOmEUi6X7BnK5Eits1uHGZ6rtLGBCY\nEu4Z4DnCPXnyXuo4Bzaqabs5qUro3Ztf0FXeatGCmTLx06JSapKVyoXkJpzLzX0u\npj0WfWUkwD3rGQozn0FOUOrZyjYgPgsqr6doWd5emAWl1L8ZGDFJEWPRvrS0dw7Z\nZG83/H0UYur8lN2JxV4ITRovftmtruiVNw3mXH5BZCIsoFAEtf3hssn6rekfEOfc\n4vty2NskN112OLQzLK1Oq3dl0C6Ns1MdIoelAHrFdeM3O03Y0D2R+PlNw1cU55if\nEF3engvuSVRtcV8eyxM=\n-----END CERTIFICATE-----\n";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CommandOptions } from './types.js';
|
|
2
|
+
/** Command options with every key set, see commandOptions() */
|
|
3
|
+
export interface ResolvedCommandOptions {
|
|
4
|
+
states: string[] | false;
|
|
5
|
+
noArguments: boolean;
|
|
6
|
+
mailboxArguments: number[];
|
|
7
|
+
astringArguments: number[];
|
|
8
|
+
searchCriteria: number | false;
|
|
9
|
+
sequenceSet: number | false;
|
|
10
|
+
noExpunge: boolean;
|
|
11
|
+
literal8: true | string | false;
|
|
12
|
+
noPipelining: boolean;
|
|
13
|
+
appendMessage: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Normalizes command options
|
|
17
|
+
*
|
|
18
|
+
* @param {Object|Array} options `{ states, noArguments, mailboxArguments, astringArguments, searchCriteria, sequenceSet, noExpunge,
|
|
19
|
+
* literal8, noPipelining }`, or just the list of states
|
|
20
|
+
* @return {Object} options with all keys set
|
|
21
|
+
*/
|
|
22
|
+
declare function commandOptions(input?: CommandOptions | string[] | null): ResolvedCommandOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the options of a core command
|
|
25
|
+
*
|
|
26
|
+
* @param {String} command Upper case command name, e.g. "UID FETCH"
|
|
27
|
+
* @return {Object|Boolean} command options (see commandOptions) or false if the command is not a core command
|
|
28
|
+
*/
|
|
29
|
+
declare function getCommandOptions(command: string): ResolvedCommandOptions | false;
|
|
30
|
+
declare const states: {
|
|
31
|
+
ANY: string[];
|
|
32
|
+
NOT_AUTHENTICATED: string[];
|
|
33
|
+
AUTHENTICATED: string[];
|
|
34
|
+
SELECTED: string[];
|
|
35
|
+
};
|
|
36
|
+
export { getCommandOptions, commandOptions, states };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// Connection states in which each command is valid (RFC 3501 sections 3 and 6). Commands valid
|
|
4
2
|
// in the authenticated state are also valid in the selected state.
|
|
5
3
|
const ANY = ['Not Authenticated', 'Authenticated', 'Selected'];
|
|
6
4
|
const NOT_AUTHENTICATED = ['Not Authenticated'];
|
|
7
5
|
const AUTHENTICATED = ['Authenticated', 'Selected'];
|
|
8
6
|
const SELECTED = ['Selected'];
|
|
9
|
-
|
|
10
7
|
/**
|
|
11
8
|
* Normalizes command options
|
|
12
9
|
*
|
|
@@ -14,11 +11,8 @@ const SELECTED = ['Selected'];
|
|
|
14
11
|
* literal8, noPipelining }`, or just the list of states
|
|
15
12
|
* @return {Object} options with all keys set
|
|
16
13
|
*/
|
|
17
|
-
function commandOptions(
|
|
18
|
-
|
|
19
|
-
options = { states: options };
|
|
20
|
-
}
|
|
21
|
-
options = options || {};
|
|
14
|
+
function commandOptions(input) {
|
|
15
|
+
const options = (Array.isArray(input) ? { states: input } : input) || {};
|
|
22
16
|
return {
|
|
23
17
|
// false means any state
|
|
24
18
|
states: options.states ? [].concat(options.states) : false,
|
|
@@ -49,17 +43,14 @@ function commandOptions(options) {
|
|
|
49
43
|
appendMessage: !!options.appendMessage
|
|
50
44
|
};
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
// RFC 3501 core commands. Plugins pass the options of their commands to setCommandHandler
|
|
54
47
|
const CORE_COMMANDS = {
|
|
55
48
|
CAPABILITY: commandOptions({ states: ANY, noArguments: true }),
|
|
56
49
|
NOOP: commandOptions({ states: ANY, noArguments: true }),
|
|
57
50
|
LOGOUT: commandOptions({ states: ANY, noArguments: true }),
|
|
58
|
-
|
|
59
51
|
STARTTLS: commandOptions({ states: NOT_AUTHENTICATED, noArguments: true, noPipelining: true }),
|
|
60
52
|
// login = "LOGIN" SP userid SP password, both astrings
|
|
61
53
|
LOGIN: commandOptions({ states: NOT_AUTHENTICATED, astringArguments: [0, 1] }),
|
|
62
|
-
|
|
63
54
|
SELECT: commandOptions({ states: AUTHENTICATED, mailboxArguments: [0] }),
|
|
64
55
|
EXAMINE: commandOptions({ states: AUTHENTICATED, mailboxArguments: [0] }),
|
|
65
56
|
CREATE: commandOptions({ states: AUTHENTICATED, mailboxArguments: [0] }),
|
|
@@ -72,7 +63,6 @@ const CORE_COMMANDS = {
|
|
|
72
63
|
LSUB: commandOptions({ states: AUTHENTICATED, astringArguments: [0, 1] }),
|
|
73
64
|
STATUS: commandOptions({ states: AUTHENTICATED, mailboxArguments: [0] }),
|
|
74
65
|
APPEND: commandOptions({ states: AUTHENTICATED, mailboxArguments: [0], literal8: 'BINARY', appendMessage: true }),
|
|
75
|
-
|
|
76
66
|
CHECK: commandOptions({ states: SELECTED, noArguments: true }),
|
|
77
67
|
CLOSE: commandOptions({ states: SELECTED, noArguments: true }),
|
|
78
68
|
EXPUNGE: commandOptions({ states: SELECTED, noArguments: true }),
|
|
@@ -83,10 +73,8 @@ const CORE_COMMANDS = {
|
|
|
83
73
|
'UID COPY': commandOptions({ states: SELECTED, mailboxArguments: [1] }),
|
|
84
74
|
'UID SEARCH': commandOptions({ states: SELECTED, searchCriteria: 0 })
|
|
85
75
|
};
|
|
86
|
-
|
|
87
76
|
const UID_COMMAND = commandOptions({ states: SELECTED });
|
|
88
77
|
const AUTHENTICATE_COMMAND = commandOptions({ states: NOT_AUTHENTICATED });
|
|
89
|
-
|
|
90
78
|
/**
|
|
91
79
|
* Returns the options of a core command
|
|
92
80
|
*
|
|
@@ -105,5 +93,5 @@ function getCommandOptions(command) {
|
|
|
105
93
|
}
|
|
106
94
|
return false;
|
|
107
95
|
}
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
const states = { ANY, NOT_AUTHENTICATED, AUTHENTICATED, SELECTED };
|
|
97
|
+
export { getCommandOptions, commandOptions, states };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { AppendMessage, Attribute, Callback, IMAPConnection, IMAPError, Mailbox, Message, ParsedCommand, Refusal } from '../types.js';
|
|
2
|
+
/** A message of an APPEND like command, ready to be stored */
|
|
3
|
+
export interface PreparedMessage extends AppendMessage {
|
|
4
|
+
flags: string[];
|
|
5
|
+
internaldate: string | false;
|
|
6
|
+
raw: string;
|
|
7
|
+
/** builds the message source of an append-data extension */
|
|
8
|
+
resolve?: (() => string) | undefined;
|
|
9
|
+
/** the message was sent as a literal8 */
|
|
10
|
+
literal8?: boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** The result of prepareAppend() */
|
|
13
|
+
export interface PreparedAppend {
|
|
14
|
+
mailbox: Mailbox;
|
|
15
|
+
messages: PreparedMessage[];
|
|
16
|
+
}
|
|
17
|
+
/** Options of prepareAppend() */
|
|
18
|
+
export interface PrepareAppendOptions {
|
|
19
|
+
command: string;
|
|
20
|
+
maxMessages?: number | undefined;
|
|
21
|
+
replaced?: Message | null | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates an error that refuses an APPEND like command
|
|
25
|
+
*
|
|
26
|
+
* @param {String} text Human readable text
|
|
27
|
+
* @param {String} [code] Response code, e.g. "TOOBIG"
|
|
28
|
+
* @param {Array} [codeArgs] Arguments of the response code, as response attributes
|
|
29
|
+
* @param {String} [response] "NO" (default) or "BAD"
|
|
30
|
+
* @return {Error} Error object
|
|
31
|
+
*/
|
|
32
|
+
declare function appendError(text: string, code?: string | false, codeArgs?: Attribute[] | false, response?: string): IMAPError;
|
|
33
|
+
declare const badArgument: (text: string) => IMAPError;
|
|
34
|
+
/**
|
|
35
|
+
* Finds the target mailbox name of an APPEND or REPLACE command when a literal of a message (or of a CATENATE TEXT
|
|
36
|
+
* part) is announced. Only the start of the command up to the mailbox argument is parsed, so the data of earlier
|
|
37
|
+
* literals is not parsed again for every message of a MULTIAPPEND
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} connection IMAPConnection
|
|
40
|
+
* @param {String} command Upper case command name
|
|
41
|
+
* @param {String} line Command received so far, up to the literal size marker
|
|
42
|
+
* @return {String|Boolean} storage name of the mailbox, or false if the literal is not a message or the name is not
|
|
43
|
+
* known yet or not valid
|
|
44
|
+
*/
|
|
45
|
+
declare function getPendingTarget(connection: IMAPConnection, command: string, line: string): string | false;
|
|
46
|
+
/**
|
|
47
|
+
* A literal filter (`server.literalFilters`) that refuses the message of an APPEND or REPLACE to a mailbox that does
|
|
48
|
+
* not exist before the client sends it, by not sending a continuation request (RFC 3502 section 6.3.11 example A004,
|
|
49
|
+
* RFC 3501 section 6.3.11: TRYCREATE). Not while earlier commands are still waiting, these could create the mailbox
|
|
50
|
+
*
|
|
51
|
+
* @param {Object} connection IMAPConnection
|
|
52
|
+
* @param {String} command Upper case command name
|
|
53
|
+
* @param {String} line Command received so far, up to the literal size marker
|
|
54
|
+
* @return {Object|Boolean} `{ command, code, text }` to refuse the literal, or false
|
|
55
|
+
*/
|
|
56
|
+
declare function refuseMissingTarget(connection: IMAPConnection, command: string, line: string): Refusal | false;
|
|
57
|
+
/**
|
|
58
|
+
* Prepares the messages of an APPEND like command (APPEND, REPLACE): parses the arguments, checks
|
|
59
|
+
* the target mailbox, builds the message sources and runs `server.appendChecks` through
|
|
60
|
+
* IMAPConnection#checkAppend. Nothing is stored yet, so a failure leaves every mailbox as it was
|
|
61
|
+
* (RFC 3502 section 6.3.11). The error response is sent here.
|
|
62
|
+
*
|
|
63
|
+
* The checks get the built messages (with `raw`) of the whole command and the options as
|
|
64
|
+
* `{ command, replaced }`, `replaced` is the message that REPLACE removes.
|
|
65
|
+
*
|
|
66
|
+
* @param {Object} connection IMAPConnection
|
|
67
|
+
* @param {Object} parsed Parsed command
|
|
68
|
+
* @param {String} data Raw command
|
|
69
|
+
* @param {Object} pathArg Parsed mailbox name argument
|
|
70
|
+
* @param {Array} args Parsed arguments after the mailbox name
|
|
71
|
+
* @param {Object} options `{ command, maxMessages, replaced }`
|
|
72
|
+
* @return {Object|Boolean} `{ mailbox, messages }` or false if an error response was sent
|
|
73
|
+
*/
|
|
74
|
+
declare function prepareAppend(connection: IMAPConnection, parsed: ParsedCommand, data: string, pathArg: Attribute, args: Attribute[], options: PrepareAppendOptions): PreparedAppend | false;
|
|
75
|
+
/**
|
|
76
|
+
* Stores prepared messages. The sessions that have the target mailbox selected get EXISTS updates
|
|
77
|
+
*
|
|
78
|
+
* @param {Object} connection IMAPConnection
|
|
79
|
+
* @param {Object} prepared Result of prepareAppend()
|
|
80
|
+
* @return {Object} `{ mailbox, message, messages }`, message is the last stored message
|
|
81
|
+
*/
|
|
82
|
+
declare function storeMessages(connection: IMAPConnection, prepared: PreparedAppend): {
|
|
83
|
+
mailbox: Mailbox;
|
|
84
|
+
message: Message | undefined;
|
|
85
|
+
messages: Message[];
|
|
86
|
+
};
|
|
87
|
+
export default function appendCommand(connection: IMAPConnection, parsed: ParsedCommand, data: string, callback: Callback): void;
|
|
88
|
+
export { appendError, badArgument, prepareAppend, storeMessages, getPendingTarget, refuseMissingTarget };
|