diff options
Diffstat (limited to 'includes/external/matrix/node_modules/matrix-js-sdk/lib/event-mapper.js.map')
-rw-r--r-- | includes/external/matrix/node_modules/matrix-js-sdk/lib/event-mapper.js.map | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/event-mapper.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/event-mapper.js.map new file mode 100644 index 0000000..c33ab23 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/event-mapper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"event-mapper.js","names":["_event","require","_event2","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","eventMapperFor","client","options","preventReEmit","Boolean","decrypt","mapper","plainOldJsObject","toDevice","room_id","room","getRoom","event","state_key","undefined","findEventById","event_id","status","MatrixEvent","setUnsigned","getUnsigned","unsigned","bundledEdit","getServerAggregatedRelation","RelationType","Replace","content","replacement","makeReplaced","thread","findThreadForEvent","setThread","isEncrypted","reEmitter","reEmit","MatrixEventEvent","Decrypted","decryptEventIfNeeded","Replaced","VisibilityChange","BeforeRedaction"],"sources":["../src/event-mapper.ts"],"sourcesContent":["/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MatrixClient } from \"./client\";\nimport { IEvent, MatrixEvent, MatrixEventEvent } from \"./models/event\";\nimport { RelationType } from \"./@types/event\";\n\nexport type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;\n\nexport interface MapperOpts {\n // don't re-emit events emitted on an event mapped by this mapper on the client\n preventReEmit?: boolean;\n // decrypt event proactively\n decrypt?: boolean;\n // the event is a to_device event\n toDevice?: boolean;\n}\n\nexport function eventMapperFor(client: MatrixClient, options: MapperOpts): EventMapper {\n let preventReEmit = Boolean(options.preventReEmit);\n const decrypt = options.decrypt !== false;\n\n function mapper(plainOldJsObject: Partial<IEvent>): MatrixEvent {\n if (options.toDevice) {\n delete plainOldJsObject.room_id;\n }\n\n const room = client.getRoom(plainOldJsObject.room_id);\n\n let event: MatrixEvent | undefined;\n // If the event is already known to the room, let's re-use the model rather than duplicating.\n // We avoid doing this to state events as they may be forward or backwards looking which tweaks behaviour.\n if (room && plainOldJsObject.state_key === undefined) {\n event = room.findEventById(plainOldJsObject.event_id!);\n }\n\n if (!event || event.status) {\n event = new MatrixEvent(plainOldJsObject);\n } else {\n // merge the latest unsigned data from the server\n event.setUnsigned({ ...event.getUnsigned(), ...plainOldJsObject.unsigned });\n // prevent doubling up re-emitters\n preventReEmit = true;\n }\n\n // if there is a complete edit bundled alongside the event, perform the replacement.\n // (prior to MSC3925, events were automatically replaced on the server-side. MSC3925 proposes that that doesn't\n // happen automatically but the server does provide us with the whole content of the edit event.)\n const bundledEdit = event.getServerAggregatedRelation<Partial<IEvent>>(RelationType.Replace);\n if (bundledEdit?.content) {\n const replacement = mapper(bundledEdit);\n // XXX: it's worth noting that the spec says we should only respect encrypted edits if, once decrypted, the\n // replacement has a `m.new_content` property. The problem is that we haven't yet decrypted the replacement\n // (it should be happening in the background), so we can't enforce this. Possibly we should for decryption\n // to complete, but that sounds a bit racy. For now, we just assume it's ok.\n event.makeReplaced(replacement);\n }\n\n const thread = room?.findThreadForEvent(event);\n if (thread) {\n event.setThread(thread);\n }\n\n // TODO: once we get rid of the old libolm-backed crypto, we can restrict this to room events (rather than\n // to-device events), because the rust implementation decrypts to-device messages at a higher level.\n // Generally we probably want to use a different eventMapper implementation for to-device events because\n if (event.isEncrypted()) {\n if (!preventReEmit) {\n client.reEmitter.reEmit(event, [MatrixEventEvent.Decrypted]);\n }\n if (decrypt) {\n client.decryptEventIfNeeded(event);\n }\n }\n\n if (!preventReEmit) {\n client.reEmitter.reEmit(event, [MatrixEventEvent.Replaced, MatrixEventEvent.VisibilityChange]);\n room?.reEmitter.reEmit(event, [MatrixEventEvent.BeforeRedaction]);\n }\n return event;\n }\n\n return mapper;\n}\n"],"mappings":";;;;;;;;AAiBA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAA8C,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAmB,yBAAA,GAAAnB,MAAA,CAAAoB,gBAAA,CAAAV,MAAA,EAAAV,MAAA,CAAAmB,yBAAA,CAAAL,MAAA,KAAAlB,OAAA,CAA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