From 845066abf861f6c3f7f1eea8b16c723ba0c9a048 Mon Sep 17 00:00:00 2001 From: Katarina Anton Date: Sun, 29 May 2022 12:00:44 +1200 Subject: [PATCH] build(deps-dev): bump `eventsource` --- package-lock.json | 86 +++------------------- package.json | 2 +- src/helpers/__tests__/event-source.spec.ts | 14 ++-- 3 files changed, 19 insertions(+), 83 deletions(-) diff --git a/package-lock.json b/package-lock.json index 88b688a..c0ae35d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "eslint-plugin-react": "7.24.0", "eslint-plugin-react-hooks": "4.2.0", "eslint-plugin-testing-library": "4.6.0", - "eventsource": "1.1.0", + "eventsource": "2.0.2", "husky": "7.0.0", "jest": "27.0.6", "lint-staged": "11.0.0", @@ -8316,15 +8316,12 @@ } }, "node_modules/eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", "dev": true, - "dependencies": { - "original": "^1.0.0" - }, "engines": { - "node": ">=0.12.0" + "node": ">=12.0.0" } }, "node_modules/execa": { @@ -17309,15 +17306,6 @@ "node": ">=8" } }, - "node_modules/original": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", - "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", - "dev": true, - "dependencies": { - "url-parse": "^1.4.3" - } - }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -18128,12 +18116,6 @@ "teleport": ">=0.2.0" } }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -18516,12 +18498,6 @@ "node": ">=0.10.5" } }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, "node_modules/resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -20064,16 +20040,6 @@ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", "dev": true }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -26551,13 +26517,10 @@ "dev": true }, "eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", - "dev": true, - "requires": { - "original": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "dev": true }, "execa": { "version": "5.1.1", @@ -33193,15 +33156,6 @@ } } }, - "original": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", - "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", - "dev": true, - "requires": { - "url-parse": "^1.4.3" - } - }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -33800,12 +33754,6 @@ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "dev": true }, - "querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -34092,12 +34040,6 @@ "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", "dev": true }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, "resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -35300,16 +35242,6 @@ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", "dev": true }, - "url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 092527a..f990ee9 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "eslint-plugin-react": "7.24.0", "eslint-plugin-react-hooks": "4.2.0", "eslint-plugin-testing-library": "4.6.0", - "eventsource": "1.1.0", + "eventsource": "2.0.2", "husky": "7.0.0", "jest": "27.0.6", "lint-staged": "11.0.0", diff --git a/src/helpers/__tests__/event-source.spec.ts b/src/helpers/__tests__/event-source.spec.ts index 86209f0..6542862 100644 --- a/src/helpers/__tests__/event-source.spec.ts +++ b/src/helpers/__tests__/event-source.spec.ts @@ -27,9 +27,13 @@ describe('EventSource helpers', () => { requestListener.mockClear(); }); + function createAbsoluteUrl(relativePath: string): string { + return new URL(relativePath, window.location.href).toString(); + } + describe('eventSource$', () => { it('should emit values from event source', async () => { - const sse$ = eventSource$('/sse'); + const sse$ = eventSource$(createAbsoluteUrl('/sse')); expect(await firstValueFrom(sse$.pipe(take(5), toArray()))) .toMatchInlineSnapshot(` Array [ @@ -45,7 +49,7 @@ describe('EventSource helpers', () => { }); it('should not open the EventSource until subscribed', async () => { - const sse$ = eventSource$('/sse'); + const sse$ = eventSource$(createAbsoluteUrl('/sse')); expect(requestListener).not.toHaveBeenCalled(); const promise = firstValueFrom(sse$.pipe(take(5), toArray())); @@ -55,14 +59,14 @@ describe('EventSource helpers', () => { }); it('should close the EventSource once unsubscribed', async () => { - const sse$ = eventSource$('/sse'); + const sse$ = eventSource$(createAbsoluteUrl('/sse')); await firstValueFrom(sse$.pipe(take(5), toArray())); expect(closeSseSpy).toHaveBeenCalledTimes(1); }); it('should emit values from event source until error', async () => { - const sse$ = eventSource$('/sse/error'); + const sse$ = eventSource$(createAbsoluteUrl('/sse/error')); expect( await firstValueFrom( sse$.pipe( @@ -83,7 +87,7 @@ describe('EventSource helpers', () => { it('should fail to subscribe', async () => { expect.assertions(2); - const sse$ = eventSource$('/sse/network-error'); + const sse$ = eventSource$(createAbsoluteUrl('/sse/network-error')); try { await firstValueFrom(sse$.pipe(take(5), toArray())); } catch (error) {