UNPKG

14.6 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../src/matrix.js"],"names":["module","exports","ContentHelpers","require","MatrixEvent","EventStatus","MatrixInMemoryStore","IndexedDBStore","IndexedDBStoreBackend","SyncAccumulator","MatrixHttpApi","MatrixError","InvalidStoreError","MatrixClient","Room","Group","EventTimeline","EventTimelineSet","RoomMember","RoomState","User","MatrixScheduler","WebStorageSessionStore","CRYPTO_ENABLED","ContentRepo","Filter","TimelineWindow","InteractiveAuth","MemoryCryptoStore","default","IndexedDBCryptoStore","createNewMatrixCall","setMatrixCallAudioOutput","setAudioOutput","setMatrixCallAudioInput","setAudioInput","setMatrixCallVideoInput","setVideoInput","request","r","getRequest","wrapRequest","wrapper","origRequest","options","callback","cryptoStoreFactory","setCryptoStoreFactory","fac","createClient","opts","store","localStorage","global","scheduler","cryptoStore"],"mappings":"AAAA;;;;;;;;;;;;;;;;AAgBA;;AAEA;;AACAA,OAAOC,OAAP,CAAeC,cAAf,GAAgCC,QAAQ,mBAAR,CAAhC;AACA;AACAH,OAAOC,OAAP,CAAeG,WAAf,GAA6BD,QAAQ,gBAAR,EAA0BC,WAAvD;AACA;AACAJ,OAAOC,OAAP,CAAeI,WAAf,GAA6BF,QAAQ,gBAAR,EAA0BE,WAAvD;AACA;AACAL,OAAOC,OAAP,CAAeK,mBAAf,GAAqCH,QAAQ,gBAAR,EAA0BG,mBAA/D;AACA;AACAN,OAAOC,OAAP,CAAeM,cAAf,GAAgCJ,QAAQ,mBAAR,EAA6BI,cAA7D;AACA;AACAP,OAAOC,OAAP,CAAeO,qBAAf,GAAuCL,QAAQ,mBAAR,EAA6BK,qBAApE;AACA;AACAR,OAAOC,OAAP,CAAeQ,eAAf,GAAiCN,QAAQ,oBAAR,CAAjC;AACA;AACAH,OAAOC,OAAP,CAAeS,aAAf,GAA+BP,QAAQ,YAAR,EAAsBO,aAArD;AACA;AACAV,OAAOC,OAAP,CAAeU,WAAf,GAA6BR,QAAQ,YAAR,EAAsBQ,WA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ACH,iBAAWA;AADR,KAAP;AAGH;AACDA,OAAKZ,OAAL,GAAeY,KAAKZ,OAAL,IAAgBA,OAA/B;AACAY,OAAKC,KAAL,GAAaD,KAAKC,KAAL,IAAc,IAAInD,OAAOC,OAAP,CAAeK,mBAAnB,CAAuC;AAChE8C,kBAAcC,OAAOD;AAD2C,GAAvC,CAA3B;AAGAF,OAAKI,SAAL,GAAiBJ,KAAKI,SAAL,IAAkB,IAAItD,OAAOC,OAAP,CAAeoB,eAAnB,EAAnC;AACA6B,OAAKK,WAAL,GAAmBL,KAAKK,WAAL,IAAoBT,oBAAvC;AACA,SAAO,IAAI9C,OAAOC,OAAP,CAAeY,YAAnB,CAAgCqC,IAAhC,CAAP;AACH,CAbD;;AAeA;;;;;;;;;;;;;;;;;AAiBA;;;;;;;;;;AAUC","file":"matrix.js","sourcesContent":["/*\nCopyright 2015, 2016 OpenMarket Ltd\nCopyright 2017 Vector Creations Ltd\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\"use strict\";\n\n/** The {@link module:ContentHelpers} object */\nmodule.exports.ContentHelpers = require(\"./content-helpers\");\n/** The {@link module:models/event.MatrixEvent|MatrixEvent} class. */\nmodule.exports.MatrixEvent = require(\"./models/event\").MatrixEvent;\n/** The {@link module:models/event.EventStatus|EventStatus} enum. */\nmodule.exports.EventStatus = require(\"./models/event\").EventStatus;\n/** The {@link module:store/memory.MatrixInMemoryStore|MatrixInMemoryStore} class. */\nmodule.exports.MatrixInMemoryStore = require(\"./store/memory\").MatrixInMemoryStore;\n/** The {@link module:store/indexeddb.IndexedDBStore|IndexedDBStore} class. */\nmodule.exports.IndexedDBStore = require(\"./store/indexeddb\").IndexedDBStore;\n/** The {@link module:store/indexeddb.IndexedDBStoreBackend|IndexedDBStoreBackend} class. */\nmodule.exports.IndexedDBStoreBackend = require(\"./store/indexeddb\").IndexedDBStoreBackend;\n/** The {@link module:sync-accumulator.SyncAccumulator|SyncAccumulator} class. */\nmodule.exports.SyncAccumulator = require(\"./sync-accumulator\");\n/** The {@link module:http-api.MatrixHttpApi|MatrixHttpApi} class. */\nmodule.exports.MatrixHttpApi = require(\"./http-api\").MatrixHttpApi;\n/** The {@link module:http-api.MatrixError|MatrixError} class. */\nmodule.exports.MatrixError = require(\"./http-api\").MatrixError;\n/** The {@link module:errors.InvalidStoreError|InvalidStoreError} class. */\nmodule.exports.InvalidStoreError = require(\"./errors\").InvalidStoreError;\n/** The {@link module:client.MatrixClient|MatrixClient} class. */\nmodule.exports.MatrixClient = require(\"./client\").MatrixClient;\n/** The {@link module:models/room|Room} class. */\nmodule.exports.Room = require(\"./models/room\");\n/** The {@link module:models/group|Group} class. */\nmodule.exports.Group = require(\"./models/group\");\n/** The {@link module:models/event-timeline~EventTimeline} class. */\nmodule.exports.EventTimeline = require(\"./models/event-timeline\");\n/** The {@link module:models/event-timeline-set~EventTimelineSet} class. */\nmodule.exports.EventTimelineSet = require(\"./models/event-timeline-set\");\n/** The {@link module:models/room-member|RoomMember} class. */\nmodule.exports.RoomMember = require(\"./models/room-member\");\n/** The {@link module:models/room-state~RoomState|RoomState} class. */\nmodule.exports.RoomState = require(\"./models/room-state\");\n/** The {@link module:models/user~User|User} class. */\nmodule.exports.User = require(\"./models/user\");\n/** The {@link module:scheduler~MatrixScheduler|MatrixScheduler} class. */\nmodule.exports.MatrixScheduler = require(\"./scheduler\");\n/** The {@link module:store/session/webstorage~WebStorageSessionStore|\n * WebStorageSessionStore} class. <strong>Work in progress; unstable.</strong> */\nmodule.exports.WebStorageSessionStore = require(\"./store/session/webstorage\");\n/** True if crypto libraries are being used on this client. */\nmodule.exports.CRYPTO_ENABLED = require(\"./client\").CRYPTO_ENABLED;\n/** {@link module:content-repo|ContentRepo} utility functions. */\nmodule.exports.ContentRepo = require(\"./content-repo\");\n/** The {@link module:filter~Filter|Filter} class. */\nmodule.exports.Filter = require(\"./filter\");\n/** The {@link module:timeline-window~TimelineWindow} class. */\nmodule.exports.TimelineWindow = require(\"./timeline-window\").TimelineWindow;\n/** The {@link module:interactive-auth} class. */\nmodule.exports.InteractiveAuth = require(\"./interactive-auth\");\n\n\nmodule.exports.MemoryCryptoStore =\n require(\"./crypto/store/memory-crypto-store\").default;\nmodule.exports.IndexedDBCryptoStore =\n require(\"./crypto/store/indexeddb-crypto-store\").default;\n\n/**\n * Create a new Matrix Call.\n * @function\n * @param {module:client.MatrixClient} client The MatrixClient instance to use.\n * @param {string} roomId The room the call is in.\n * @return {module:webrtc/call~MatrixCall} The Matrix call or null if the browser\n * does not support WebRTC.\n */\nmodule.exports.createNewMatrixCall = require(\"./webrtc/call\").createNewMatrixCall;\n\n\n/**\n * Set an audio output device to use for MatrixCalls\n * @function\n * @param {string=} deviceId the identifier for the device\n * undefined treated as unset\n */\nmodule.exports.setMatrixCallAudioOutput = require('./webrtc/call').setAudioOutput;\n/**\n * Set an audio input device to use for MatrixCalls\n * @function\n * @param {string=} deviceId the identifier for the device\n * undefined treated as unset\n */\nmodule.exports.setMatrixCallAudioInput = require('./webrtc/call').setAudioInput;\n/**\n * Set a video input device to use for MatrixCalls\n * @function\n * @param {string=} deviceId the identifier for the device\n * undefined treated as unset\n */\nmodule.exports.setMatrixCallVideoInput = require('./webrtc/call').setVideoInput;\n\n\n// expose the underlying request object so different environments can use\n// different request libs (e.g. request or browser-request)\nlet request;\n/**\n * The function used to perform HTTP requests. Only use this if you want to\n * use a different HTTP library, e.g. Angular's <code>$http</code>. This should\n * be set prior to calling {@link createClient}.\n * @param {requestFunction} r The request function to use.\n */\nmodule.exports.request = function(r) {\n request = r;\n};\n\n/**\n * Return the currently-set request function.\n * @return {requestFunction} The current request function.\n */\nmodule.exports.getRequest = function() {\n return request;\n};\n\n/**\n * Apply wrapping code around the request function. The wrapper function is\n * installed as the new request handler, and when invoked it is passed the\n * previous value, along with the options and callback arguments.\n * @param {requestWrapperFunction} wrapper The wrapping function.\n */\nmodule.exports.wrapRequest = function(wrapper) {\n const origRequest = request;\n request = function(options, callback) {\n return wrapper(origRequest, options, callback);\n };\n};\n\n\nlet cryptoStoreFactory = () => new module.exports.MemoryCryptoStore;\n\n/**\n * Configure a different factory to be used for creating crypto stores\n *\n * @param {Function} fac a function which will return a new\n * {@link module:crypto.store.base~CryptoStore}.\n */\nmodule.exports.setCryptoStoreFactory = function(fac) {\n cryptoStoreFactory = fac;\n};\n\n/**\n * Construct a Matrix Client. Similar to {@link module:client~MatrixClient}\n * except that the 'request', 'store' and 'scheduler' dependencies are satisfied.\n * @param {(Object|string)} opts The configuration options for this client. If\n * this is a string, it is assumed to be the base URL. These configuration\n * options will be passed directly to {@link module:client~MatrixClient}.\n * @param {Object} opts.store If not set, defaults to\n * {@link module:store/memory.MatrixInMemoryStore}.\n * @param {Object} opts.scheduler If not set, defaults to\n * {@link module:scheduler~MatrixScheduler}.\n * @param {requestFunction} opts.request If not set, defaults to the function\n * supplied to {@link request} which defaults to the request module from NPM.\n *\n * @param {module:crypto.store.base~CryptoStore=} opts.cryptoStore\n * crypto store implementation. Calls the factory supplied to\n * {@link setCryptoStoreFactory} if unspecified; or if no factory has been\n * specified, uses a default implementation (indexeddb in the browser,\n * in-memory otherwise).\n *\n * @return {MatrixClient} A new matrix client.\n * @see {@link module:client~MatrixClient} for the full list of options for\n * <code>opts</code>.\n */\nmodule.exports.createClient = function(opts) {\n if (typeof opts === \"string\") {\n opts = {\n \"baseUrl\": opts,\n };\n }\n opts.request = opts.request || request;\n opts.store = opts.store || new module.exports.MatrixInMemoryStore({\n localStorage: global.localStorage,\n });\n opts.scheduler = opts.scheduler || new module.exports.MatrixScheduler();\n opts.cryptoStore = opts.cryptoStore || cryptoStoreFactory();\n return new module.exports.MatrixClient(opts);\n};\n\n/**\n * The request function interface for performing HTTP requests. This matches the\n * API for the {@link https://github.com/request/request#requestoptions-callback|\n * request NPM module}. The SDK will attempt to call this function in order to\n * perform an HTTP request.\n * @callback requestFunction\n * @param {Object} opts The options for this HTTP request.\n * @param {string} opts.uri The complete URI.\n * @param {string} opts.method The HTTP method.\n * @param {Object} opts.qs The query parameters to append to the URI.\n * @param {Object} opts.body The JSON-serializable object.\n * @param {boolean} opts.json True if this is a JSON request.\n * @param {Object} opts._matrix_opts The underlying options set for\n * {@link MatrixHttpApi}.\n * @param {requestCallback} callback The request callback.\n */\n\n/**\n * A wrapper for the request function interface.\n * @callback requestWrapperFunction\n * @param {requestFunction} origRequest The underlying request function being\n * wrapped\n * @param {Object} opts The options for this HTTP request, given in the same\n * form as {@link requestFunction}.\n * @param {requestCallback} callback The request callback.\n */\n\n /**\n * The request callback interface for performing HTTP requests. This matches the\n * API for the {@link https://github.com/request/request#requestoptions-callback|\n * request NPM module}. The SDK will implement a callback which meets this\n * interface in order to handle the HTTP response.\n * @callback requestCallback\n * @param {Error} err The error if one occurred, else falsey.\n * @param {Object} response The HTTP response which consists of\n * <code>{statusCode: {Number}, headers: {Object}}</code>\n * @param {Object} body The parsed HTTP response body.\n */\n"]}
\No newline at end of file