imapkit 4.0.3 → 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 +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 +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,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = subscribeCommand;
|
|
4
|
+
function subscribeCommand(connection, parsed, data, callback) {
|
|
5
|
+
if (!parsed.attributes || parsed.attributes.length !== 1 || !parsed.attributes[0] || ['STRING', 'LITERAL', 'ATOM'].indexOf(parsed.attributes[0].type) < 0) {
|
|
6
|
+
connection.send({
|
|
7
|
+
tag: parsed.tag,
|
|
8
|
+
command: 'BAD',
|
|
9
|
+
attributes: [
|
|
10
|
+
{
|
|
11
|
+
type: 'TEXT',
|
|
12
|
+
value: 'SUBSCRIBE expects mailbox name'
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}, 'INVALID COMMAND', parsed, data);
|
|
16
|
+
return callback();
|
|
17
|
+
}
|
|
18
|
+
const path = parsed.attributes[0].value;
|
|
19
|
+
const mailbox = connection.server.getMailbox(path);
|
|
20
|
+
if (!mailbox || mailbox.flags.indexOf('\\Noselect') >= 0) {
|
|
21
|
+
connection.sendStatus(parsed, data, 'NO', 'Mailbox does not exist', 'NONEXISTENT', 'SUBSCRIBE FAILED');
|
|
22
|
+
return callback();
|
|
23
|
+
}
|
|
24
|
+
if (!mailbox.subscribed) {
|
|
25
|
+
mailbox.subscribed = true;
|
|
26
|
+
connection.server.mailboxChanged('subscribe', mailbox.path);
|
|
27
|
+
}
|
|
28
|
+
connection.send({
|
|
29
|
+
tag: parsed.tag,
|
|
30
|
+
command: 'OK',
|
|
31
|
+
attributes: [
|
|
32
|
+
{
|
|
33
|
+
type: 'TEXT',
|
|
34
|
+
value: 'SUBSCRIBE completed'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}, 'SUBSCRIBE', parsed, data);
|
|
38
|
+
return callback();
|
|
39
|
+
}
|
|
40
|
+
{
|
|
41
|
+
const defaultExport = exports.default;
|
|
42
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
43
|
+
for (const key of Object.keys(exports)) {
|
|
44
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
45
|
+
defaultExport[key] = exports[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
49
|
+
module.exports = defaultExport;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = uidCopyCommand;
|
|
4
|
+
const copy_js_1 = require("./copy.js");
|
|
5
|
+
function uidCopyCommand(connection, parsed, data, callback) {
|
|
6
|
+
return (0, copy_js_1.copyMessages)(connection, parsed, data, callback, true);
|
|
7
|
+
}
|
|
8
|
+
{
|
|
9
|
+
const defaultExport = exports.default;
|
|
10
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
11
|
+
for (const key of Object.keys(exports)) {
|
|
12
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
13
|
+
defaultExport[key] = exports[key];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
17
|
+
module.exports = defaultExport;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fetch_js_1 = require("./fetch.js");
|
|
4
|
+
const uidFetchCommand = (connection, parsed, data, callback) => (0, fetch_js_1.processFetch)(true, connection, parsed, data, callback);
|
|
5
|
+
exports.default = uidFetchCommand;
|
|
6
|
+
{
|
|
7
|
+
const defaultExport = exports.default;
|
|
8
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
9
|
+
for (const key of Object.keys(exports)) {
|
|
10
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
11
|
+
defaultExport[key] = exports[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
15
|
+
module.exports = defaultExport;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const search_js_1 = require("./search.js");
|
|
4
|
+
const uidSearchCommand = (connection, parsed, data, callback) => (0, search_js_1.processSearch)(true, connection, parsed, data, callback);
|
|
5
|
+
exports.default = uidSearchCommand;
|
|
6
|
+
{
|
|
7
|
+
const defaultExport = exports.default;
|
|
8
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
9
|
+
for (const key of Object.keys(exports)) {
|
|
10
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
11
|
+
defaultExport[key] = exports[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
15
|
+
module.exports = defaultExport;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const store_js_1 = require("./store.js");
|
|
4
|
+
const uidStoreCommand = (connection, parsed, data, callback) => (0, store_js_1.processStore)(true, connection, parsed, data, callback);
|
|
5
|
+
exports.default = uidStoreCommand;
|
|
6
|
+
{
|
|
7
|
+
const defaultExport = exports.default;
|
|
8
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
9
|
+
for (const key of Object.keys(exports)) {
|
|
10
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
11
|
+
defaultExport[key] = exports[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
15
|
+
module.exports = defaultExport;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = unsubscribeCommand;
|
|
4
|
+
function unsubscribeCommand(connection, parsed, data, callback) {
|
|
5
|
+
if (!parsed.attributes || parsed.attributes.length !== 1 || !parsed.attributes[0] || ['STRING', 'LITERAL', 'ATOM'].indexOf(parsed.attributes[0].type) < 0) {
|
|
6
|
+
connection.send({
|
|
7
|
+
tag: parsed.tag,
|
|
8
|
+
command: 'BAD',
|
|
9
|
+
attributes: [
|
|
10
|
+
{
|
|
11
|
+
type: 'TEXT',
|
|
12
|
+
value: 'UNSUBSCRIBE expects mailbox name'
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}, 'INVALID COMMAND', parsed, data);
|
|
16
|
+
return callback();
|
|
17
|
+
}
|
|
18
|
+
let path = parsed.attributes[0].value;
|
|
19
|
+
if (path.toUpperCase() === 'INBOX') {
|
|
20
|
+
path = 'INBOX';
|
|
21
|
+
}
|
|
22
|
+
// The subscription list holds names, so a name stays removable after its mailbox is deleted
|
|
23
|
+
// (RFC 3501 section 6.3.6). Removing a name that is not subscribed is not an error (RFC 9051 section 6.3.8)
|
|
24
|
+
if (connection.server.subscriptions.delete(path)) {
|
|
25
|
+
connection.server.mailboxChanged('unsubscribe', path);
|
|
26
|
+
}
|
|
27
|
+
connection.send({
|
|
28
|
+
tag: parsed.tag,
|
|
29
|
+
command: 'OK',
|
|
30
|
+
attributes: [
|
|
31
|
+
{
|
|
32
|
+
type: 'TEXT',
|
|
33
|
+
value: 'UNSUBSCRIBE completed'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}, 'UNSUBSCRIBE', parsed, data);
|
|
37
|
+
return callback();
|
|
38
|
+
}
|
|
39
|
+
{
|
|
40
|
+
const defaultExport = exports.default;
|
|
41
|
+
if (defaultExport && (typeof defaultExport === 'function' || typeof defaultExport === 'object')) {
|
|
42
|
+
for (const key of Object.keys(exports)) {
|
|
43
|
+
if (key !== 'default' && !(key in defaultExport)) {
|
|
44
|
+
defaultExport[key] = exports[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
Object.defineProperty(defaultExport, 'default', { value: defaultExport, enumerable: false, writable: true, configurable: true });
|
|
48
|
+
module.exports = defaultExport;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
declare const MONTHS: string[];
|
|
2
|
+
/** Date and time parts of a parsed date, the time fields are undefined when the value has no time */
|
|
3
|
+
export interface DateParts {
|
|
4
|
+
day: number;
|
|
5
|
+
/** month index, 0 for January */
|
|
6
|
+
month: number;
|
|
7
|
+
year: number;
|
|
8
|
+
hours?: number | undefined;
|
|
9
|
+
minutes?: number | undefined;
|
|
10
|
+
seconds?: number | undefined;
|
|
11
|
+
/** `+hhmm` / `-hhmm` or a zone name */
|
|
12
|
+
zone?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the index of a month name, ignoring case like all ABNF strings
|
|
16
|
+
*
|
|
17
|
+
* @param {String} name Three letter month name, e.g. "jan"
|
|
18
|
+
* @return {Number} 0 for January to 11 for December, or -1 for an unknown name
|
|
19
|
+
*/
|
|
20
|
+
declare function monthIndex(name: string | undefined): number;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if day, month and year make a real date
|
|
23
|
+
*
|
|
24
|
+
* @param {Number|String} day Day of the month
|
|
25
|
+
* @param {Number} month Month index, 0 for January
|
|
26
|
+
* @param {Number|String} year Full year
|
|
27
|
+
* @return {Boolean} true if the date exists
|
|
28
|
+
*/
|
|
29
|
+
declare function isRealDate(day: number | string | undefined, month: number, year: number | string | undefined): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Converts day, month and year to a comparable YYYY-MM-DD string
|
|
32
|
+
*
|
|
33
|
+
* @param {Number|String} day Day of the month
|
|
34
|
+
* @param {Number} month Month index, 0 for January
|
|
35
|
+
* @param {Number|String} year Full year
|
|
36
|
+
* @return {String|Boolean} the date, or false for an impossible date
|
|
37
|
+
*/
|
|
38
|
+
declare function dateKey(day: number | string, month: number, year: number | string): string | false;
|
|
39
|
+
/**
|
|
40
|
+
* Parses a date-time value of the RFC 3501 section 9 form, like an INTERNALDATE ("14-Sep-2013 21:22:28 -0300").
|
|
41
|
+
* A value with only the date part is accepted as well, its time fields are left undefined
|
|
42
|
+
*
|
|
43
|
+
* @param {String} value Date-time value
|
|
44
|
+
* @return {Object|null} `{ day, month, year, hours, minutes, seconds, zone }` with the month index, or null
|
|
45
|
+
*/
|
|
46
|
+
declare function parseDateTime(value: unknown): DateParts | null;
|
|
47
|
+
/**
|
|
48
|
+
* Parses the date-time of a Date header (RFC 5322 section 3.3, with the obsolete forms of section 4.3: comments,
|
|
49
|
+
* two and three digit years, zone names). SEARCH uses only the date as written (RFC 3501 section 6.4.4), SORT
|
|
50
|
+
* normalizes date and time to UTC with toTimestamp (RFC 5256 section 2.2), so both read the header with this
|
|
51
|
+
*
|
|
52
|
+
* @param {String} header Value of the Date header
|
|
53
|
+
* @return {Object|null} `{ day, month, year, hours, minutes, seconds, zone }` with the month index, or null if the
|
|
54
|
+
* header has no valid date. The time fields are undefined when the header has no time
|
|
55
|
+
*/
|
|
56
|
+
declare function parseHeaderDate(header: string | undefined): DateParts | null;
|
|
57
|
+
/**
|
|
58
|
+
* Converts date and time parts to milliseconds since the epoch, adjusted by the time zone. An unknown zone is UTC
|
|
59
|
+
*
|
|
60
|
+
* @param {Object} date `{ day, month, year, hours, minutes, seconds, zone }`, see parseDateTime and parseHeaderDate
|
|
61
|
+
* @return {Number} timestamp
|
|
62
|
+
*/
|
|
63
|
+
declare function toTimestamp(date: DateParts): number;
|
|
64
|
+
export { MONTHS, monthIndex, isRealDate, dateKey, parseDateTime, parseHeaderDate, toTimestamp };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MONTHS = void 0;
|
|
4
|
+
exports.monthIndex = monthIndex;
|
|
5
|
+
exports.isRealDate = isRealDate;
|
|
6
|
+
exports.dateKey = dateKey;
|
|
7
|
+
exports.parseDateTime = parseDateTime;
|
|
8
|
+
exports.parseHeaderDate = parseHeaderDate;
|
|
9
|
+
exports.toTimestamp = toTimestamp;
|
|
10
|
+
// Month names of the RFC 3501 section 9 date-month rule, in the case they are sent in
|
|
11
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
12
|
+
exports.MONTHS = MONTHS;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the index of a month name, ignoring case like all ABNF strings
|
|
15
|
+
*
|
|
16
|
+
* @param {String} name Three letter month name, e.g. "jan"
|
|
17
|
+
* @return {Number} 0 for January to 11 for December, or -1 for an unknown name
|
|
18
|
+
*/
|
|
19
|
+
function monthIndex(name) {
|
|
20
|
+
const value = String(name || '').toLowerCase();
|
|
21
|
+
return MONTHS.findIndex(month => month.toLowerCase() === value);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Checks if day, month and year make a real date
|
|
25
|
+
*
|
|
26
|
+
* @param {Number|String} day Day of the month
|
|
27
|
+
* @param {Number} month Month index, 0 for January
|
|
28
|
+
* @param {Number|String} year Full year
|
|
29
|
+
* @return {Boolean} true if the date exists
|
|
30
|
+
*/
|
|
31
|
+
function isRealDate(day, month, year) {
|
|
32
|
+
day = Number(day);
|
|
33
|
+
year = Number(year);
|
|
34
|
+
if (month < 0 || month > 11 || !Number.isInteger(day) || day < 1) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return day <= new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Converts day, month and year to a comparable YYYY-MM-DD string
|
|
41
|
+
*
|
|
42
|
+
* @param {Number|String} day Day of the month
|
|
43
|
+
* @param {Number} month Month index, 0 for January
|
|
44
|
+
* @param {Number|String} year Full year
|
|
45
|
+
* @return {String|Boolean} the date, or false for an impossible date
|
|
46
|
+
*/
|
|
47
|
+
function dateKey(day, month, year) {
|
|
48
|
+
if (!isRealDate(day, month, year)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return String(year).padStart(4, '0') + '-' + String(month + 1).padStart(2, '0') + '-' + String(day).padStart(2, '0');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parses a date-time value of the RFC 3501 section 9 form, like an INTERNALDATE ("14-Sep-2013 21:22:28 -0300").
|
|
55
|
+
* A value with only the date part is accepted as well, its time fields are left undefined
|
|
56
|
+
*
|
|
57
|
+
* @param {String} value Date-time value
|
|
58
|
+
* @return {Object|null} `{ day, month, year, hours, minutes, seconds, zone }` with the month index, or null
|
|
59
|
+
*/
|
|
60
|
+
function parseDateTime(value) {
|
|
61
|
+
const match = String(value || '').match(/^\s*(\d{1,2})-([A-Za-z]{3})-(\d{4})(?: (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}))?/);
|
|
62
|
+
if (!match || !isRealDate(match[1], monthIndex(match[2]), match[3])) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const time = match[4] === undefined ? {} : { hours: Number(match[4]), minutes: Number(match[5]), seconds: Number(match[6]), zone: match[7] };
|
|
66
|
+
return Object.assign({ day: Number(match[1]), month: monthIndex(match[2]), year: Number(match[3]) }, time);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Parses the date-time of a Date header (RFC 5322 section 3.3, with the obsolete forms of section 4.3: comments,
|
|
70
|
+
* two and three digit years, zone names). SEARCH uses only the date as written (RFC 3501 section 6.4.4), SORT
|
|
71
|
+
* normalizes date and time to UTC with toTimestamp (RFC 5256 section 2.2), so both read the header with this
|
|
72
|
+
*
|
|
73
|
+
* @param {String} header Value of the Date header
|
|
74
|
+
* @return {Object|null} `{ day, month, year, hours, minutes, seconds, zone }` with the month index, or null if the
|
|
75
|
+
* header has no valid date. The time fields are undefined when the header has no time
|
|
76
|
+
*/
|
|
77
|
+
function parseHeaderDate(header) {
|
|
78
|
+
const match = (header || '')
|
|
79
|
+
.toString()
|
|
80
|
+
.replace(/\([^()]*\)/g, ' ')
|
|
81
|
+
.match(/^\s*(?:[A-Za-z]+\s*,)?\s*(\d{1,2})\s+([A-Za-z]{3})\s+(\d{2,4})(?:\s+(\d{1,2})\s*:\s*(\d{2})(?:\s*:\s*(\d{2}))?(?:\s+([+-]\d{4}|[A-Za-z]+))?)?/);
|
|
82
|
+
if (!match) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
let year = Number(match[3]);
|
|
86
|
+
// RFC 5322 section 4.3: two digit years below 50 are 20xx, three digit years add 1900
|
|
87
|
+
if (match[3].length === 2) {
|
|
88
|
+
year += year < 50 ? 2000 : 1900;
|
|
89
|
+
}
|
|
90
|
+
else if (match[3].length === 3) {
|
|
91
|
+
year += 1900;
|
|
92
|
+
}
|
|
93
|
+
const day = Number(match[1]);
|
|
94
|
+
const month = monthIndex(match[2]);
|
|
95
|
+
if (!isRealDate(day, month, year)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const time = match[4] === undefined ? {} : { hours: Number(match[4]), minutes: Number(match[5]), seconds: Number(match[6] || 0), zone: match[7] };
|
|
99
|
+
return Object.assign({ day, month, year }, time);
|
|
100
|
+
}
|
|
101
|
+
// RFC 5322 section 4.3 obsolete zones, military zones are treated as "-0000"
|
|
102
|
+
const ZONES = { UT: 0, GMT: 0, EST: -5, EDT: -4, CST: -6, CDT: -5, MST: -7, MDT: -6, PST: -8, PDT: -7 };
|
|
103
|
+
/**
|
|
104
|
+
* Converts date and time parts to milliseconds since the epoch, adjusted by the time zone. An unknown zone is UTC
|
|
105
|
+
*
|
|
106
|
+
* @param {Object} date `{ day, month, year, hours, minutes, seconds, zone }`, see parseDateTime and parseHeaderDate
|
|
107
|
+
* @return {Number} timestamp
|
|
108
|
+
*/
|
|
109
|
+
function toTimestamp(date) {
|
|
110
|
+
const zone = date.zone || '';
|
|
111
|
+
let offset = 0;
|
|
112
|
+
if (/^[+-]\d{4}$/.test(zone)) {
|
|
113
|
+
const sign = zone.charAt(0) === '-' ? -1 : 1;
|
|
114
|
+
const zoneHours = Number(zone.substr(1, 2));
|
|
115
|
+
const zoneMinutes = Number(zone.substr(3, 2));
|
|
116
|
+
if (zoneMinutes < 60) {
|
|
117
|
+
offset = sign * (zoneHours * 60 + zoneMinutes);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (Object.hasOwn(ZONES, zone.toUpperCase())) {
|
|
121
|
+
offset = ZONES[zone.toUpperCase()] * 60;
|
|
122
|
+
}
|
|
123
|
+
return Date.UTC(date.year, date.month, date.day, date.hours || 0, date.minutes || 0, date.seconds || 0) - offset * 60 * 1000;
|
|
124
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import zlib from 'node:zlib';
|
|
2
|
+
/** Options of a DeflateLayer */
|
|
3
|
+
export interface DeflateLayerOptions {
|
|
4
|
+
/** sends octets to the peer */
|
|
5
|
+
writeRaw: (data: Buffer | string) => void;
|
|
6
|
+
/** gets the input, decompressed while compression is active */
|
|
7
|
+
onData: (data: Buffer) => void;
|
|
8
|
+
/** called when the input is not valid DEFLATE data */
|
|
9
|
+
onError?: ((err: Error) => unknown) | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One end of a COMPRESS=DEFLATE layer (RFC 4978): raw DEFLATE (RFC 1951, no zlib header or
|
|
13
|
+
* checksum) in both directions. The server plugin uses it, and so do the clients of the tests and
|
|
14
|
+
* the compare tool.
|
|
15
|
+
*
|
|
16
|
+
* Either direction can be terminated, which UNAUTHENTICATE requires (RFC 8437 section 4.1). Output
|
|
17
|
+
* terminates with a final DEFLATE block, data written after that goes out uncompressed once the
|
|
18
|
+
* compressed data is out. Input terminates where the peer ended its compression: at the end of
|
|
19
|
+
* its DEFLATE stream if it sent a final block, otherwise at the end of the sync flush that
|
|
20
|
+
* carried the last compressed data. The input is split at sync flush markers to find that point.
|
|
21
|
+
*/
|
|
22
|
+
declare class DeflateLayer {
|
|
23
|
+
writeRaw: (data: Buffer | string) => void;
|
|
24
|
+
onData: (data: Buffer) => void;
|
|
25
|
+
onError: (err: Error) => unknown;
|
|
26
|
+
active: boolean;
|
|
27
|
+
inputActive: boolean;
|
|
28
|
+
_deflate: zlib.DeflateRaw;
|
|
29
|
+
_held: (Buffer | string)[] | null;
|
|
30
|
+
_endCallbacks: (() => void)[];
|
|
31
|
+
_flushScheduled: boolean;
|
|
32
|
+
_inflate: zlib.InflateRaw;
|
|
33
|
+
_pieces: Buffer[];
|
|
34
|
+
_busy: boolean;
|
|
35
|
+
_fed: number;
|
|
36
|
+
_expectFinal: boolean;
|
|
37
|
+
_idleCallbacks: (() => void)[];
|
|
38
|
+
/**
|
|
39
|
+
* @param {Object} options
|
|
40
|
+
* @param {Function} options.writeRaw `(buffer)` sends octets to the peer
|
|
41
|
+
* @param {Function} options.onData `(buffer)` gets the input, decompressed while compression is active
|
|
42
|
+
* @param {Function} [options.onError] `(err)` called when the input is not valid DEFLATE data
|
|
43
|
+
*/
|
|
44
|
+
constructor(options: DeflateLayerOptions);
|
|
45
|
+
/**
|
|
46
|
+
* Sends data to the peer, compressed while compression is active
|
|
47
|
+
*
|
|
48
|
+
* @param {Buffer} data Data to send
|
|
49
|
+
*/
|
|
50
|
+
write(data: Buffer | string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Terminates the outgoing compression with a final DEFLATE block. Later writes are sent
|
|
53
|
+
* uncompressed, after the compressed data.
|
|
54
|
+
*
|
|
55
|
+
* @param {Function} [callback] Called once the compressed data is written out
|
|
56
|
+
*/
|
|
57
|
+
end(callback?: (() => void) | null): void;
|
|
58
|
+
_runCallbacks(key: '_endCallbacks' | '_idleCallbacks'): void;
|
|
59
|
+
/**
|
|
60
|
+
* Handles octets received from the peer
|
|
61
|
+
*
|
|
62
|
+
* @param {Buffer} chunk Received data
|
|
63
|
+
*/
|
|
64
|
+
receive(chunk: Buffer): void;
|
|
65
|
+
/**
|
|
66
|
+
* Tells the layer that the peer terminates its compression after the data decompressed so far
|
|
67
|
+
* (RFC 8437 section 4.1). Call it from onData, the rest of the input is then passed on as is.
|
|
68
|
+
*/
|
|
69
|
+
endInput(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Calls back once all received data is passed on
|
|
72
|
+
*
|
|
73
|
+
* @param {Function} callback Function to call
|
|
74
|
+
*/
|
|
75
|
+
whenIdle(callback: () => void): void;
|
|
76
|
+
_next(): void;
|
|
77
|
+
_receivePlain(chunk: Buffer): void;
|
|
78
|
+
/**
|
|
79
|
+
* Frees the compressor and the decompressor
|
|
80
|
+
*/
|
|
81
|
+
destroy(): void;
|
|
82
|
+
}
|
|
83
|
+
export default DeflateLayer;
|