From c4e535c070fe848a68a0957ba2221ec973b862d5 Mon Sep 17 00:00:00 2001 From: Michael Angelo Rivera <55844504+michaelangeloio@users.noreply.github.com> Date: Sun, 12 Nov 2023 11:32:43 -0500 Subject: [PATCH] chore: keep repo up to date (#21) --- .github/workflows/pr.yml | 2 +- .vscode/launch.json | 52 ------- examples/next-app/app/page.tsx | 11 +- examples/next-app/app/stream/route.ts | 79 ++++------ examples/next-app/app/streamClient.tsx | 89 +++++++++-- examples/next-app/package.json | 30 ++-- package-lock.json | 207 +------------------------ package.json | 4 +- src/writer.ts | 2 +- 9 files changed, 132 insertions(+), 344 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7487e43..d8b407d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v3 diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 0e0738b..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Current TS File", - "type": "node", - "request": "launch", - "runtimeExecutable": "node", - "args": ["${relativeFile}"], - "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], - "envFile": "${workspaceFolder}/.env", - "cwd": "${workspaceRoot}", - "internalConsoleOptions": "openOnSessionStart", - "skipFiles": ["/**", "node_modules/**"] - }, - { - "name": "Debug Jest Tests", - "type": "node", - "request": "launch", - "runtimeArgs": [ - "--inspect-brk", - "${workspaceRoot}/node_modules/.bin/jest", - "--runInBand" - ], - "envFile": "${workspaceFolder}/.env", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "port": 9229, - "disableOptimisticBPs": true, - "windows": { - "program": "${workspaceFolder}/node_modules/jest/bin/jest" - } - }, - { - "name": "Debug Jest Current File", - "type": "node", - "request": "launch", - "program": "${workspaceFolder}/node_modules/.bin/jest", - "args": ["${relativeFile}", "--config", "jest.config.js"], - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "port": 9229, - "disableOptimisticBPs": true, - "windows": { - "program": "${workspaceFolder}/node_modules/jest/bin/jest" - } - } - ] -} diff --git a/examples/next-app/app/page.tsx b/examples/next-app/app/page.tsx index b8186ff..65cab95 100644 --- a/examples/next-app/app/page.tsx +++ b/examples/next-app/app/page.tsx @@ -1,5 +1,9 @@ +import dynamic from 'next/dynamic' import Image from 'next/image' -import { StreamClient } from './StreamClient' + +const DynamicStreamClient = dynamic(() => import('./streamClient'), { + ssr: false, +}) export default function Home() { return ( @@ -16,12 +20,11 @@ export default function Home() { target="_blank" rel="noopener noreferrer" > - By{' '} - Michael Angelo Rivera + By Michael Angelo Rivera - +
, + data: z.infer event: 'update' } complete: { @@ -23,60 +22,38 @@ type SyncEvents = EventNotifier<{ } }> -export async function GET() { +export async function GET(request: NextRequest) { const responseStream = new TransformStream() const writer = responseStream.writable.getWriter() const encoder = new TextEncoder() - const syncStatusStream = async (notifier: SyncEvents) => { - notifier.update( - { - data: 'Never gonna give you up', - event: 'update' - }, - { - beforeFn: (message) => { - rickAstleySchema.parse(message.data) - }, - }, - ) - await new Promise((resolve) => setTimeout(resolve, 1000)) - notifier.update( - { - data: 'Never gonna let you down', - event: 'update' - }, - ) - await new Promise((resolve) => setTimeout(resolve, 1000)) - notifier.update( - { - data: 'Never gonna run around and desert you', - event: 'update' + let abort = false - }, - ) - await new Promise((resolve) => setTimeout(resolve, 1000)) - notifier.update( - { - data: 'Never gonna make you cry', - event: 'update' + request.signal.onabort = () => { + abort = true + writer.close() + } - }, - ) - await new Promise((resolve) => setTimeout(resolve, 1000)) - notifier.update( - { - data: 'Never gonna say goodbye', - event: 'update' - }, - ) - await new Promise((resolve) => setTimeout(resolve, 1000)) - notifier.complete( - { - data: 'Never gonna tell a lie and hurt you', - event: 'update' - }, - ) + const beforeFn = (message: { data: string; event: 'update' }) => { + rickAstleySchema.parse(message.data) + if (abort) { + throw new Error('Abort!') + } + } + const messages = [ + 'Never gonna give you up', + 'Never gonna let you down', + 'Never gonna run around and desert you', + 'Never gonna make you cry', + 'Never gonna say goodbye', + 'Never gonna tell a lie and hurt you', + 'fin', + ] + const syncStatusStream = async (notifier: SyncEvents) => { + for (const message of messages) { + await new Promise((resolve) => setTimeout(resolve, 1000)) + notifier.update({ data: message, event: 'update' }, { beforeFn }) + } } syncStatusStream(getSSEWriter(writer, encoder)) diff --git a/examples/next-app/app/streamClient.tsx b/examples/next-app/app/streamClient.tsx index ae102a8..91f9e33 100644 --- a/examples/next-app/app/streamClient.tsx +++ b/examples/next-app/app/streamClient.tsx @@ -1,18 +1,83 @@ 'use client' -import { useEffect, useState } from "react" -import { z } from "zod" -import { rickAstleySchema } from "./stream/types" +import { + useEffect, + useState, + createContext, + ReactNode, + useContext, + useCallback, +} from 'react' +import { rickAstleySchema } from './stream/types' + +// Create a context +const EventSourceContext = createContext(null) + +export const EventSourceProvider = ({ children }: { children: ReactNode }) => { + const [eventSource, setEventSource] = useState(null) -export const StreamClient = () => { - const [lyric, setLyric] = useState("") - const source = new EventSource("http://localhost:3000/stream") useEffect(() => { - source.addEventListener('update', (event) => { - const parsed = rickAstleySchema.safeParse(event.data) - if (parsed.success) { - setLyric(parsed.data) - } + const source = new EventSource('http://localhost:3000/stream', { + withCredentials: true, }) + setEventSource(source) + + return () => { + source.close() + } + }, []) + + return ( + + {children} + + ) +} + +const StreamClient = () => { + const [lyric, setLyric] = useState('') + + const eventSource = useContext(EventSourceContext) + const updateLyric = useCallback((event: MessageEvent) => { + const parsed = rickAstleySchema.safeParse(event.data) + if (parsed.success) { + setLyric(parsed.data) + if (parsed.data === 'fin') { + eventSource?.close() + } + } }, []) + + useEffect(() => { + if (eventSource) { + eventSource.onerror = (error) => { + console.error('EventSource failed:', error) + } + eventSource.addEventListener('update', updateLyric) + + return () => { + eventSource.removeEventListener('update', updateLyric) + } + } + }, [eventSource]) + return lyric -} \ No newline at end of file +} + +const StreamClientComponent = () => { + const lyric = StreamClient() + return ( +
+

{lyric}

+
+ ) +} + +const StreamClientComponentWithProvider = () => { + return ( + + + + ) +} + +export default StreamClientComponentWithProvider diff --git a/examples/next-app/package.json b/examples/next-app/package.json index 99c0312..70939b7 100644 --- a/examples/next-app/package.json +++ b/examples/next-app/package.json @@ -1,6 +1,6 @@ { "name": "next-app", - "version": "0.1.0", + "version": "0.1.1", "private": true, "scripts": { "dev": "next dev", @@ -9,19 +9,19 @@ "lint": "next lint" }, "dependencies": { - "@types/node": "20.5.9", - "@types/react": "18.2.21", - "@types/react-dom": "18.2.7", - "autoprefixer": "10.4.15", - "eslint": "8.48.0", - "eslint-config-next": "13.4.19", - "next": "13.4.19", - "postcss": "8.4.29", - "react": "18.2.0", - "react-dom": "18.2.0", - "tailwindcss": "3.3.3", + "@types/node": "^20.9.0", + "@types/react": "^18.2.37", + "@types/react-dom": "^18.2.15", + "autoprefixer": "^10.4.16", + "eslint": "^8.53.0", + "eslint-config-next": "^14.0.2", + "next": "^14.0.2", + "postcss": "^8.4.31", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "tailwindcss": "^3.3.5", "ts-sse": "^0.0.5", - "typescript": "5.2.2", - "zod": "^3.22.2" + "typescript": "^5.2.2", + "zod": "^3.22.4" } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 21d5cc4..472575e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ts-sse", - "version": "0.0.01", + "version": "0.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ts-sse", - "version": "0.0.01", + "version": "0.0.5", "license": "MIT", "devDependencies": { "@changesets/cli": "^2.26.2", @@ -14,7 +14,6 @@ "@types/node": "^20.5.9", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", - "conventional-changelog-conventionalcommits": "^5.0.0", "eslint": "^8.48.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-node": "^11.1.0", @@ -22,7 +21,6 @@ "jest": "^29.6.4", "prettier": "^3.0.3", "ts-jest": "^29.1.1", - "ts-node": "^10.9.1", "typescript": "^5.2.2" }, "engines": { @@ -834,28 +832,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -1809,30 +1785,6 @@ "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true - }, "node_modules/@types/babel__core": { "version": "7.20.1", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", @@ -2187,15 +2139,6 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -2282,12 +2225,6 @@ "node": ">= 8" } }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2310,12 +2247,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-ify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", - "dev": true - }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -2886,48 +2817,18 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, - "node_modules/compare-func": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", - "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", - "dev": true, - "dependencies": { - "array-ify": "^1.0.0", - "dot-prop": "^5.1.0" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "node_modules/conventional-changelog-conventionalcommits": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz", - "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==", - "dev": true, - "dependencies": { - "compare-func": "^2.0.0", - "lodash": "^4.17.15", - "q": "^1.5.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -3257,15 +3158,6 @@ "node": ">=8" } }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -3299,18 +3191,6 @@ "node": ">=6.0.0" } }, - "node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.508", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.508.tgz", @@ -4796,15 +4676,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -6824,12 +6695,6 @@ "node": ">=8" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -7552,16 +7417,6 @@ } ] }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", - "dev": true, - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -8562,49 +8417,6 @@ "node": ">=12" } }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -8894,12 +8706,6 @@ "punycode": "^2.1.0" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, "node_modules/v8-to-istanbul": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", @@ -9141,15 +8947,6 @@ "node": ">=12" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 0b48f1e..00c203b 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "@types/node": "^20.5.9", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", - "conventional-changelog-conventionalcommits": "^5.0.0", "eslint": "^8.48.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-node": "^11.1.0", @@ -55,10 +54,9 @@ "jest": "^29.6.4", "prettier": "^3.0.3", "ts-jest": "^29.1.1", - "ts-node": "^10.9.1", "typescript": "^5.2.2" }, "lint-staged": { "*.ts": "eslint --cache --cache-location .eslintcache --fix" } -} \ No newline at end of file +} diff --git a/src/writer.ts b/src/writer.ts index a82897f..2e021cf 100644 --- a/src/writer.ts +++ b/src/writer.ts @@ -21,7 +21,7 @@ export interface EventNotifier< : never error: T['error'] extends Message ? Message['data'] : never close: T['close'] extends Message ? Message['data'] : never - } = any + } = any, > { update: ( message: Message['data'],