@rapidmx/mapi-plugin 1.0.0-beta.10
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/LICENSE +382 -0
- package/README.md +60 -0
- package/dist/lib/BaseMapiEmsmdbRoute.js +489 -0
- package/dist/lib/BaseMapiEmsmdbRoute.js.map +1 -0
- package/dist/lib/BaseMapiNspiRoute.js +114 -0
- package/dist/lib/BaseMapiNspiRoute.js.map +1 -0
- package/dist/lib/MapiSessionManager.js +475 -0
- package/dist/lib/MapiSessionManager.js.map +1 -0
- package/dist/lib/RegexPatternUtils.js +30 -0
- package/dist/lib/RegexPatternUtils.js.map +1 -0
- package/dist/lib/RopDispatcher.js +145 -0
- package/dist/lib/RopDispatcher.js.map +1 -0
- package/dist/lib/codec/AppointmentRecurrence.js +315 -0
- package/dist/lib/codec/AppointmentRecurrence.js.map +1 -0
- package/dist/lib/codec/BufferCursor.js +242 -0
- package/dist/lib/codec/BufferCursor.js.map +1 -0
- package/dist/lib/codec/GlobalObjectId.js +98 -0
- package/dist/lib/codec/GlobalObjectId.js.map +1 -0
- package/dist/lib/codec/MapiGuid.js +41 -0
- package/dist/lib/codec/MapiGuid.js.map +1 -0
- package/dist/lib/codec/MapiTimeZone.js +126 -0
- package/dist/lib/codec/MapiTimeZone.js.map +1 -0
- package/dist/lib/codec/PropertyValue.js +240 -0
- package/dist/lib/codec/PropertyValue.js.map +1 -0
- package/dist/lib/codec/RopBuffer.js +38 -0
- package/dist/lib/codec/RopBuffer.js.map +1 -0
- package/dist/lib/codec/TypedString.js +54 -0
- package/dist/lib/codec/TypedString.js.map +1 -0
- package/dist/lib/index.js +99 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/mongo/MapiEmsmdbRouteMongo.js +85 -0
- package/dist/lib/mongo/MapiEmsmdbRouteMongo.js.map +1 -0
- package/dist/lib/mongo/MapiNspiRouteMongo.js +33 -0
- package/dist/lib/mongo/MapiNspiRouteMongo.js.map +1 -0
- package/dist/lib/mongo/index.js +7 -0
- package/dist/lib/mongo/index.js.map +1 -0
- package/dist/lib/mongo.js +6 -0
- package/dist/lib/mongo.js.map +1 -0
- package/dist/lib/nspi/NspiBindHandler.js +54 -0
- package/dist/lib/nspi/NspiBindHandler.js.map +1 -0
- package/dist/lib/nspi/NspiCodec.js +106 -0
- package/dist/lib/nspi/NspiCodec.js.map +1 -0
- package/dist/lib/nspi/NspiGetMatchesHandler.js +142 -0
- package/dist/lib/nspi/NspiGetMatchesHandler.js.map +1 -0
- package/dist/lib/rop/AddressList.js +114 -0
- package/dist/lib/rop/AddressList.js.map +1 -0
- package/dist/lib/rop/CalendarEventTarget.js +30 -0
- package/dist/lib/rop/CalendarEventTarget.js.map +1 -0
- package/dist/lib/rop/CalendarNamedProperties.js +57 -0
- package/dist/lib/rop/CalendarNamedProperties.js.map +1 -0
- package/dist/lib/rop/ContactTarget.js +19 -0
- package/dist/lib/rop/ContactTarget.js.map +1 -0
- package/dist/lib/rop/ContentsTable.js +60 -0
- package/dist/lib/rop/ContentsTable.js.map +1 -0
- package/dist/lib/rop/ExecuteBudget.js +82 -0
- package/dist/lib/rop/ExecuteBudget.js.map +1 -0
- package/dist/lib/rop/FastTransferStream.js +195 -0
- package/dist/lib/rop/FastTransferStream.js.map +1 -0
- package/dist/lib/rop/FolderTarget.js +118 -0
- package/dist/lib/rop/FolderTarget.js.map +1 -0
- package/dist/lib/rop/HandleDataCache.js +412 -0
- package/dist/lib/rop/HandleDataCache.js.map +1 -0
- package/dist/lib/rop/MeetingMessageClassHandler.js +241 -0
- package/dist/lib/rop/MeetingMessageClassHandler.js.map +1 -0
- package/dist/lib/rop/MessageBodyStream.js +68 -0
- package/dist/lib/rop/MessageBodyStream.js.map +1 -0
- package/dist/lib/rop/MessageTarget.js +57 -0
- package/dist/lib/rop/MessageTarget.js.map +1 -0
- package/dist/lib/rop/NamedPropertyRegistry.js +69 -0
- package/dist/lib/rop/NamedPropertyRegistry.js.map +1 -0
- package/dist/lib/rop/PropertyResolvers.js +353 -0
- package/dist/lib/rop/PropertyResolvers.js.map +1 -0
- package/dist/lib/rop/RepoPaging.js +54 -0
- package/dist/lib/rop/RepoPaging.js.map +1 -0
- package/dist/lib/rop/RestapiRules.js +52 -0
- package/dist/lib/rop/RestapiRules.js.map +1 -0
- package/dist/lib/rop/RopCreateMessageHandler.js +55 -0
- package/dist/lib/rop/RopCreateMessageHandler.js.map +1 -0
- package/dist/lib/rop/RopDeleteFolderHandler.js +174 -0
- package/dist/lib/rop/RopDeleteFolderHandler.js.map +1 -0
- package/dist/lib/rop/RopDeleteMessagesHandler.js +110 -0
- package/dist/lib/rop/RopDeleteMessagesHandler.js.map +1 -0
- package/dist/lib/rop/RopFastTransferSourceCopyPropertiesHandler.js +61 -0
- package/dist/lib/rop/RopFastTransferSourceCopyPropertiesHandler.js.map +1 -0
- package/dist/lib/rop/RopFastTransferSourceCopyToHandler.js +60 -0
- package/dist/lib/rop/RopFastTransferSourceCopyToHandler.js.map +1 -0
- package/dist/lib/rop/RopFastTransferSourceGetBufferHandler.js +76 -0
- package/dist/lib/rop/RopFastTransferSourceGetBufferHandler.js.map +1 -0
- package/dist/lib/rop/RopGetContentsTableHandler.js +55 -0
- package/dist/lib/rop/RopGetContentsTableHandler.js.map +1 -0
- package/dist/lib/rop/RopGetHierarchyTableHandler.js +42 -0
- package/dist/lib/rop/RopGetHierarchyTableHandler.js.map +1 -0
- package/dist/lib/rop/RopGetPropertiesSpecificHandler.js +56 -0
- package/dist/lib/rop/RopGetPropertiesSpecificHandler.js.map +1 -0
- package/dist/lib/rop/RopGetPropertyIdsFromNamesHandler.js +92 -0
- package/dist/lib/rop/RopGetPropertyIdsFromNamesHandler.js.map +1 -0
- package/dist/lib/rop/RopHandler.js +6 -0
- package/dist/lib/rop/RopHandler.js.map +1 -0
- package/dist/lib/rop/RopLogonHandler.js +135 -0
- package/dist/lib/rop/RopLogonHandler.js.map +1 -0
- package/dist/lib/rop/RopOpenFolderHandler.js +48 -0
- package/dist/lib/rop/RopOpenFolderHandler.js.map +1 -0
- package/dist/lib/rop/RopOpenMessageHandler.js +83 -0
- package/dist/lib/rop/RopOpenMessageHandler.js.map +1 -0
- package/dist/lib/rop/RopOpenStreamHandler.js +84 -0
- package/dist/lib/rop/RopOpenStreamHandler.js.map +1 -0
- package/dist/lib/rop/RopQueryRowsHandler.js +120 -0
- package/dist/lib/rop/RopQueryRowsHandler.js.map +1 -0
- package/dist/lib/rop/RopReadStreamHandler.js +73 -0
- package/dist/lib/rop/RopReadStreamHandler.js.map +1 -0
- package/dist/lib/rop/RopReleaseHandler.js +23 -0
- package/dist/lib/rop/RopReleaseHandler.js.map +1 -0
- package/dist/lib/rop/RopSaveChangesMessageHandler.js +269 -0
- package/dist/lib/rop/RopSaveChangesMessageHandler.js.map +1 -0
- package/dist/lib/rop/RopSetColumnsHandler.js +50 -0
- package/dist/lib/rop/RopSetColumnsHandler.js.map +1 -0
- package/dist/lib/rop/RopSetPropertiesHandler.js +173 -0
- package/dist/lib/rop/RopSetPropertiesHandler.js.map +1 -0
- package/dist/lib/rop/RopSubmitMessageHandler.js +342 -0
- package/dist/lib/rop/RopSubmitMessageHandler.js.map +1 -0
- package/dist/lib/rop/RopWriteStreamHandler.js +72 -0
- package/dist/lib/rop/RopWriteStreamHandler.js.map +1 -0
- package/dist/lib/rop/TaskNamedProperties.js +29 -0
- package/dist/lib/rop/TaskNamedProperties.js.map +1 -0
- package/dist/lib/rop/TaskTarget.js +15 -0
- package/dist/lib/rop/TaskTarget.js.map +1 -0
- package/dist/lib/rop/TransportSend.js +16 -0
- package/dist/lib/rop/TransportSend.js.map +1 -0
- package/dist/lib/sql/MapiEmsmdbRouteSQL.js +85 -0
- package/dist/lib/sql/MapiEmsmdbRouteSQL.js.map +1 -0
- package/dist/lib/sql/MapiNspiRouteSQL.js +33 -0
- package/dist/lib/sql/MapiNspiRouteSQL.js.map +1 -0
- package/dist/lib/sql/index.js +7 -0
- package/dist/lib/sql/index.js.map +1 -0
- package/dist/lib/sql.js +6 -0
- package/dist/lib/sql.js.map +1 -0
- package/dist/types/BaseMapiEmsmdbRoute.d.ts +139 -0
- package/dist/types/BaseMapiNspiRoute.d.ts +38 -0
- package/dist/types/MapiSessionManager.d.ts +285 -0
- package/dist/types/RegexPatternUtils.d.ts +14 -0
- package/dist/types/RopDispatcher.d.ts +53 -0
- package/dist/types/codec/AppointmentRecurrence.d.ts +14 -0
- package/dist/types/codec/BufferCursor.d.ts +92 -0
- package/dist/types/codec/GlobalObjectId.d.ts +15 -0
- package/dist/types/codec/MapiGuid.d.ts +6 -0
- package/dist/types/codec/MapiTimeZone.d.ts +7 -0
- package/dist/types/codec/PropertyValue.d.ts +87 -0
- package/dist/types/codec/RopBuffer.d.ts +32 -0
- package/dist/types/codec/TypedString.d.ts +17 -0
- package/dist/types/index.d.ts +94 -0
- package/dist/types/mongo/MapiEmsmdbRouteMongo.d.ts +20 -0
- package/dist/types/mongo/MapiNspiRouteMongo.d.ts +13 -0
- package/dist/types/mongo/index.d.ts +2 -0
- package/dist/types/mongo.d.ts +1 -0
- package/dist/types/nspi/NspiBindHandler.d.ts +22 -0
- package/dist/types/nspi/NspiCodec.d.ts +59 -0
- package/dist/types/nspi/NspiGetMatchesHandler.d.ts +26 -0
- package/dist/types/rop/AddressList.d.ts +48 -0
- package/dist/types/rop/CalendarEventTarget.d.ts +33 -0
- package/dist/types/rop/CalendarNamedProperties.d.ts +37 -0
- package/dist/types/rop/ContactTarget.d.ts +29 -0
- package/dist/types/rop/ContentsTable.d.ts +16 -0
- package/dist/types/rop/ExecuteBudget.d.ts +48 -0
- package/dist/types/rop/FastTransferStream.d.ts +57 -0
- package/dist/types/rop/FolderTarget.d.ts +64 -0
- package/dist/types/rop/HandleDataCache.d.ts +145 -0
- package/dist/types/rop/MeetingMessageClassHandler.d.ts +30 -0
- package/dist/types/rop/MessageBodyStream.d.ts +35 -0
- package/dist/types/rop/MessageTarget.d.ts +45 -0
- package/dist/types/rop/NamedPropertyRegistry.d.ts +50 -0
- package/dist/types/rop/PropertyResolvers.d.ts +86 -0
- package/dist/types/rop/RepoPaging.d.ts +30 -0
- package/dist/types/rop/RestapiRules.d.ts +32 -0
- package/dist/types/rop/RopCreateMessageHandler.d.ts +24 -0
- package/dist/types/rop/RopDeleteFolderHandler.d.ts +53 -0
- package/dist/types/rop/RopDeleteMessagesHandler.d.ts +43 -0
- package/dist/types/rop/RopFastTransferSourceCopyPropertiesHandler.d.ts +25 -0
- package/dist/types/rop/RopFastTransferSourceCopyToHandler.d.ts +25 -0
- package/dist/types/rop/RopFastTransferSourceGetBufferHandler.d.ts +22 -0
- package/dist/types/rop/RopGetContentsTableHandler.d.ts +25 -0
- package/dist/types/rop/RopGetHierarchyTableHandler.d.ts +18 -0
- package/dist/types/rop/RopGetPropertiesSpecificHandler.d.ts +26 -0
- package/dist/types/rop/RopGetPropertyIdsFromNamesHandler.d.ts +23 -0
- package/dist/types/rop/RopHandler.d.ts +106 -0
- package/dist/types/rop/RopLogonHandler.d.ts +31 -0
- package/dist/types/rop/RopOpenFolderHandler.d.ts +20 -0
- package/dist/types/rop/RopOpenMessageHandler.d.ts +28 -0
- package/dist/types/rop/RopOpenStreamHandler.d.ts +28 -0
- package/dist/types/rop/RopQueryRowsHandler.d.ts +43 -0
- package/dist/types/rop/RopReadStreamHandler.d.ts +20 -0
- package/dist/types/rop/RopReleaseHandler.d.ts +15 -0
- package/dist/types/rop/RopSaveChangesMessageHandler.d.ts +59 -0
- package/dist/types/rop/RopSetColumnsHandler.d.ts +21 -0
- package/dist/types/rop/RopSetPropertiesHandler.d.ts +38 -0
- package/dist/types/rop/RopSubmitMessageHandler.d.ts +80 -0
- package/dist/types/rop/RopWriteStreamHandler.d.ts +31 -0
- package/dist/types/rop/TaskNamedProperties.d.ts +24 -0
- package/dist/types/rop/TaskTarget.d.ts +24 -0
- package/dist/types/rop/TransportSend.d.ts +10 -0
- package/dist/types/sql/MapiEmsmdbRouteSQL.d.ts +20 -0
- package/dist/types/sql/MapiNspiRouteSQL.d.ts +13 -0
- package/dist/types/sql/index.d.ts +2 -0
- package/dist/types/sql.d.ts +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import { DecodeError } from "./BufferCursor.js";
|
|
6
|
+
import { decodeGuid, encodeGuid } from "./MapiGuid.js";
|
|
7
|
+
/**
|
|
8
|
+
* The property-value system every meaningful ROP depends on (`RopGetPropertiesSpecific`/`RopSetProperties`,
|
|
9
|
+
* table row data in `RopQueryRows`, ...), per `[MS-OXCDATA]` §2.11. Only the property types this phase's
|
|
10
|
+
* planned ROP handlers actually need are implemented (`readPropertyValue`/`writePropertyValue` throw a clear
|
|
11
|
+
* error for anything else) - add more as a real handler needs them, not speculatively.
|
|
12
|
+
*
|
|
13
|
+
* Numeric values and member names (`Ptyp*`) are exactly as published in `[MS-OXCDATA]`'s "Property Data
|
|
14
|
+
* Types" table - the full `Ptyp`-prefixed spec names are used rather than shorter aliases (`String`,
|
|
15
|
+
* `Boolean`, ...) both for fidelity to the spec and because those shorter names collide with this project's
|
|
16
|
+
* lint config's `id-denylist` rule (which exists to stop primitive-wrapper-like names shadowing globals).
|
|
17
|
+
*/
|
|
18
|
+
export var PropertyType;
|
|
19
|
+
(function (PropertyType) {
|
|
20
|
+
PropertyType[PropertyType["PtypNull"] = 1] = "PtypNull";
|
|
21
|
+
PropertyType[PropertyType["PtypInteger16"] = 2] = "PtypInteger16";
|
|
22
|
+
PropertyType[PropertyType["PtypInteger32"] = 3] = "PtypInteger32";
|
|
23
|
+
PropertyType[PropertyType["PtypFloating32"] = 4] = "PtypFloating32";
|
|
24
|
+
PropertyType[PropertyType["PtypFloating64"] = 5] = "PtypFloating64";
|
|
25
|
+
PropertyType[PropertyType["PtypBoolean"] = 11] = "PtypBoolean";
|
|
26
|
+
PropertyType[PropertyType["PtypInteger64"] = 20] = "PtypInteger64";
|
|
27
|
+
PropertyType[PropertyType["PtypString8"] = 30] = "PtypString8";
|
|
28
|
+
PropertyType[PropertyType["PtypString"] = 31] = "PtypString";
|
|
29
|
+
PropertyType[PropertyType["PtypTime"] = 64] = "PtypTime";
|
|
30
|
+
PropertyType[PropertyType["PtypGuid"] = 72] = "PtypGuid";
|
|
31
|
+
PropertyType[PropertyType["PtypBinary"] = 258] = "PtypBinary";
|
|
32
|
+
PropertyType[PropertyType["PtypMultipleInteger32"] = 4099] = "PtypMultipleInteger32";
|
|
33
|
+
PropertyType[PropertyType["PtypMultipleString8"] = 4126] = "PtypMultipleString8";
|
|
34
|
+
PropertyType[PropertyType["PtypMultipleString"] = 4127] = "PtypMultipleString";
|
|
35
|
+
PropertyType[PropertyType["PtypMultipleBinary"] = 4354] = "PtypMultipleBinary";
|
|
36
|
+
})(PropertyType || (PropertyType = {}));
|
|
37
|
+
/**
|
|
38
|
+
* `PropertyTag` structure (`[MS-OXCDATA]` §2.9): a 4-byte value with **`PropertyType` in the low-order 16
|
|
39
|
+
* bits and `PropertyId` in the high-order 16 bits** - confirmed against the spec's own bit-range description
|
|
40
|
+
* and cross-checked against the well-known real property-tag constant `PR_SUBJECT = 0x0037001F` (`PidTagSubject`
|
|
41
|
+
* = property ID `0x0037`, `PtypString` = type `0x001F`), which only decodes correctly with `PropertyType` as
|
|
42
|
+
* the low half. On the wire (little-endian), that means `PropertyType` is read/written first.
|
|
43
|
+
*/
|
|
44
|
+
export function readPropertyTag(reader) {
|
|
45
|
+
const propertyType = reader.readUInt16LE();
|
|
46
|
+
const propertyId = reader.readUInt16LE();
|
|
47
|
+
return { propertyId, propertyType };
|
|
48
|
+
}
|
|
49
|
+
/** The most `PropertyTag`s accepted in one request's tag array (`RopSetColumns`, `RopGetPropertiesSpecific`,
|
|
50
|
+
* the FastTransfer source ROPs, NSPI `Columns`). Every tag multiplies the per-row resolution work and, for
|
|
51
|
+
* `RopSetColumns`, the stored session state; a real client asks for far fewer. */
|
|
52
|
+
export const MAX_PROPERTY_TAG_COUNT = 256;
|
|
53
|
+
/**
|
|
54
|
+
* Reads `count` consecutive `PropertyTag`s. When `count` exceeds `MAX_PROPERTY_TAG_COUNT`, the tags' bytes are
|
|
55
|
+
* skipped (still bounds-checked, so a count larger than the buffer throws) and `undefined` is returned, leaving
|
|
56
|
+
* the reader positioned after the array so the caller can send an error response and keep parsing later ROPs.
|
|
57
|
+
*/
|
|
58
|
+
export function readPropertyTagArray(reader, count) {
|
|
59
|
+
if (count > MAX_PROPERTY_TAG_COUNT) {
|
|
60
|
+
reader.readBytes(count * 4);
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const tags = [];
|
|
64
|
+
for (let i = 0; i < count; i++) {
|
|
65
|
+
tags.push(readPropertyTag(reader));
|
|
66
|
+
}
|
|
67
|
+
return tags;
|
|
68
|
+
}
|
|
69
|
+
export function writePropertyTag(writer, tag) {
|
|
70
|
+
writer.writeUInt16LE(tag.propertyType);
|
|
71
|
+
writer.writeUInt16LE(tag.propertyId);
|
|
72
|
+
}
|
|
73
|
+
/** `TypedPropertyValue` structure (`[MS-OXCDATA]` §2.11.4): `PropertyType` (2 bytes) followed by the value
|
|
74
|
+
* itself, encoded per `readPropertyValue`/`writePropertyValue` below. */
|
|
75
|
+
export function readTypedPropertyValue(reader) {
|
|
76
|
+
const propertyType = reader.readUInt16LE();
|
|
77
|
+
const value = readPropertyValue(reader, propertyType);
|
|
78
|
+
return { propertyType, value };
|
|
79
|
+
}
|
|
80
|
+
export function writeTypedPropertyValue(writer, typed) {
|
|
81
|
+
writer.writeUInt16LE(typed.propertyType);
|
|
82
|
+
writePropertyValue(writer, typed.propertyType, typed.value);
|
|
83
|
+
}
|
|
84
|
+
/** `TaggedPropertyValue` structure (`[MS-OXCDATA]` §2.11.4, confirmed via `RopSetProperties`'s own request-buffer
|
|
85
|
+
* page): a full `PropertyTag` (4 bytes - `PropertyId` **and** `PropertyType`, unlike `TypedPropertyValue`'s bare
|
|
86
|
+
* `PropertyType`) followed by the value itself. Used where a property's identity can't be inferred from
|
|
87
|
+
* context (e.g. `RopSetProperties`, which sets an arbitrary, client-chosen set of properties in one call). */
|
|
88
|
+
export function readTaggedPropertyValue(reader) {
|
|
89
|
+
const tag = readPropertyTag(reader);
|
|
90
|
+
const value = readPropertyValue(reader, tag.propertyType);
|
|
91
|
+
return { propertyId: tag.propertyId, propertyType: tag.propertyType, value };
|
|
92
|
+
}
|
|
93
|
+
export function writeTaggedPropertyValue(writer, tagged) {
|
|
94
|
+
writePropertyTag(writer, { propertyId: tagged.propertyId, propertyType: tagged.propertyType });
|
|
95
|
+
writePropertyValue(writer, tagged.propertyType, tagged.value);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads a bare `PropertyValue` (`[MS-OXCDATA]` §2.11.2) of the given, already-known `type`. `PtypBinary`'s
|
|
99
|
+
* length prefix is 16 bits and every `PtypMultiple*`'s value count is 32 bits wide, per the spec's explicit
|
|
100
|
+
* "in the context of ROP buffers" sizing rule - the only context every planned caller of this function
|
|
101
|
+
* operates in (the wider 32-bit `PtypBinary` count only applies to extended rules / a specific MAPI/HTTP
|
|
102
|
+
* structure this library doesn't implement).
|
|
103
|
+
*/
|
|
104
|
+
export function readPropertyValue(reader, type) {
|
|
105
|
+
switch (type) {
|
|
106
|
+
case PropertyType.PtypNull:
|
|
107
|
+
return 0;
|
|
108
|
+
case PropertyType.PtypInteger16:
|
|
109
|
+
return reader.readInt16LE();
|
|
110
|
+
case PropertyType.PtypInteger32:
|
|
111
|
+
return reader.readInt32LE();
|
|
112
|
+
case PropertyType.PtypFloating32:
|
|
113
|
+
return reader.readFloatLE();
|
|
114
|
+
case PropertyType.PtypFloating64:
|
|
115
|
+
return reader.readDoubleLE();
|
|
116
|
+
case PropertyType.PtypBoolean:
|
|
117
|
+
return reader.readUInt8() !== 0;
|
|
118
|
+
case PropertyType.PtypInteger64:
|
|
119
|
+
return reader.readBigInt64LE();
|
|
120
|
+
case PropertyType.PtypTime:
|
|
121
|
+
return filetimeToDate(reader.readBigUInt64LE());
|
|
122
|
+
case PropertyType.PtypGuid:
|
|
123
|
+
return decodeGuid(reader);
|
|
124
|
+
case PropertyType.PtypString:
|
|
125
|
+
return reader.readNullTerminatedUtf16LE();
|
|
126
|
+
case PropertyType.PtypString8:
|
|
127
|
+
return reader.readNullTerminatedString8();
|
|
128
|
+
case PropertyType.PtypBinary:
|
|
129
|
+
return reader.readBytes(reader.readUInt16LE());
|
|
130
|
+
case PropertyType.PtypMultipleInteger32:
|
|
131
|
+
return readCountedArray(reader, () => reader.readInt32LE());
|
|
132
|
+
case PropertyType.PtypMultipleString:
|
|
133
|
+
return readCountedArray(reader, () => reader.readNullTerminatedUtf16LE());
|
|
134
|
+
case PropertyType.PtypMultipleString8:
|
|
135
|
+
return readCountedArray(reader, () => reader.readNullTerminatedString8());
|
|
136
|
+
case PropertyType.PtypMultipleBinary:
|
|
137
|
+
return readCountedArray(reader, () => reader.readBytes(reader.readUInt16LE()));
|
|
138
|
+
default:
|
|
139
|
+
// The value's size is unknown, so nothing after it in the request can be located.
|
|
140
|
+
throw new DecodeError(`PropertyValue: unsupported PropertyType 0x${type.toString(16)}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export function writePropertyValue(writer, type, value) {
|
|
144
|
+
switch (type) {
|
|
145
|
+
case PropertyType.PtypNull:
|
|
146
|
+
return;
|
|
147
|
+
case PropertyType.PtypInteger16:
|
|
148
|
+
writer.writeInt16LE(value);
|
|
149
|
+
return;
|
|
150
|
+
case PropertyType.PtypInteger32:
|
|
151
|
+
writer.writeInt32LE(value);
|
|
152
|
+
return;
|
|
153
|
+
case PropertyType.PtypFloating32:
|
|
154
|
+
writer.writeFloatLE(value);
|
|
155
|
+
return;
|
|
156
|
+
case PropertyType.PtypFloating64:
|
|
157
|
+
writer.writeDoubleLE(value);
|
|
158
|
+
return;
|
|
159
|
+
case PropertyType.PtypBoolean:
|
|
160
|
+
writer.writeUInt8(value ? 1 : 0);
|
|
161
|
+
return;
|
|
162
|
+
case PropertyType.PtypInteger64:
|
|
163
|
+
writer.writeBigInt64LE(value);
|
|
164
|
+
return;
|
|
165
|
+
case PropertyType.PtypTime:
|
|
166
|
+
writer.writeBigUInt64LE(dateToFiletime(value));
|
|
167
|
+
return;
|
|
168
|
+
case PropertyType.PtypGuid:
|
|
169
|
+
writer.writeBytes(encodeGuid(value));
|
|
170
|
+
return;
|
|
171
|
+
case PropertyType.PtypString:
|
|
172
|
+
writer.writeNullTerminatedUtf16LE(value);
|
|
173
|
+
return;
|
|
174
|
+
case PropertyType.PtypString8:
|
|
175
|
+
writer.writeNullTerminatedString8(value);
|
|
176
|
+
return;
|
|
177
|
+
case PropertyType.PtypBinary: {
|
|
178
|
+
const buf = value;
|
|
179
|
+
writer.writeUInt16LE(buf.length);
|
|
180
|
+
writer.writeBytes(buf);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
case PropertyType.PtypMultipleInteger32:
|
|
184
|
+
writeCountedArray(writer, value, (v) => writer.writeInt32LE(v));
|
|
185
|
+
return;
|
|
186
|
+
case PropertyType.PtypMultipleString:
|
|
187
|
+
writeCountedArray(writer, value, (v) => writer.writeNullTerminatedUtf16LE(v));
|
|
188
|
+
return;
|
|
189
|
+
case PropertyType.PtypMultipleString8:
|
|
190
|
+
writeCountedArray(writer, value, (v) => writer.writeNullTerminatedString8(v));
|
|
191
|
+
return;
|
|
192
|
+
case PropertyType.PtypMultipleBinary:
|
|
193
|
+
writeCountedArray(writer, value, (v) => {
|
|
194
|
+
writer.writeUInt16LE(v.length);
|
|
195
|
+
writer.writeBytes(v);
|
|
196
|
+
});
|
|
197
|
+
return;
|
|
198
|
+
default:
|
|
199
|
+
throw new Error(`PropertyValue: unsupported PropertyType 0x${type.toString(16)}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** `count` is a fully client-controlled `uint32` (up to ~4.29 billion). Every element type this reads needs at
|
|
203
|
+
* least 1 byte on the wire, so a `count` exceeding the buffer's actual remaining bytes can never be genuine -
|
|
204
|
+
* rejecting it immediately, before looping at all, turns a client lying about the count into an instant, clear
|
|
205
|
+
* `RangeError` instead of a loop that runs until either the heap is exhausted or (for the two `PtypMultipleString*`
|
|
206
|
+
* variants specifically, whose element reader used to tolerate running past the buffer's end - see
|
|
207
|
+
* `BufferCursor.ts`'s own doc comment) it simply never terminates. Defense in depth alongside that fix, not a
|
|
208
|
+
* replacement for it - this also fails fast for a merely-oversized-but-technically-satisfiable count instead of
|
|
209
|
+
* allocating a huge array first. */
|
|
210
|
+
function readCountedArray(reader, readOne) {
|
|
211
|
+
const count = reader.readUInt32LE();
|
|
212
|
+
if (count > reader.remaining) {
|
|
213
|
+
throw new DecodeError(`PropertyValue.readCountedArray(): element count ${count} exceeds the remaining buffer size (${reader.remaining}).`);
|
|
214
|
+
}
|
|
215
|
+
const values = [];
|
|
216
|
+
for (let i = 0; i < count; i++) {
|
|
217
|
+
values.push(readOne());
|
|
218
|
+
}
|
|
219
|
+
return values;
|
|
220
|
+
}
|
|
221
|
+
function writeCountedArray(writer, values, writeOne) {
|
|
222
|
+
writer.writeUInt32LE(values.length);
|
|
223
|
+
for (const value of values) {
|
|
224
|
+
writeOne(value);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/** 100-nanosecond intervals between the FILETIME epoch (1601-01-01T00:00:00Z) and the Unix epoch
|
|
228
|
+
* (1970-01-01T00:00:00Z) - `[MS-DTYP]`'s `FILETIME` structure, which `PtypTime` uses. */
|
|
229
|
+
const FILETIME_EPOCH_DIFF_100NS = 116444736000000000n;
|
|
230
|
+
/** Converts a `PtypTime` value (100-ns intervals since 1601-01-01) into a JS `Date`. Sub-millisecond
|
|
231
|
+
* precision is truncated - `Date` has no finer resolution, a real, bounded, documented gap. */
|
|
232
|
+
export function filetimeToDate(filetime) {
|
|
233
|
+
const millis = (filetime - FILETIME_EPOCH_DIFF_100NS) / 10000n;
|
|
234
|
+
return new Date(Number(millis));
|
|
235
|
+
}
|
|
236
|
+
/** Converts a JS `Date` into a `PtypTime` value (100-ns intervals since 1601-01-01). */
|
|
237
|
+
export function dateToFiletime(date) {
|
|
238
|
+
return BigInt(date.getTime()) * 10000n + FILETIME_EPOCH_DIFF_100NS;
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=PropertyValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyValue.js","sourceRoot":"","sources":["../../../src/codec/PropertyValue.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,EAA8B,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACpB,uDAAiB,CAAA;IACjB,iEAAsB,CAAA;IACtB,iEAAsB,CAAA;IACtB,mEAAuB,CAAA;IACvB,mEAAuB,CAAA;IACvB,8DAAoB,CAAA;IACpB,kEAAsB,CAAA;IACtB,8DAAoB,CAAA;IACpB,4DAAmB,CAAA;IACnB,wDAAiB,CAAA;IACjB,wDAAiB,CAAA;IACjB,6DAAmB,CAAA;IACnB,oFAA8B,CAAA;IAC9B,gFAA4B,CAAA;IAC5B,8EAA2B,CAAA;IAC3B,8EAA2B,CAAA;AAC/B,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB;AAoBD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAChD,MAAM,YAAY,GAAiB,MAAM,CAAC,YAAY,EAAE,CAAC;IACzD,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;I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,EAAE,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,iBAAiB,CAAI,MAAoB,EAAE,MAAW,EAAE,QAA4B;IACzF,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;AACL,CAAC;AAED;yFACyF;AACzF,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAEtD;+FAC+F;AAC/F,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC3C,MAAM,MAAM,GAAG,CAAC,QAAQ,GAAG,yBAAyB,CAAC,GAAG,MAAM,CAAC;IAC/D,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,cAAc,CAAC,IAAU;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,GAAG,yBAAyB,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import { BufferReader, BufferWriter } from "./BufferCursor.js";
|
|
6
|
+
/** The largest `ServerObjectHandleTable` accepted. Every ROP addresses a handle by a one-byte index, so a table
|
|
7
|
+
* with more than 255 entries can't be referenced anyway; a larger one is only a way to make the server allocate
|
|
8
|
+
* and echo back an oversized array. */
|
|
9
|
+
export const MAX_HANDLE_TABLE_ENTRIES = 255;
|
|
10
|
+
export function encodeRopBuffer(buf) {
|
|
11
|
+
const writer = new BufferWriter();
|
|
12
|
+
// RopSize covers itself (2 bytes) plus ropsList - the handle table isn't part of RopSize's count.
|
|
13
|
+
writer.writeUInt16LE(2 + buf.ropsList.length);
|
|
14
|
+
writer.writeBytes(buf.ropsList);
|
|
15
|
+
// One allocation for the whole table instead of one small buffer per entry.
|
|
16
|
+
const table = Buffer.alloc(buf.handleTable.length * 4);
|
|
17
|
+
buf.handleTable.forEach((handle, index) => table.writeUInt32LE(handle >>> 0, index * 4));
|
|
18
|
+
writer.writeBytes(table);
|
|
19
|
+
return writer.toBuffer();
|
|
20
|
+
}
|
|
21
|
+
/** Throws a `RangeError` for a malformed buffer: a `RopSize` smaller than its own field or larger than the
|
|
22
|
+
* buffer, a handle table that isn't a whole number of 4-byte entries, or one with more than
|
|
23
|
+
* `MAX_HANDLE_TABLE_ENTRIES` entries. */
|
|
24
|
+
export function decodeRopBuffer(buffer) {
|
|
25
|
+
const reader = new BufferReader(buffer);
|
|
26
|
+
const ropSize = reader.readUInt16LE();
|
|
27
|
+
const ropsList = reader.readBytes(ropSize - 2);
|
|
28
|
+
const tableBytes = reader.remaining;
|
|
29
|
+
if (tableBytes % 4 !== 0 || tableBytes / 4 > MAX_HANDLE_TABLE_ENTRIES) {
|
|
30
|
+
throw new RangeError(`RopBuffer: invalid ServerObjectHandleTable of ${tableBytes} bytes.`);
|
|
31
|
+
}
|
|
32
|
+
const handleTable = [];
|
|
33
|
+
while (reader.hasMore()) {
|
|
34
|
+
handleTable.push(reader.readUInt32LE());
|
|
35
|
+
}
|
|
36
|
+
return { ropsList, handleTable };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=RopBuffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RopBuffer.js","sourceRoot":"","sources":["../../../src/codec/RopBuffer.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA0B/D;;uCAEuC;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AAC;QACtB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** `TypedString` (`[MS-OXCDATA]` §2.11.7) `StringType` enumeration values. */
|
|
2
|
+
const STRING_TYPE_NONE = 0x00;
|
|
3
|
+
const STRING_TYPE_EMPTY = 0x01;
|
|
4
|
+
const STRING_TYPE_STRING8 = 0x02;
|
|
5
|
+
const STRING_TYPE_REDUCED_UNICODE = 0x03;
|
|
6
|
+
const STRING_TYPE_UNICODE = 0x04;
|
|
7
|
+
/**
|
|
8
|
+
* `TypedString` (`[MS-OXCDATA]` §2.11.7): a leading `StringType` byte followed by an optional string in the
|
|
9
|
+
* format that byte names - used by `RopOpenMessage`'s success response (`SubjectPrefix`/`NormalizedSubject`).
|
|
10
|
+
* `writeTypedString` never produces the "reduced Unicode" (`0x03`) form - that's purely a wire-size
|
|
11
|
+
* optimization real Exchange applies when every character happens to fit in one byte, not something a peer is
|
|
12
|
+
* ever required to send, so this codec always writes plain UTF-16LE (`0x04`) for non-empty strings. `undefined`
|
|
13
|
+
* writes as "no string" (`0x00`), matching a field the spec allows to be entirely absent (e.g. no subject
|
|
14
|
+
* prefix at all, as opposed to an empty one).
|
|
15
|
+
*/
|
|
16
|
+
export function writeTypedString(writer, value) {
|
|
17
|
+
if (value === undefined) {
|
|
18
|
+
writer.writeUInt8(STRING_TYPE_NONE);
|
|
19
|
+
}
|
|
20
|
+
else if (value === "") {
|
|
21
|
+
writer.writeUInt8(STRING_TYPE_EMPTY);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
writer.writeUInt8(STRING_TYPE_UNICODE);
|
|
25
|
+
writer.writeNullTerminatedUtf16LE(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Reads a `TypedString`, supporting every `StringType` value a peer could legally send (`0x00`-`0x04`) even
|
|
29
|
+
* though `writeTypedString` only ever produces `0x00`/`0x01`/`0x04` itself - this side of the codec is only
|
|
30
|
+
* ever exercised in this library's own round-trip tests, since a real MAPI/HTTP client never sends a
|
|
31
|
+
* `TypedString` value to the server. Returns `undefined` for `StringType = 0x00` ("no string"), matching
|
|
32
|
+
* `writeTypedString`'s own `undefined` input. */
|
|
33
|
+
export function readTypedString(reader) {
|
|
34
|
+
const stringType = reader.readUInt8();
|
|
35
|
+
switch (stringType) {
|
|
36
|
+
case STRING_TYPE_NONE:
|
|
37
|
+
return undefined;
|
|
38
|
+
case STRING_TYPE_EMPTY:
|
|
39
|
+
return "";
|
|
40
|
+
case STRING_TYPE_STRING8:
|
|
41
|
+
return reader.readNullTerminatedString8();
|
|
42
|
+
case STRING_TYPE_REDUCED_UNICODE: {
|
|
43
|
+
let value = "";
|
|
44
|
+
for (let code = reader.readUInt8(); code !== 0; code = reader.readUInt8()) {
|
|
45
|
+
value += String.fromCharCode(code);
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
case STRING_TYPE_UNICODE:
|
|
50
|
+
default:
|
|
51
|
+
return reader.readNullTerminatedUtf16LE();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=TypedString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedString.js","sourceRoot":"","sources":["../../../src/codec/TypedString.ts"],"names":[],"mappings":"AAMA,8EAA8E;AAC9E,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AACzC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAoB,EAAE,KAAyB;IAC5E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC;SAAM,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACtB,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACJ,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;QACvC,MAAM,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;AACL,CAAC;AAED;;;;iDAIiD;AACjD,MAAM,UAAU,eAAe,CAAC,MAAoB;IAChD,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACtC,QAAQ,UAAU,EAAE,CAAC;QACjB,KAAK,gBAAgB;YACjB,OAAO,SAAS,CAAC;QACrB,KAAK,iBAAiB;YAClB,OAAO,EAAE,CAAC;QACd,KAAK,mBAAmB;YACpB,OAAO,MAAM,CAAC,yBAAyB,EAAE,CAAC;QAC9C,KAAK,2BAA2B,CAAC,CAAC,CAAC;YAC/B,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,KAAK,IAAI,IAAI,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;gBACxE,KAAK,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,KAAK,mBAAmB,CAAC;QACzB;YACI,OAAO,MAAM,CAAC,yBAAyB,EAAE,CAAC;IAClD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
/**
|
|
6
|
+
* MAPI-over-HTTP protocol compatibility (Phase 3 of this library's roadmap): a hand-built ROP (Remote
|
|
7
|
+
* Operation) codec and buffer-framing layer (`[MS-OXCROPS]`), JWT-secured EMSMDB transport (`BaseMapiEmsmdbRoute`,
|
|
8
|
+
* reusing the framework's existing `@Auth(["jwt"])` strategy - no MAPI-specific auth code of its own), and a
|
|
9
|
+
* minimal NSPI address-book endpoint (`BaseMapiNspiRoute`) for GAL "search as you type" lookups.
|
|
10
|
+
*
|
|
11
|
+
* This module exports only the backend-agnostic surface: the wire-format codecs, the abstract route base
|
|
12
|
+
* classes, `MapiSessionManager`, the ROP dispatcher, and every ROP/NSPI handler class (each takes a generic
|
|
13
|
+
* `RopContext`/repo argument, not a concrete entity class, so none of them are backend-specific). The concrete
|
|
14
|
+
* Mongo/SQL classes a deployment actually instantiates (`MapiEmsmdbRouteMongo`/`SQL`,
|
|
15
|
+
* `MapiNspiRouteMongo`/`SQL`) are exported from this package's `./mongo`/`./sql` subpaths instead, alongside
|
|
16
|
+
* every other entity/route/job this library defines - see `src/eas/index.ts`'s identical doc comment for the
|
|
17
|
+
* same convention.
|
|
18
|
+
*
|
|
19
|
+
* A deployment mounts both MAPI endpoints with a trivial one-line subclass each, the same pattern
|
|
20
|
+
* `src/eas/index.ts`'s doc comment describes for `BaseEasRoute`:
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { MapiEmsmdbRouteMongo, MapiNspiRouteMongo } from "@rapidrest/mail/mongo";
|
|
23
|
+
* import { RouteDecorators } from "@rapidrest/service-core";
|
|
24
|
+
* const { Route } = RouteDecorators;
|
|
25
|
+
*
|
|
26
|
+
* @Route("/mapi/emsmdb")
|
|
27
|
+
* export class MyMapiEmsmdbRoute extends MapiEmsmdbRouteMongo {}
|
|
28
|
+
*
|
|
29
|
+
* @Route("/mapi/nspi")
|
|
30
|
+
* export class MyMapiNspiRoute extends MapiNspiRouteMongo {}
|
|
31
|
+
* ```
|
|
32
|
+
* Real Outlook desktop locates both URLs via `@rapidrest/mail/autodiscover`'s Outlook/EXCH response
|
|
33
|
+
* (`BaseAutodiscoverRoute`'s `mapiUrl` property) - see that module's own doc comment.
|
|
34
|
+
*
|
|
35
|
+
* **Documented gaps in this pragmatic subset** (see the architecture plan's "MAPI over HTTP (Phase 3)" section
|
|
36
|
+
* for the full reasoning behind each):
|
|
37
|
+
* - Incremental sync (`RopFastTransferSourceCopyTo`/`CopyProperties`/`GetBuffer`) always builds a full,
|
|
38
|
+
* non-differential dump, not real IDSET-based ICS (`[MS-OXCFXICS]`) - a real client still works correctly
|
|
39
|
+
* against this, just less efficiently than byte-perfect ICS.
|
|
40
|
+
* - Calendar/meetings: no counter-proposals, meeting-forwarding, delegate scheduling, or resource-booking
|
|
41
|
+
* auto-accept; no DST-aware timezones (fixed-offset approximation only); no recurrence exceptions/modified
|
|
42
|
+
* instances; no Hijri/`MonthEnd` recurrence patterns.
|
|
43
|
+
* - No `RopModifyRecipients` - attendees/recipients are always added via the same `PidTagDisplayTo`/`Cc`
|
|
44
|
+
* pragmatic path used for ordinary mail.
|
|
45
|
+
* - No public-folder support, no delegate/shared-mailbox access, no rules/permissions/search-folder ROPs, no
|
|
46
|
+
* client-certificate enrollment.
|
|
47
|
+
* - Calendar named properties (location/recurrence/timezone/etc.) are excluded from FastTransfer streams -
|
|
48
|
+
* only the columns in `FastTransferStream.ts`'s `DEFAULT_*_COLUMNS` tables are included.
|
|
49
|
+
* - NSPI is limited to `Bind`/`Unbind`/`GetMatches` only - no row/name lookups beyond a single content-
|
|
50
|
+
* restriction search, no directory replication.
|
|
51
|
+
*/
|
|
52
|
+
export * from "./codec/BufferCursor.js";
|
|
53
|
+
export * from "./codec/MapiGuid.js";
|
|
54
|
+
export * from "./codec/TypedString.js";
|
|
55
|
+
export * from "./codec/PropertyValue.js";
|
|
56
|
+
export * from "./codec/RopBuffer.js";
|
|
57
|
+
export * from "./codec/AppointmentRecurrence.js";
|
|
58
|
+
export * from "./codec/MapiTimeZone.js";
|
|
59
|
+
export * from "./codec/GlobalObjectId.js";
|
|
60
|
+
export * from "./RopDispatcher.js";
|
|
61
|
+
export * from "./MapiSessionManager.js";
|
|
62
|
+
export * from "./BaseMapiEmsmdbRoute.js";
|
|
63
|
+
export * from "./BaseMapiNspiRoute.js";
|
|
64
|
+
export * from "./rop/RopHandler.js";
|
|
65
|
+
export * from "./rop/FolderTarget.js";
|
|
66
|
+
export * from "./rop/MessageTarget.js";
|
|
67
|
+
export * from "./rop/CalendarEventTarget.js";
|
|
68
|
+
export * from "./rop/MessageBodyStream.js";
|
|
69
|
+
export * from "./rop/PropertyResolvers.js";
|
|
70
|
+
export * from "./rop/NamedPropertyRegistry.js";
|
|
71
|
+
export * from "./rop/CalendarNamedProperties.js";
|
|
72
|
+
export * from "./rop/FastTransferStream.js";
|
|
73
|
+
export * from "./rop/MeetingMessageClassHandler.js";
|
|
74
|
+
export * from "./rop/RopLogonHandler.js";
|
|
75
|
+
export * from "./rop/RopReleaseHandler.js";
|
|
76
|
+
export * from "./rop/RopOpenFolderHandler.js";
|
|
77
|
+
export * from "./rop/RopGetHierarchyTableHandler.js";
|
|
78
|
+
export * from "./rop/RopSetColumnsHandler.js";
|
|
79
|
+
export * from "./rop/RopQueryRowsHandler.js";
|
|
80
|
+
export * from "./rop/RopGetContentsTableHandler.js";
|
|
81
|
+
export * from "./rop/RopOpenMessageHandler.js";
|
|
82
|
+
export * from "./rop/RopGetPropertiesSpecificHandler.js";
|
|
83
|
+
export * from "./rop/RopOpenStreamHandler.js";
|
|
84
|
+
export * from "./rop/RopReadStreamHandler.js";
|
|
85
|
+
export * from "./rop/RopCreateMessageHandler.js";
|
|
86
|
+
export * from "./rop/RopSetPropertiesHandler.js";
|
|
87
|
+
export * from "./rop/RopWriteStreamHandler.js";
|
|
88
|
+
export * from "./rop/RopSaveChangesMessageHandler.js";
|
|
89
|
+
export * from "./rop/RopSubmitMessageHandler.js";
|
|
90
|
+
export * from "./rop/RopGetPropertyIdsFromNamesHandler.js";
|
|
91
|
+
export * from "./rop/RopDeleteMessagesHandler.js";
|
|
92
|
+
export * from "./rop/RopDeleteFolderHandler.js";
|
|
93
|
+
export * from "./rop/RopFastTransferSourceCopyToHandler.js";
|
|
94
|
+
export * from "./rop/RopFastTransferSourceCopyPropertiesHandler.js";
|
|
95
|
+
export * from "./rop/RopFastTransferSourceGetBufferHandler.js";
|
|
96
|
+
export * from "./nspi/NspiCodec.js";
|
|
97
|
+
export * from "./nspi/NspiBindHandler.js";
|
|
98
|
+
export * from "./nspi/NspiGetMatchesHandler.js";
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qDAAqD,CAAC;AACpE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
9
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
10
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
11
|
+
import { AuditLogEntryMongo, CalendarEventMongo, ContactMongo, FolderMongo, LabelMongo, MailboxMongo, MessageMongo, TaskMongo, } from "@rapidmx/restapi/mongo";
|
|
12
|
+
import { BaseMapiEmsmdbRoute } from "../BaseMapiEmsmdbRoute.js";
|
|
13
|
+
import { RopLogonHandler } from "../rop/RopLogonHandler.js";
|
|
14
|
+
import { RopReleaseHandler } from "../rop/RopReleaseHandler.js";
|
|
15
|
+
import { RopOpenFolderHandler } from "../rop/RopOpenFolderHandler.js";
|
|
16
|
+
import { RopGetHierarchyTableHandler } from "../rop/RopGetHierarchyTableHandler.js";
|
|
17
|
+
import { RopGetContentsTableHandler } from "../rop/RopGetContentsTableHandler.js";
|
|
18
|
+
import { RopSetColumnsHandler } from "../rop/RopSetColumnsHandler.js";
|
|
19
|
+
import { RopQueryRowsHandler } from "../rop/RopQueryRowsHandler.js";
|
|
20
|
+
import { RopOpenMessageHandler } from "../rop/RopOpenMessageHandler.js";
|
|
21
|
+
import { RopGetPropertiesSpecificHandler } from "../rop/RopGetPropertiesSpecificHandler.js";
|
|
22
|
+
import { RopOpenStreamHandler } from "../rop/RopOpenStreamHandler.js";
|
|
23
|
+
import { RopReadStreamHandler } from "../rop/RopReadStreamHandler.js";
|
|
24
|
+
import { RopCreateMessageHandler } from "../rop/RopCreateMessageHandler.js";
|
|
25
|
+
import { RopSetPropertiesHandler } from "../rop/RopSetPropertiesHandler.js";
|
|
26
|
+
import { RopWriteStreamHandler } from "../rop/RopWriteStreamHandler.js";
|
|
27
|
+
import { RopSaveChangesMessageHandler } from "../rop/RopSaveChangesMessageHandler.js";
|
|
28
|
+
import { RopSubmitMessageHandler } from "../rop/RopSubmitMessageHandler.js";
|
|
29
|
+
import { RopGetPropertyIdsFromNamesHandler } from "../rop/RopGetPropertyIdsFromNamesHandler.js";
|
|
30
|
+
import { RopDeleteMessagesHandler } from "../rop/RopDeleteMessagesHandler.js";
|
|
31
|
+
import { RopDeleteFolderHandler } from "../rop/RopDeleteFolderHandler.js";
|
|
32
|
+
import { RopFastTransferSourceCopyToHandler } from "../rop/RopFastTransferSourceCopyToHandler.js";
|
|
33
|
+
import { RopFastTransferSourceCopyPropertiesHandler } from "../rop/RopFastTransferSourceCopyPropertiesHandler.js";
|
|
34
|
+
import { RopFastTransferSourceGetBufferHandler } from "../rop/RopFastTransferSourceGetBufferHandler.js";
|
|
35
|
+
import { RouteDecorators } from "@rapidrest/service-core";
|
|
36
|
+
const { Route } = RouteDecorators;
|
|
37
|
+
/**
|
|
38
|
+
* Mongo-backed concrete `BaseMapiEmsmdbRoute`, mounted at `/mapi/emsmdb`. Exported from this plugin's
|
|
39
|
+
* `./mongo` entry point, so the server host mounts it without a wrapper class of its
|
|
40
|
+
* own.
|
|
41
|
+
*
|
|
42
|
+
* @author Jean-Philippe Steinmetz
|
|
43
|
+
*/
|
|
44
|
+
let MapiEmsmdbRouteMongo = class MapiEmsmdbRouteMongo extends BaseMapiEmsmdbRoute {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.mailboxClass = MailboxMongo;
|
|
48
|
+
this.folderClass = FolderMongo;
|
|
49
|
+
this.messageClass = MessageMongo;
|
|
50
|
+
this.calendarEventClass = CalendarEventMongo;
|
|
51
|
+
this.contactClass = ContactMongo;
|
|
52
|
+
this.taskClass = TaskMongo;
|
|
53
|
+
this.labelClass = LabelMongo;
|
|
54
|
+
this.auditLogClass = AuditLogEntryMongo;
|
|
55
|
+
this.ropHandlerClasses = [
|
|
56
|
+
RopLogonHandler,
|
|
57
|
+
RopReleaseHandler,
|
|
58
|
+
RopOpenFolderHandler,
|
|
59
|
+
RopGetHierarchyTableHandler,
|
|
60
|
+
RopGetContentsTableHandler,
|
|
61
|
+
RopSetColumnsHandler,
|
|
62
|
+
RopQueryRowsHandler,
|
|
63
|
+
RopOpenMessageHandler,
|
|
64
|
+
RopGetPropertiesSpecificHandler,
|
|
65
|
+
RopOpenStreamHandler,
|
|
66
|
+
RopReadStreamHandler,
|
|
67
|
+
RopCreateMessageHandler,
|
|
68
|
+
RopSetPropertiesHandler,
|
|
69
|
+
RopWriteStreamHandler,
|
|
70
|
+
RopSaveChangesMessageHandler,
|
|
71
|
+
RopSubmitMessageHandler,
|
|
72
|
+
RopGetPropertyIdsFromNamesHandler,
|
|
73
|
+
RopDeleteMessagesHandler,
|
|
74
|
+
RopDeleteFolderHandler,
|
|
75
|
+
RopFastTransferSourceCopyToHandler,
|
|
76
|
+
RopFastTransferSourceCopyPropertiesHandler,
|
|
77
|
+
RopFastTransferSourceGetBufferHandler,
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
MapiEmsmdbRouteMongo = __decorate([
|
|
82
|
+
Route("/mapi/emsmdb")
|
|
83
|
+
], MapiEmsmdbRouteMongo);
|
|
84
|
+
export { MapiEmsmdbRouteMongo };
|
|
85
|
+
//# sourceMappingURL=MapiEmsmdbRouteMongo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapiEmsmdbRouteMongo.js","sourceRoot":"","sources":["../../../src/mongo/MapiEmsmdbRouteMongo.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAA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AY,CAAC;QACjC,cAAS,GAAQ,SAAS,CAAC;QAC3B,eAAU,GAAQ,UAAU,CAAC;QAC7B,kBAAa,GAAQ,kBAAkB,CAAC;QACxC,sBAAiB,GAAU;YACjC,eAAe;YACf,iBAAiB;YACjB,oBAAoB;YACpB,2BAA2B;YAC3B,0BAA0B;YAC1B,oBAAoB;YACpB,mBAAmB;YACnB,qBAAqB;YACrB,+BAA+B;YAC/B,oBAAoB;YACpB,oBAAoB;YACpB,uBAAuB;YACvB,uBAAuB;YACvB,qBAAqB;YACrB,4BAA4B;YAC5B,uBAAuB;YACvB,iCAAiC;YACjC,wBAAwB;YACxB,sBAAsB;YACtB,kCAAkC;YAClC,0CAA0C;YAC1C,qCAAqC;SACxC,CAAC;IACN,CAAC;CAAA,CAAA;AAjCY,oBAAoB;IADhC,KAAK,CAAC,cAAc,CAAC;GACT,oBAAoB,CAiChC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
9
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
10
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
11
|
+
import { ContactMongo, MailboxMongo } from "@rapidmx/restapi/mongo";
|
|
12
|
+
import { BaseMapiNspiRoute } from "../BaseMapiNspiRoute.js";
|
|
13
|
+
import { RouteDecorators } from "@rapidrest/service-core";
|
|
14
|
+
const { Route } = RouteDecorators;
|
|
15
|
+
/**
|
|
16
|
+
* Mongo-backed concrete `BaseMapiNspiRoute`, mounted at `/mapi/nspi`. Exported from this plugin's
|
|
17
|
+
* `./mongo` entry point, so the server host mounts it without a wrapper class of its
|
|
18
|
+
* own.
|
|
19
|
+
*
|
|
20
|
+
* @author Jean-Philippe Steinmetz
|
|
21
|
+
*/
|
|
22
|
+
let MapiNspiRouteMongo = class MapiNspiRouteMongo extends BaseMapiNspiRoute {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.mailboxClass = MailboxMongo;
|
|
26
|
+
this.contactClass = ContactMongo;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
MapiNspiRouteMongo = __decorate([
|
|
30
|
+
Route("/mapi/nspi")
|
|
31
|
+
], MapiNspiRouteMongo);
|
|
32
|
+
export { MapiNspiRouteMongo };
|
|
33
|
+
//# sourceMappingURL=MapiNspiRouteMongo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapiNspiRouteMongo.js","sourceRoot":"","sources":["../../../src/mongo/MapiNspiRouteMongo.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;AAElC;;;;;;GAMG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,iBAA+B;IAAhE;;QACO,iBAAY,GAAQ,YAAY,CAAC;QACjC,iBAAY,GAAQ,YAAY,CAAC;IAC/C,CAAC;CAAA,CAAA;AAHY,kBAAkB;IAD9B,KAAK,CAAC,YAAY,CAAC;GACP,kBAAkB,CAG9B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
export * from "./MapiEmsmdbRouteMongo.js";
|
|
6
|
+
export * from "./MapiNspiRouteMongo.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mongo/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz. All rights reserved.
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
export * from "./mongo/index.js";
|
|
6
|
+
//# sourceMappingURL=mongo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo.js","sourceRoot":"","sources":["../../src/mongo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mEAAmE;AACnE,mCAAmC;AACnC,+EAA+E;AAC/E,cAAc,kBAAkB,CAAC"}
|