@mswjs/interceptors 0.20.0 → 0.21.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 +7 -7
- package/lib/browser/Interceptor-959f650e.d.ts +104 -0
- package/lib/browser/chunk-5B525MKF.mjs +2139 -0
- package/lib/browser/chunk-BQYA7ER5.mjs +258 -0
- package/lib/browser/chunk-IIY3SHU3.js +2139 -0
- package/lib/browser/chunk-QWL3EOEY.js +258 -0
- package/lib/browser/chunk-STA6QBYM.mjs +64 -0
- package/lib/browser/chunk-ZJOF5MEZ.js +64 -0
- package/lib/browser/index.d.ts +31 -0
- package/lib/browser/index.js +51 -0
- package/lib/browser/index.mjs +51 -0
- package/lib/browser/interceptors/XMLHttpRequest/index.d.ts +14 -0
- package/lib/browser/interceptors/XMLHttpRequest/index.js +657 -0
- package/lib/browser/interceptors/XMLHttpRequest/index.mjs +657 -0
- package/lib/browser/interceptors/fetch/index.d.ts +12 -0
- package/lib/browser/interceptors/fetch/index.js +94 -0
- package/lib/browser/interceptors/fetch/index.mjs +94 -0
- package/lib/node/BatchInterceptor-a7261b26.d.ts +21 -0
- package/lib/node/Interceptor-997045eb.d.ts +104 -0
- package/lib/{RemoteHttpInterceptor.d.ts → node/RemoteHttpInterceptor.d.ts} +17 -12
- package/lib/node/RemoteHttpInterceptor.js +176 -0
- package/lib/node/RemoteHttpInterceptor.mjs +176 -0
- package/lib/node/chunk-6GWWOJ23.js +29 -0
- package/lib/node/chunk-6V3JXLBF.js +6093 -0
- package/lib/node/chunk-CIN5URNI.mjs +29 -0
- package/lib/node/chunk-FCIAOT7W.mjs +660 -0
- package/lib/node/chunk-GFH37L5D.mjs +6 -0
- package/lib/node/chunk-HDUJCCWF.js +661 -0
- package/lib/node/chunk-JISWS3Y3.mjs +31 -0
- package/lib/node/chunk-KZJG2UW7.js +31 -0
- package/lib/node/chunk-NNVTJLQA.mjs +6093 -0
- package/lib/node/chunk-QMIXLBOU.js +291 -0
- package/lib/node/chunk-STA6QBYM.mjs +64 -0
- package/lib/node/chunk-VKKFXSTL.js +660 -0
- package/lib/node/chunk-VQ4DZOBB.js +6 -0
- package/lib/node/chunk-ZJOF5MEZ.js +64 -0
- package/lib/node/chunk-ZSI7MX3V.mjs +291 -0
- package/lib/node/chunk-ZWCZGO3W.mjs +661 -0
- package/lib/node/index.d.ts +14 -0
- package/lib/node/index.js +32 -0
- package/lib/node/index.mjs +32 -0
- package/lib/node/interceptors/ClientRequest/index.d.ts +22 -0
- package/lib/node/interceptors/ClientRequest/index.js +9 -0
- package/lib/node/interceptors/ClientRequest/index.mjs +9 -0
- package/lib/node/interceptors/XMLHttpRequest/index.d.ts +14 -0
- package/lib/node/interceptors/XMLHttpRequest/index.js +11 -0
- package/lib/node/interceptors/XMLHttpRequest/index.mjs +11 -0
- package/lib/node/interceptors/fetch/index.d.ts +12 -0
- package/lib/node/interceptors/fetch/index.js +96 -0
- package/lib/node/interceptors/fetch/index.mjs +96 -0
- package/package.json +58 -9
- package/src/interceptors/ClientRequest/utils/normalizeClientRequestArgs.ts +1 -1
- package/src/shims/webEncoding.ts +9 -0
- package/src/utils/bufferUtils.ts +1 -1
- package/lib/BatchInterceptor.d.ts +0 -18
- package/lib/BatchInterceptor.js +0 -34
- package/lib/BatchInterceptor.js.map +0 -1
- package/lib/Interceptor.d.ts +0 -50
- package/lib/Interceptor.js +0 -172
- package/lib/Interceptor.js.map +0 -1
- package/lib/RemoteHttpInterceptor.js +0 -158
- package/lib/RemoteHttpInterceptor.js.map +0 -1
- package/lib/glossary.d.ts +0 -7
- package/lib/glossary.js +0 -5
- package/lib/glossary.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -23
- package/lib/index.js.map +0 -1
- package/lib/interceptors/ClientRequest/NodeClientRequest.d.ts +0 -46
- package/lib/interceptors/ClientRequest/NodeClientRequest.js +0 -325
- package/lib/interceptors/ClientRequest/NodeClientRequest.js.map +0 -1
- package/lib/interceptors/ClientRequest/http.get.d.ts +0 -4
- package/lib/interceptors/ClientRequest/http.get.js +0 -19
- package/lib/interceptors/ClientRequest/http.get.js.map +0 -1
- package/lib/interceptors/ClientRequest/http.request.d.ts +0 -4
- package/lib/interceptors/ClientRequest/http.request.js +0 -16
- package/lib/interceptors/ClientRequest/http.request.js.map +0 -1
- package/lib/interceptors/ClientRequest/index.d.ts +0 -19
- package/lib/interceptors/ClientRequest/index.js +0 -50
- package/lib/interceptors/ClientRequest/index.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/cloneIncomingMessage.d.ts +0 -10
- package/lib/interceptors/ClientRequest/utils/cloneIncomingMessage.js +0 -60
- package/lib/interceptors/ClientRequest/utils/cloneIncomingMessage.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/createRequest.d.ts +0 -6
- package/lib/interceptors/ClientRequest/utils/createRequest.js +0 -30
- package/lib/interceptors/ClientRequest/utils/createRequest.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/createResponse.d.ts +0 -8
- package/lib/interceptors/ClientRequest/utils/createResponse.js +0 -24
- package/lib/interceptors/ClientRequest/utils/createResponse.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/getIncomingMessageBody.d.ts +0 -3
- package/lib/interceptors/ClientRequest/utils/getIncomingMessageBody.js +0 -57
- package/lib/interceptors/ClientRequest/utils/getIncomingMessageBody.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestArgs.d.ts +0 -17
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestArgs.js +0 -151
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestArgs.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestEndArgs.d.ts +0 -15
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestEndArgs.js +0 -33
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestEndArgs.js.map +0 -1
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestWriteArgs.d.ts +0 -13
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestWriteArgs.js +0 -20
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestWriteArgs.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestController.d.ts +0 -44
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestController.js +0 -413
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestController.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestProxy.d.ts +0 -20
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestProxy.js +0 -75
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestProxy.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/index.d.ts +0 -12
- package/lib/interceptors/XMLHttpRequest/index.js +0 -41
- package/lib/interceptors/XMLHttpRequest/index.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.d.ts +0 -31
- package/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.js +0 -44
- package/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.d.ts +0 -8
- package/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.js +0 -15
- package/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/utils/concatArrayBuffer.d.ts +0 -4
- package/lib/interceptors/XMLHttpRequest/utils/concatArrayBuffer.js +0 -14
- package/lib/interceptors/XMLHttpRequest/utils/concatArrayBuffer.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/utils/createEvent.d.ts +0 -2
- package/lib/interceptors/XMLHttpRequest/utils/createEvent.js +0 -37
- package/lib/interceptors/XMLHttpRequest/utils/createEvent.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/utils/createResponse.d.ts +0 -2
- package/lib/interceptors/XMLHttpRequest/utils/createResponse.js +0 -14
- package/lib/interceptors/XMLHttpRequest/utils/createResponse.js.map +0 -1
- package/lib/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.d.ts +0 -1
- package/lib/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.js +0 -17
- package/lib/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.js.map +0 -1
- package/lib/interceptors/fetch/index.d.ts +0 -8
- package/lib/interceptors/fetch/index.js +0 -81
- package/lib/interceptors/fetch/index.js.map +0 -1
- package/lib/presets/browser.d.ts +0 -8
- package/lib/presets/browser.js +0 -10
- package/lib/presets/browser.js.map +0 -1
- package/lib/presets/node.d.ts +0 -8
- package/lib/presets/node.js +0 -10
- package/lib/presets/node.js.map +0 -1
- package/lib/utils/AsyncEventEmitter.d.ts +0 -33
- package/lib/utils/AsyncEventEmitter.js +0 -148
- package/lib/utils/AsyncEventEmitter.js.map +0 -1
- package/lib/utils/bufferUtils.d.ts +0 -8
- package/lib/utils/bufferUtils.js +0 -24
- package/lib/utils/bufferUtils.js.map +0 -1
- package/lib/utils/cloneObject.d.ts +0 -1
- package/lib/utils/cloneObject.js +0 -28
- package/lib/utils/cloneObject.js.map +0 -1
- package/lib/utils/createLazyCallback.d.ts +0 -11
- package/lib/utils/createLazyCallback.js +0 -40
- package/lib/utils/createLazyCallback.js.map +0 -1
- package/lib/utils/createProxy.d.ts +0 -8
- package/lib/utils/createProxy.js +0 -45
- package/lib/utils/createProxy.js.map +0 -1
- package/lib/utils/getCleanUrl.d.ts +0 -4
- package/lib/utils/getCleanUrl.js +0 -11
- package/lib/utils/getCleanUrl.js.map +0 -1
- package/lib/utils/getRequestOptionsByUrl.d.ts +0 -8
- package/lib/utils/getRequestOptionsByUrl.js +0 -28
- package/lib/utils/getRequestOptionsByUrl.js.map +0 -1
- package/lib/utils/getUrlByRequestOptions.d.ts +0 -11
- package/lib/utils/getUrlByRequestOptions.js +0 -78
- package/lib/utils/getUrlByRequestOptions.js.map +0 -1
- package/lib/utils/isObject.d.ts +0 -4
- package/lib/utils/isObject.js +0 -11
- package/lib/utils/isObject.js.map +0 -1
- package/lib/utils/nextTick.d.ts +0 -2
- package/lib/utils/nextTick.js +0 -16
- package/lib/utils/nextTick.js.map +0 -1
- package/lib/utils/parseJson.d.ts +0 -5
- package/lib/utils/parseJson.js +0 -18
- package/lib/utils/parseJson.js.map +0 -1
- package/lib/utils/toInteractiveRequest.d.ts +0 -7
- package/lib/utils/toInteractiveRequest.js +0 -20
- package/lib/utils/toInteractiveRequest.js.map +0 -1
- package/lib/utils/uuid.d.ts +0 -1
- package/lib/utils/uuid.js +0 -12
- package/lib/utils/uuid.js.map +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventPolyfill = void 0;
|
|
4
|
-
class EventPolyfill {
|
|
5
|
-
constructor(type, options) {
|
|
6
|
-
this.AT_TARGET = 0;
|
|
7
|
-
this.BUBBLING_PHASE = 0;
|
|
8
|
-
this.CAPTURING_PHASE = 0;
|
|
9
|
-
this.NONE = 0;
|
|
10
|
-
this.type = '';
|
|
11
|
-
this.srcElement = null;
|
|
12
|
-
this.currentTarget = null;
|
|
13
|
-
this.eventPhase = 0;
|
|
14
|
-
this.isTrusted = true;
|
|
15
|
-
this.composed = false;
|
|
16
|
-
this.cancelable = true;
|
|
17
|
-
this.defaultPrevented = false;
|
|
18
|
-
this.bubbles = true;
|
|
19
|
-
this.lengthComputable = true;
|
|
20
|
-
this.loaded = 0;
|
|
21
|
-
this.total = 0;
|
|
22
|
-
this.cancelBubble = false;
|
|
23
|
-
this.returnValue = true;
|
|
24
|
-
this.type = type;
|
|
25
|
-
this.target = (options === null || options === void 0 ? void 0 : options.target) || null;
|
|
26
|
-
this.currentTarget = (options === null || options === void 0 ? void 0 : options.currentTarget) || null;
|
|
27
|
-
this.timeStamp = Date.now();
|
|
28
|
-
}
|
|
29
|
-
composedPath() {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
initEvent(type, bubbles, cancelable) {
|
|
33
|
-
this.type = type;
|
|
34
|
-
this.bubbles = !!bubbles;
|
|
35
|
-
this.cancelable = !!cancelable;
|
|
36
|
-
}
|
|
37
|
-
preventDefault() {
|
|
38
|
-
this.defaultPrevented = true;
|
|
39
|
-
}
|
|
40
|
-
stopPropagation() { }
|
|
41
|
-
stopImmediatePropagation() { }
|
|
42
|
-
}
|
|
43
|
-
exports.EventPolyfill = EventPolyfill;
|
|
44
|
-
//# sourceMappingURL=EventPolyfill.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventPolyfill.js","sourceRoot":"","sources":["../../../../src/interceptors/XMLHttpRequest/polyfills/EventPolyfill.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IAwBxB,YACE,IAAY,EACZ,OAA6D;QAzBtD,cAAS,GAAW,CAAC,CAAA;QACrB,mBAAc,GAAW,CAAC,CAAA;QAC1B,oBAAe,GAAW,CAAC,CAAA;QAC3B,SAAI,GAAW,CAAC,CAAA;QAElB,SAAI,GAAW,EAAE,CAAA;QACjB,eAAU,GAAuB,IAAI,CAAA;QAErC,kBAAa,GAAuB,IAAI,CAAA;QACxC,eAAU,GAAW,CAAC,CAAA;QAEtB,cAAS,GAAY,IAAI,CAAA;QACzB,aAAQ,GAAY,KAAK,CAAA;QACzB,eAAU,GAAY,IAAI,CAAA;QAC1B,qBAAgB,GAAY,KAAK,CAAA;QACjC,YAAO,GAAY,IAAI,CAAA;QACvB,qBAAgB,GAAY,IAAI,CAAA;QAChC,WAAM,GAAW,CAAC,CAAA;QAClB,UAAK,GAAW,CAAC,CAAA;QAExB,iBAAY,GAAY,KAAK,CAAA;QAC7B,gBAAW,GAAY,IAAI,CAAA;QAMzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,IAAI,CAAA;QACrC,IAAI,CAAC,aAAa,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,KAAI,IAAI,CAAA;QACnD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAC7B,CAAC;IAEM,YAAY;QACjB,OAAO,EAAE,CAAA;IACX,CAAC;IAEM,SAAS,CAAC,IAAY,EAAE,OAAiB,EAAE,UAAoB;QACpE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAA;IAChC,CAAC;IAEM,cAAc;QACnB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAA;IAC9B,CAAC;IAEM,eAAe,KAAI,CAAC;IACpB,wBAAwB,KAAI,CAAC;CACrC;AAlDD,sCAkDC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { EventPolyfill } from './EventPolyfill';
|
|
2
|
-
export declare class ProgressEventPolyfill extends EventPolyfill {
|
|
3
|
-
readonly lengthComputable: boolean;
|
|
4
|
-
readonly composed: boolean;
|
|
5
|
-
readonly loaded: number;
|
|
6
|
-
readonly total: number;
|
|
7
|
-
constructor(type: string, init?: ProgressEventInit);
|
|
8
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProgressEventPolyfill = void 0;
|
|
4
|
-
const EventPolyfill_1 = require("./EventPolyfill");
|
|
5
|
-
class ProgressEventPolyfill extends EventPolyfill_1.EventPolyfill {
|
|
6
|
-
constructor(type, init) {
|
|
7
|
-
super(type);
|
|
8
|
-
this.lengthComputable = (init === null || init === void 0 ? void 0 : init.lengthComputable) || false;
|
|
9
|
-
this.composed = (init === null || init === void 0 ? void 0 : init.composed) || false;
|
|
10
|
-
this.loaded = (init === null || init === void 0 ? void 0 : init.loaded) || 0;
|
|
11
|
-
this.total = (init === null || init === void 0 ? void 0 : init.total) || 0;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ProgressEventPolyfill = ProgressEventPolyfill;
|
|
15
|
-
//# sourceMappingURL=ProgressEventPolyfill.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressEventPolyfill.js","sourceRoot":"","sources":["../../../../src/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAE/C,MAAa,qBAAsB,SAAQ,6BAAa;IAMtD,YAAY,IAAY,EAAE,IAAwB;QAChD,KAAK,CAAC,IAAI,CAAC,CAAA;QAEX,IAAI,CAAC,gBAAgB,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,KAAI,KAAK,CAAA;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,KAAI,KAAK,CAAA;QACvC,IAAI,CAAC,MAAM,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,KAAI,CAAC,CAAA;QAC/B,IAAI,CAAC,KAAK,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,CAAC,CAAA;IAC/B,CAAC;CACF;AAdD,sDAcC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.concatArrayBuffer = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Concatenate two `Uint8Array` buffers.
|
|
6
|
-
*/
|
|
7
|
-
function concatArrayBuffer(left, right) {
|
|
8
|
-
const result = new Uint8Array(left.byteLength + right.byteLength);
|
|
9
|
-
result.set(left, 0);
|
|
10
|
-
result.set(right, left.byteLength);
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
exports.concatArrayBuffer = concatArrayBuffer;
|
|
14
|
-
//# sourceMappingURL=concatArrayBuffer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concatArrayBuffer.js","sourceRoot":"","sources":["../../../../src/interceptors/XMLHttpRequest/utils/concatArrayBuffer.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,IAAgB,EAChB,KAAiB;IAEjB,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAA;IACjE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACnB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IAClC,OAAO,MAAM,CAAA;AACf,CAAC;AARD,8CAQC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEvent = void 0;
|
|
4
|
-
const EventPolyfill_1 = require("../polyfills/EventPolyfill");
|
|
5
|
-
const ProgressEventPolyfill_1 = require("../polyfills/ProgressEventPolyfill");
|
|
6
|
-
const SUPPORTS_PROGRESS_EVENT = typeof ProgressEvent !== 'undefined';
|
|
7
|
-
function createEvent(target, type, init) {
|
|
8
|
-
const progressEvents = [
|
|
9
|
-
'error',
|
|
10
|
-
'progress',
|
|
11
|
-
'loadstart',
|
|
12
|
-
'loadend',
|
|
13
|
-
'load',
|
|
14
|
-
'timeout',
|
|
15
|
-
'abort',
|
|
16
|
-
];
|
|
17
|
-
/**
|
|
18
|
-
* `ProgressEvent` is not supported in React Native.
|
|
19
|
-
* @see https://github.com/mswjs/interceptors/issues/40
|
|
20
|
-
*/
|
|
21
|
-
const ProgressEventClass = SUPPORTS_PROGRESS_EVENT
|
|
22
|
-
? ProgressEvent
|
|
23
|
-
: ProgressEventPolyfill_1.ProgressEventPolyfill;
|
|
24
|
-
const event = progressEvents.includes(type)
|
|
25
|
-
? new ProgressEventClass(type, {
|
|
26
|
-
lengthComputable: true,
|
|
27
|
-
loaded: (init === null || init === void 0 ? void 0 : init.loaded) || 0,
|
|
28
|
-
total: (init === null || init === void 0 ? void 0 : init.total) || 0,
|
|
29
|
-
})
|
|
30
|
-
: new EventPolyfill_1.EventPolyfill(type, {
|
|
31
|
-
target,
|
|
32
|
-
currentTarget: target,
|
|
33
|
-
});
|
|
34
|
-
return event;
|
|
35
|
-
}
|
|
36
|
-
exports.createEvent = createEvent;
|
|
37
|
-
//# sourceMappingURL=createEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createEvent.js","sourceRoot":"","sources":["../../../../src/interceptors/XMLHttpRequest/utils/createEvent.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAC1D,8EAA0E;AAE1E,MAAM,uBAAuB,GAAG,OAAO,aAAa,KAAK,WAAW,CAAA;AAEpE,SAAgB,WAAW,CACzB,MAAsB,EACtB,IAAY,EACZ,IAAwB;IAExB,MAAM,cAAc,GAAG;QACrB,OAAO;QACP,UAAU;QACV,WAAW;QACX,SAAS;QACT,MAAM;QACN,SAAS;QACT,OAAO;KACR,CAAA;IAED;;;OAGG;IACH,MAAM,kBAAkB,GAAG,uBAAuB;QAChD,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,6CAAqB,CAAA;IAEzB,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzC,CAAC,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE;YAC3B,gBAAgB,EAAE,IAAI;YACtB,MAAM,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,KAAI,CAAC;YACzB,KAAK,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,CAAC;SACxB,CAAC;QACJ,CAAC,CAAC,IAAI,6BAAa,CAAC,IAAI,EAAE;YACtB,MAAM;YACN,aAAa,EAAE,MAAM;SACtB,CAAC,CAAA;IAEN,OAAO,KAAK,CAAA;AACd,CAAC;AAnCD,kCAmCC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createResponse = void 0;
|
|
4
|
-
const web_fetch_1 = require("@remix-run/web-fetch");
|
|
5
|
-
const headers_polyfill_1 = require("headers-polyfill");
|
|
6
|
-
function createResponse(request, responseBody) {
|
|
7
|
-
return new web_fetch_1.Response(responseBody, {
|
|
8
|
-
status: request.status,
|
|
9
|
-
statusText: request.statusText,
|
|
10
|
-
headers: (0, headers_polyfill_1.stringToHeaders)(request.getAllResponseHeaders()),
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
exports.createResponse = createResponse;
|
|
14
|
-
//# sourceMappingURL=createResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createResponse.js","sourceRoot":"","sources":["../../../../src/interceptors/XMLHttpRequest/utils/createResponse.ts"],"names":[],"mappings":";;;AAAA,oDAA+C;AAC/C,uDAAkD;AAElD,SAAgB,cAAc,CAC5B,OAAuB,EACvB,YAAwB;IAExB,OAAO,IAAI,oBAAQ,CAAC,YAAY,EAAE;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,OAAO,EAAE,IAAA,kCAAe,EAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;KAC1D,CAAC,CAAA;AACJ,CAAC;AATD,wCASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isDomParserSupportedType(type: string): type is DOMParserSupportedType;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDomParserSupportedType = void 0;
|
|
4
|
-
function isDomParserSupportedType(type) {
|
|
5
|
-
const supportedTypes = [
|
|
6
|
-
'application/xhtml+xml',
|
|
7
|
-
'application/xml',
|
|
8
|
-
'image/svg+xml',
|
|
9
|
-
'text/html',
|
|
10
|
-
'text/xml',
|
|
11
|
-
];
|
|
12
|
-
return supportedTypes.some((supportedType) => {
|
|
13
|
-
return type.startsWith(supportedType);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
exports.isDomParserSupportedType = isDomParserSupportedType;
|
|
17
|
-
//# sourceMappingURL=isDomParserSupportedType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isDomParserSupportedType.js","sourceRoot":"","sources":["../../../../src/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.ts"],"names":[],"mappings":";;;AAAA,SAAgB,wBAAwB,CACtC,IAAY;IAEZ,MAAM,cAAc,GAAkC;QACpD,uBAAuB;QACvB,iBAAiB;QACjB,eAAe;QACf,WAAW;QACX,UAAU;KACX,CAAA;IACD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE;QAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC;AAbD,4DAaC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HttpRequestEventMap } from '../../glossary';
|
|
2
|
-
import { Interceptor } from '../../Interceptor';
|
|
3
|
-
export declare class FetchInterceptor extends Interceptor<HttpRequestEventMap> {
|
|
4
|
-
static symbol: symbol;
|
|
5
|
-
constructor();
|
|
6
|
-
protected checkEnvironment(): boolean;
|
|
7
|
-
protected setup(): void;
|
|
8
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.FetchInterceptor = void 0;
|
|
13
|
-
const outvariant_1 = require("outvariant");
|
|
14
|
-
const glossary_1 = require("../../glossary");
|
|
15
|
-
const Interceptor_1 = require("../../Interceptor");
|
|
16
|
-
const uuid_1 = require("../../utils/uuid");
|
|
17
|
-
const toInteractiveRequest_1 = require("../../utils/toInteractiveRequest");
|
|
18
|
-
class FetchInterceptor extends Interceptor_1.Interceptor {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(FetchInterceptor.symbol);
|
|
21
|
-
}
|
|
22
|
-
checkEnvironment() {
|
|
23
|
-
return (typeof globalThis !== 'undefined' &&
|
|
24
|
-
typeof globalThis.fetch !== 'undefined');
|
|
25
|
-
}
|
|
26
|
-
setup() {
|
|
27
|
-
const pureFetch = globalThis.fetch;
|
|
28
|
-
(0, outvariant_1.invariant)(!pureFetch[glossary_1.IS_PATCHED_MODULE], 'Failed to patch the "fetch" module: already patched.');
|
|
29
|
-
globalThis.fetch = (input, init) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const requestId = (0, uuid_1.uuidv4)();
|
|
31
|
-
const request = new Request(input, init);
|
|
32
|
-
this.log('[%s] %s', request.method, request.url);
|
|
33
|
-
const interactiveRequest = (0, toInteractiveRequest_1.toInteractiveRequest)(request);
|
|
34
|
-
this.log('emitting the "request" event for %d listener(s)...', this.emitter.listenerCount('request'));
|
|
35
|
-
this.emitter.emit('request', interactiveRequest, requestId);
|
|
36
|
-
this.log('awaiting for the mocked response...');
|
|
37
|
-
yield this.emitter.untilIdle('request', ({ args: [, pendingRequestId] }) => {
|
|
38
|
-
return pendingRequestId === requestId;
|
|
39
|
-
});
|
|
40
|
-
this.log('all request listeners have been resolved!');
|
|
41
|
-
const [mockedResponse] = yield interactiveRequest.respondWith.invoked();
|
|
42
|
-
this.log('event.respondWith called with:', mockedResponse);
|
|
43
|
-
if (mockedResponse) {
|
|
44
|
-
this.log('received mocked response:', mockedResponse);
|
|
45
|
-
const responseCloine = mockedResponse.clone();
|
|
46
|
-
this.emitter.emit('response', responseCloine, interactiveRequest, requestId);
|
|
47
|
-
const response = new Response(mockedResponse.body, mockedResponse);
|
|
48
|
-
// Set the "response.url" property to equal the intercepted request URL.
|
|
49
|
-
Object.defineProperty(response, 'url', {
|
|
50
|
-
writable: false,
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: false,
|
|
53
|
-
value: request.url,
|
|
54
|
-
});
|
|
55
|
-
return response;
|
|
56
|
-
}
|
|
57
|
-
this.log('no mocked response received!');
|
|
58
|
-
return pureFetch(request).then((response) => {
|
|
59
|
-
const responseClone = response.clone();
|
|
60
|
-
this.log('original fetch performed', responseClone);
|
|
61
|
-
this.emitter.emit('response', responseClone, interactiveRequest, requestId);
|
|
62
|
-
return response;
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(globalThis.fetch, glossary_1.IS_PATCHED_MODULE, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
configurable: true,
|
|
68
|
-
value: true,
|
|
69
|
-
});
|
|
70
|
-
this.subscriptions.push(() => {
|
|
71
|
-
Object.defineProperty(globalThis.fetch, glossary_1.IS_PATCHED_MODULE, {
|
|
72
|
-
value: undefined,
|
|
73
|
-
});
|
|
74
|
-
globalThis.fetch = pureFetch;
|
|
75
|
-
this.log('restored native "globalThis.fetch"!', globalThis.fetch.name);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.FetchInterceptor = FetchInterceptor;
|
|
80
|
-
FetchInterceptor.symbol = Symbol('fetch');
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interceptors/fetch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsC;AAEtC,6CAAuE;AACvE,mDAA+C;AAC/C,2CAAyC;AACzC,2EAAuE;AAEvE,MAAa,gBAAiB,SAAQ,yBAAgC;IAGpE;QACE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IAES,gBAAgB;QACxB,OAAO,CACL,OAAO,UAAU,KAAK,WAAW;YACjC,OAAO,UAAU,CAAC,KAAK,KAAK,WAAW,CACxC,CAAA;IACH,CAAC;IAES,KAAK;QACb,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAA;QAElC,IAAA,sBAAS,EACP,CAAE,SAAiB,CAAC,4BAAiB,CAAC,EACtC,sDAAsD,CACvD,CAAA;QAED,UAAU,CAAC,KAAK,GAAG,CAAO,KAAK,EAAE,IAAI,EAAE,EAAE;YACvC,MAAM,SAAS,GAAG,IAAA,aAAM,GAAE,CAAA;YAC1B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YAExC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;YAEhD,MAAM,kBAAkB,GAAG,IAAA,2CAAoB,EAAC,OAAO,CAAC,CAAA;YAExD,IAAI,CAAC,GAAG,CACN,oDAAoD,EACpD,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CACtC,CAAA;YACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAA;YAE3D,IAAI,CAAC,GAAG,CA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gBAEnD,IAAI,CAAC,OAAO,CAAC,IAAI,CACf,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,SAAS,CACV,CAAA;gBAED,OAAO,QAAQ,CAAA;YACjB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA,CAAA;QAED,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,EAAE,4BAAiB,EAAE;YACzD,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAA;QAEF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE;YAC3B,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,EAAE,4BAAiB,EAAE;gBACzD,KAAK,EAAE,SAAS;aACjB,CAAC,CAAA;YAEF,UAAU,CAAC,KAAK,GAAG,SAAS,CAAA;YAE5B,IAAI,CAAC,GAAG,CAAC,qCAAqC,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACxE,CAAC,CAAC,CAAA;IACJ,CAAC;;AAzGH,4CA0GC;AAzGQ,uBAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA"}
|
package/lib/presets/browser.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FetchInterceptor } from '../interceptors/fetch';
|
|
2
|
-
import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest';
|
|
3
|
-
declare const _default: (XMLHttpRequestInterceptor | FetchInterceptor)[];
|
|
4
|
-
/**
|
|
5
|
-
* The default preset provisions the interception of requests
|
|
6
|
-
* regardless of their type (fetch/XMLHttpRequest).
|
|
7
|
-
*/
|
|
8
|
-
export default _default;
|
package/lib/presets/browser.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fetch_1 = require("../interceptors/fetch");
|
|
4
|
-
const XMLHttpRequest_1 = require("../interceptors/XMLHttpRequest");
|
|
5
|
-
/**
|
|
6
|
-
* The default preset provisions the interception of requests
|
|
7
|
-
* regardless of their type (fetch/XMLHttpRequest).
|
|
8
|
-
*/
|
|
9
|
-
exports.default = [new fetch_1.FetchInterceptor(), new XMLHttpRequest_1.XMLHttpRequestInterceptor()];
|
|
10
|
-
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/presets/browser.ts"],"names":[],"mappings":";;AAAA,iDAAwD;AACxD,mEAA0E;AAE1E;;;GAGG;AACH,kBAAe,CAAC,IAAI,wBAAgB,EAAE,EAAE,IAAI,0CAAyB,EAAE,CAAC,CAAA"}
|
package/lib/presets/node.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ClientRequestInterceptor } from '../interceptors/ClientRequest';
|
|
2
|
-
import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest';
|
|
3
|
-
declare const _default: (ClientRequestInterceptor | XMLHttpRequestInterceptor)[];
|
|
4
|
-
/**
|
|
5
|
-
* The default preset provisions the interception of requests
|
|
6
|
-
* regardless of their type (http/https/XMLHttpRequest).
|
|
7
|
-
*/
|
|
8
|
-
export default _default;
|
package/lib/presets/node.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ClientRequest_1 = require("../interceptors/ClientRequest");
|
|
4
|
-
const XMLHttpRequest_1 = require("../interceptors/XMLHttpRequest");
|
|
5
|
-
/**
|
|
6
|
-
* The default preset provisions the interception of requests
|
|
7
|
-
* regardless of their type (http/https/XMLHttpRequest).
|
|
8
|
-
*/
|
|
9
|
-
exports.default = [new ClientRequest_1.ClientRequestInterceptor(), new XMLHttpRequest_1.XMLHttpRequestInterceptor()];
|
|
10
|
-
//# sourceMappingURL=node.js.map
|
package/lib/presets/node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/presets/node.ts"],"names":[],"mappings":";;AAAA,iEAAwE;AACxE,mEAA0E;AAE1E;;;GAGG;AACH,kBAAe,CAAC,IAAI,wCAAwB,EAAE,EAAE,IAAI,0CAAyB,EAAE,CAAC,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Emitter, EventMap, Listener } from 'strict-event-emitter';
|
|
2
|
-
export interface QueueItem<Args extends Array<unknown>> {
|
|
3
|
-
args: Args;
|
|
4
|
-
done: Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare enum AsyncEventEmitterReadyState {
|
|
7
|
-
ACTIVE = "ACTIVE",
|
|
8
|
-
DEACTIVATED = "DEACTIVATED"
|
|
9
|
-
}
|
|
10
|
-
export declare class AsyncEventEmitter<Events extends EventMap> extends Emitter<Events> {
|
|
11
|
-
readyState: AsyncEventEmitterReadyState;
|
|
12
|
-
private log;
|
|
13
|
-
protected queue: Map<keyof Events, Array<QueueItem<Events[any]>>>;
|
|
14
|
-
constructor();
|
|
15
|
-
on<EventName extends keyof Events>(eventName: EventName, listener: Listener<any>): this;
|
|
16
|
-
emit<EventName extends keyof Events>(eventName: EventName, ...data: Events[EventName]): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Returns a promise that resolves when all the listeners for the given event
|
|
19
|
-
* has been called. Awaits asynchronous listeners.
|
|
20
|
-
* If the event has no listeners, resolves immediately.
|
|
21
|
-
*/
|
|
22
|
-
untilIdle<EventName extends keyof Events>(eventName: EventName, filter?: (item: QueueItem<Events[EventName]>) => boolean): Promise<void>;
|
|
23
|
-
private openListenerQueue;
|
|
24
|
-
removeAllListeners<EventName extends keyof Events>(eventName?: EventName): this;
|
|
25
|
-
activate(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Deactivate this event emitter.
|
|
28
|
-
* Deactivated emitter can no longer emit and listen to events
|
|
29
|
-
* and needs to be activated again in order to do so.
|
|
30
|
-
*/
|
|
31
|
-
deactivate(): void;
|
|
32
|
-
private isInternalEventName;
|
|
33
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AsyncEventEmitter = exports.AsyncEventEmitterReadyState = void 0;
|
|
13
|
-
const debug_1 = require("debug");
|
|
14
|
-
const strict_event_emitter_1 = require("strict-event-emitter");
|
|
15
|
-
const nextTick_1 = require("./nextTick");
|
|
16
|
-
var AsyncEventEmitterReadyState;
|
|
17
|
-
(function (AsyncEventEmitterReadyState) {
|
|
18
|
-
AsyncEventEmitterReadyState["ACTIVE"] = "ACTIVE";
|
|
19
|
-
AsyncEventEmitterReadyState["DEACTIVATED"] = "DEACTIVATED";
|
|
20
|
-
})(AsyncEventEmitterReadyState = exports.AsyncEventEmitterReadyState || (exports.AsyncEventEmitterReadyState = {}));
|
|
21
|
-
class AsyncEventEmitter extends strict_event_emitter_1.Emitter {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this.log = (0, debug_1.debug)('async-event-emitter');
|
|
25
|
-
this.queue = new Map();
|
|
26
|
-
this.readyState = AsyncEventEmitterReadyState.ACTIVE;
|
|
27
|
-
}
|
|
28
|
-
on(eventName, listener) {
|
|
29
|
-
const log = this.log.extend('on');
|
|
30
|
-
log('adding "%s" listener...', eventName);
|
|
31
|
-
if (this.readyState === AsyncEventEmitterReadyState.DEACTIVATED) {
|
|
32
|
-
log('the emitter is destroyed, skipping!');
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
return super.on(eventName, (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
// Event queue is always established when calling ".emit()".
|
|
37
|
-
const queue = this.openListenerQueue(eventName);
|
|
38
|
-
log('awaiting the "%s" listener...', eventName);
|
|
39
|
-
// Whenever a listener is called, create a new Promise
|
|
40
|
-
// that resolves when that listener function completes its execution.
|
|
41
|
-
queue.push({
|
|
42
|
-
args,
|
|
43
|
-
done: new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
try {
|
|
45
|
-
// Treat listeners as potentially asynchronous functions
|
|
46
|
-
// so they could be awaited.
|
|
47
|
-
yield listener(...args);
|
|
48
|
-
resolve();
|
|
49
|
-
log('"%s" listener has resolved!', eventName);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
log('"%s" listener has rejected!', error);
|
|
53
|
-
reject(error);
|
|
54
|
-
}
|
|
55
|
-
})),
|
|
56
|
-
});
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
emit(eventName, ...data) {
|
|
60
|
-
const log = this.log.extend('emit');
|
|
61
|
-
log('emitting "%s" event...', eventName);
|
|
62
|
-
if (this.readyState === AsyncEventEmitterReadyState.DEACTIVATED) {
|
|
63
|
-
log('the emitter is destroyed, skipping!');
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
// Skip establishing event queues for internal listeners.
|
|
67
|
-
// Those are not meant to be awaited.
|
|
68
|
-
if (this.isInternalEventName(eventName)) {
|
|
69
|
-
return super.emit(eventName, ...data);
|
|
70
|
-
}
|
|
71
|
-
// Establish the Promise queue for this particular event.
|
|
72
|
-
this.openListenerQueue(eventName);
|
|
73
|
-
log('appending a one-time cleanup "%s" listener...', eventName);
|
|
74
|
-
// Append a one-time clean up listener.
|
|
75
|
-
this.once(eventName, () => {
|
|
76
|
-
// Clear the Promise queue for this particular event
|
|
77
|
-
// in the next tick so the Promise in "untilIdle" has
|
|
78
|
-
// the time to properly resolve.
|
|
79
|
-
(0, nextTick_1.nextTick)(() => {
|
|
80
|
-
this.queue.delete(eventName);
|
|
81
|
-
log('cleaned up "%s" listeners queue!', eventName);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
return super.emit(eventName, ...data);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Returns a promise that resolves when all the listeners for the given event
|
|
88
|
-
* has been called. Awaits asynchronous listeners.
|
|
89
|
-
* If the event has no listeners, resolves immediately.
|
|
90
|
-
*/
|
|
91
|
-
untilIdle(eventName, filter = () => true) {
|
|
92
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const listenersQueue = this.queue.get(eventName) || [];
|
|
94
|
-
yield Promise.all(listenersQueue.filter(filter).map(({ done }) => done)).finally(() => {
|
|
95
|
-
// Clear the queue one the promise settles
|
|
96
|
-
// so that different events don't share the same queue.
|
|
97
|
-
this.queue.delete(eventName);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
openListenerQueue(eventName) {
|
|
102
|
-
const log = this.log.extend('openListenerQueue');
|
|
103
|
-
log('opening "%s" listeners queue...', eventName);
|
|
104
|
-
const queue = this.queue.get(eventName);
|
|
105
|
-
if (!queue) {
|
|
106
|
-
log('no queue found, creating one...');
|
|
107
|
-
this.queue.set(eventName, []);
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
log('returning an exising queue:', queue);
|
|
111
|
-
return queue;
|
|
112
|
-
}
|
|
113
|
-
removeAllListeners(eventName) {
|
|
114
|
-
const log = this.log.extend('removeAllListeners');
|
|
115
|
-
log('event:', eventName);
|
|
116
|
-
if (eventName) {
|
|
117
|
-
this.queue.delete(eventName);
|
|
118
|
-
log('cleared the "%s" listeners queue!', eventName, this.queue.get(eventName));
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
this.queue.clear();
|
|
122
|
-
log('cleared the listeners queue!', this.queue);
|
|
123
|
-
}
|
|
124
|
-
return super.removeAllListeners(eventName);
|
|
125
|
-
}
|
|
126
|
-
activate() {
|
|
127
|
-
const log = this.log.extend('activate');
|
|
128
|
-
this.readyState = AsyncEventEmitterReadyState.ACTIVE;
|
|
129
|
-
log('set state to:', this.readyState);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Deactivate this event emitter.
|
|
133
|
-
* Deactivated emitter can no longer emit and listen to events
|
|
134
|
-
* and needs to be activated again in order to do so.
|
|
135
|
-
*/
|
|
136
|
-
deactivate() {
|
|
137
|
-
const log = this.log.extend('deactivate');
|
|
138
|
-
log('removing all listeners...');
|
|
139
|
-
this.removeAllListeners();
|
|
140
|
-
this.readyState = AsyncEventEmitterReadyState.DEACTIVATED;
|
|
141
|
-
log('set state to:', this.readyState);
|
|
142
|
-
}
|
|
143
|
-
isInternalEventName(eventName) {
|
|
144
|
-
return eventName === 'newListener' || eventName === 'removeListener';
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.AsyncEventEmitter = AsyncEventEmitter;
|
|
148
|
-
//# sourceMappingURL=AsyncEventEmitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncEventEmitter.js","sourceRoot":"","sources":["../../src/utils/AsyncEventEmitter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAuC;AACvC,+DAAkE;AAClE,yCAAqC;AAOrC,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,gDAAiB,CAAA;IACjB,0DAA2B,CAAA;AAC7B,CAAC,EAHW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAGtC;AAED,MAAa,iBAEX,SAAQ,8BAAe;IAMvB;QACE,KAAK,EAAE,CAAA;QAEP,IAA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C,SAAS,CAAC,CAAA;IAC5C,CAAC;IAEM,QAAQ;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACvC,IAAI,CAAC,UAAU,GAAG,2BAA2B,CAAC,MAAM,CAAA;QACpD,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IACvC,CAAC;IAED;;;;OAIG;IACI,UAAU;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAEzC,GAAG,CAAC,2BAA2B,CAAC,CAAA;QAChC,IAAI,CAAC,kBAAkB,EAAE,CAAA;QAEzB,IAAI,CAAC,UAAU,GAAG,2BAA2B,CAAC,WAAW,CAAA;QACzD,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IACvC,CAAC;IAEO,mBAAmB,CAAC,SAAmC;QAC7D,OAAO,SAAS,KAAK,aAAa,IAAI,SAAS,KAAK,gBAAgB,CAAA;IACtE,CAAC;CACF;AAlLD,8CAkLC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function encodeBuffer(text: string): Uint8Array;
|
|
2
|
-
export declare function decodeBuffer(buffer: ArrayBuffer, encoding?: string): string;
|
|
3
|
-
/**
|
|
4
|
-
* Create an `ArrayBuffer` from the given `Uint8Array`.
|
|
5
|
-
* Takes the byte offset into account to produce the right buffer
|
|
6
|
-
* in the case when the buffer is bigger than the data view.
|
|
7
|
-
*/
|
|
8
|
-
export declare function toArrayBuffer(array: Uint8Array): ArrayBuffer;
|
package/lib/utils/bufferUtils.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toArrayBuffer = exports.decodeBuffer = exports.encodeBuffer = void 0;
|
|
4
|
-
const web_encoding_1 = require("web-encoding");
|
|
5
|
-
const encoder = new web_encoding_1.TextEncoder();
|
|
6
|
-
function encodeBuffer(text) {
|
|
7
|
-
return encoder.encode(text);
|
|
8
|
-
}
|
|
9
|
-
exports.encodeBuffer = encodeBuffer;
|
|
10
|
-
function decodeBuffer(buffer, encoding) {
|
|
11
|
-
const decoder = new web_encoding_1.TextDecoder(encoding);
|
|
12
|
-
return decoder.decode(buffer);
|
|
13
|
-
}
|
|
14
|
-
exports.decodeBuffer = decodeBuffer;
|
|
15
|
-
/**
|
|
16
|
-
* Create an `ArrayBuffer` from the given `Uint8Array`.
|
|
17
|
-
* Takes the byte offset into account to produce the right buffer
|
|
18
|
-
* in the case when the buffer is bigger than the data view.
|
|
19
|
-
*/
|
|
20
|
-
function toArrayBuffer(array) {
|
|
21
|
-
return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);
|
|
22
|
-
}
|
|
23
|
-
exports.toArrayBuffer = toArrayBuffer;
|
|
24
|
-
//# sourceMappingURL=bufferUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bufferUtils.js","sourceRoot":"","sources":["../../src/utils/bufferUtils.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAEvD,MAAM,OAAO,GAAG,IAAI,0BAAW,EAAE,CAAA;AAEjC,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAC;AAFD,oCAEC;AAED,SAAgB,YAAY,CAAC,MAAmB,EAAE,QAAiB;IACjE,MAAM,OAAO,GAAG,IAAI,0BAAW,CAAC,QAAQ,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC/B,CAAC;AAHD,oCAGC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAAiB;IAC7C,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CACvB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CACpC,CAAA;AACH,CAAC;AALD,sCAKC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cloneObject<ObjectType extends Record<string, any>>(obj: ObjectType): ObjectType;
|
package/lib/utils/cloneObject.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cloneObject = void 0;
|
|
4
|
-
const debug = require('debug')('cloneObject');
|
|
5
|
-
function isPlainObject(obj) {
|
|
6
|
-
var _a;
|
|
7
|
-
debug('is plain object?', obj);
|
|
8
|
-
if (obj == null || !((_a = obj.constructor) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
9
|
-
debug('given object is undefined, not a plain object...');
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
debug('checking the object constructor:', obj.constructor.name);
|
|
13
|
-
return obj.constructor.name === 'Object';
|
|
14
|
-
}
|
|
15
|
-
function cloneObject(obj) {
|
|
16
|
-
debug('cloning object:', obj);
|
|
17
|
-
const enumerableProperties = Object.entries(obj).reduce((acc, [key, value]) => {
|
|
18
|
-
debug('analyzing key-value pair:', key, value);
|
|
19
|
-
// Recursively clone only plain objects, omitting class instances.
|
|
20
|
-
acc[key] = isPlainObject(value) ? cloneObject(value) : value;
|
|
21
|
-
return acc;
|
|
22
|
-
}, {});
|
|
23
|
-
return isPlainObject(obj)
|
|
24
|
-
? enumerableProperties
|
|
25
|
-
: Object.assign(Object.getPrototypeOf(obj), enumerableProperties);
|
|
26
|
-
}
|
|
27
|
-
exports.cloneObject = cloneObject;
|
|
28
|
-
//# sourceMappingURL=cloneObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloneObject.js","sourceRoot":"","sources":["../../src/utils/cloneObject.ts"],"names":[],"mappings":";;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;AAE7C,SAAS,aAAa,CAAC,GAAyB;;IAC9C,KAAK,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAA;IAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,CAAA,MAAA,GAAG,CAAC,WAAW,0CAAE,IAAI,CAAA,EAAE;QACzC,KAAK,CAAC,kDAAkD,CAAC,CAAA;QACzD,OAAO,KAAK,CAAA;KACb;IAED,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAC/D,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAA;AAC1C,CAAC;AAED,SAAgB,WAAW,CACzB,GAAe;IAEf,KAAK,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IAE7B,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CACrD,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACpB,KAAK,CAAC,2BAA2B,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;QAE9C,kEAAkE;QAClE,GAAG,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAC5D,OAAO,GAAG,CAAA;IACZ,CAAC,EACD,EAAE,CACH,CAAA;IAED,OAAO,aAAa,CAAC,GAAG,CAAC;QACvB,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,oBAAoB,CAAC,CAAA;AACrE,CAAC;AAnBD,kCAmBC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare type AnyFunction = (...args: any[]) => any;
|
|
2
|
-
export declare type LazyCallbackReturnType<FnType extends AnyFunction> = Parameters<FnType> | [];
|
|
3
|
-
export interface LazyCallback<FnType extends AnyFunction> {
|
|
4
|
-
(...args: Parameters<FnType>): void;
|
|
5
|
-
invoked(): Promise<LazyCallbackReturnType<FnType>>;
|
|
6
|
-
}
|
|
7
|
-
export interface LazyCallbackOptions {
|
|
8
|
-
maxCalls?: number;
|
|
9
|
-
maxCallsCallback?(): void;
|
|
10
|
-
}
|
|
11
|
-
export declare function createLazyCallback<FnType extends AnyFunction>(options?: LazyCallbackOptions): LazyCallback<FnType>;
|