From 1f601ee985e1a969fa2cdacaf2ff20962a2edbd9 Mon Sep 17 00:00:00 2001 From: Ben Williams Date: Fri, 14 Apr 2023 08:14:12 -0700 Subject: [PATCH 1/5] Fixed transform on subscription --- .../electron-trpc/src/main/handleIPCOperation.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/electron-trpc/src/main/handleIPCOperation.ts b/packages/electron-trpc/src/main/handleIPCOperation.ts index 079900f0..9a4f1ea6 100644 --- a/packages/electron-trpc/src/main/handleIPCOperation.ts +++ b/packages/electron-trpc/src/main/handleIPCOperation.ts @@ -60,13 +60,14 @@ export async function handleIPCOperation({ const subscription = result.subscribe({ next(data) { - respond({ - id, - result: { - type: 'data', - data, - }, - }); + const response = transformTRPCResponseItem(router, { + id, + result: { + type: 'data', + data, + }, + }); + respond(response); }, error(err) { const error = getTRPCErrorFromUnknown(err); From 17f7e80f15eafbe0d14d474b5e690348edde0225 Mon Sep 17 00:00:00 2001 From: Jason Nall Date: Fri, 14 Apr 2023 11:30:11 -0400 Subject: [PATCH 2/5] Update response transforms, add tests. --- .../main/__tests__/handleIPCOperation.test.ts | 119 +++++++++++++----- .../src/main/handleIPCOperation.ts | 30 +++-- 2 files changed, 104 insertions(+), 45 deletions(-) diff --git a/packages/electron-trpc/src/main/__tests__/handleIPCOperation.test.ts b/packages/electron-trpc/src/main/__tests__/handleIPCOperation.test.ts index 870d9494..f2a9965c 100644 --- a/packages/electron-trpc/src/main/__tests__/handleIPCOperation.test.ts +++ b/packages/electron-trpc/src/main/__tests__/handleIPCOperation.test.ts @@ -159,7 +159,68 @@ describe('api', () => { expect(event.sender.send).not.toHaveBeenCalled(); }); - test("doesn't crash when canceling subscriptions when custom deserializer doesn't allow undefined", async () => { + test('subscription responds using custom serializer', async () => { + const event = makeEvent({ + sender: { + isDestroyed: () => false, + on: () => {}, + send: vi.fn(), + }, + }); + + const t = trpc.initTRPC.create({ + transformer: { + deserialize: (input: unknown) => { + const serialized = (input as string).replace(/^serialized:/, ''); + return JSON.parse(serialized); + }, + serialize: (input) => { + return `serialized:${JSON.stringify(input)}`; + }, + }, + }); + + const testRouter = t.router({ + testSubscription: t.procedure.subscription(() => { + return observable((emit) => { + function testResponse() { + emit.next('test response'); + } + + ee.on('test', testResponse); + return () => ee.off('test', testResponse); + }); + }), + }); + + await handleIPCOperation({ + createContext: async () => ({}), + operation: { + context: {}, + id: 1, + input: undefined, + path: 'testSubscription', + type: 'subscription', + }, + router: testRouter, + event, + }); + + expect(event.sender.send).not.toHaveBeenCalled(); + + ee.emit('test'); + + expect(event.sender.send).toHaveBeenCalledOnce(); + expect(event.sender.send.mock.lastCall[1]).toMatchObject({ + id: 1, + result: { + type: 'data', + data: 'serialized:"test response"', + }, + }); + }); + + test("doesn't crash when canceling subscriptions when custom deserializer doesn't allow undefined", async () => { const t = trpc.initTRPC.create({ transformer: { deserialize: (input: unknown) => { @@ -185,37 +246,37 @@ describe('api', () => { }), }); - let isDestroyed = false; - let onDestroyed: () => void; - const event = makeEvent({ - sender: { - isDestroyed: () => isDestroyed, - send: vi.fn(), - on: (_event: string, cb: () => void) => { - onDestroyed = cb; - }, - }, - }); - - await handleIPCOperation({ - createContext: async () => ({}), - operation: { - context: {}, - id: 1, - input: undefined, - path: 'testSubscription', - type: 'subscription', + let isDestroyed = false; + let onDestroyed: () => void; + const event = makeEvent({ + sender: { + isDestroyed: () => isDestroyed, + send: vi.fn(), + on: (_event: string, cb: () => void) => { + onDestroyed = cb; }, - router: testRouter, - event, - }); + }, + }); - expect(event.sender.send).not.toHaveBeenCalled(); + await handleIPCOperation({ + createContext: async () => ({}), + operation: { + context: {}, + id: 1, + input: undefined, + path: 'testSubscription', + type: 'subscription', + }, + router: testRouter, + event, + }); + + expect(event.sender.send).not.toHaveBeenCalled(); - onDestroyed(); + onDestroyed(); - ee.emit('test'); + ee.emit('test'); - expect(event.sender.send).not.toHaveBeenCalled(); - }); + expect(event.sender.send).not.toHaveBeenCalled(); + }); }); diff --git a/packages/electron-trpc/src/main/handleIPCOperation.ts b/packages/electron-trpc/src/main/handleIPCOperation.ts index 9a4f1ea6..05512a86 100644 --- a/packages/electron-trpc/src/main/handleIPCOperation.ts +++ b/packages/electron-trpc/src/main/handleIPCOperation.ts @@ -20,13 +20,15 @@ export async function handleIPCOperation({ event: IpcMainInvokeEvent; }) { const { type, input: serializedInput, id, path } = operation; - const input = serializedInput ? router._def._config.transformer.input.deserialize(serializedInput) : undefined; + const input = serializedInput + ? router._def._config.transformer.input.deserialize(serializedInput) + : undefined; const ctx = (await createContext?.({ event })) ?? {}; const respond = (response: TRPCResponseMessage) => { if (event.sender.isDestroyed()) return; - event.sender.send(ELECTRON_TRPC_CHANNEL, response); + event.sender.send(ELECTRON_TRPC_CHANNEL, transformTRPCResponseItem(router, response)); }; try { @@ -39,15 +41,13 @@ export async function handleIPCOperation({ }); if (type !== 'subscription') { - const response = transformTRPCResponseItem(router, { + respond({ id, result: { type: 'data', data: result, }, }); - - respond(response); return; } else { if (!isObservable(result)) { @@ -60,14 +60,13 @@ export async function handleIPCOperation({ const subscription = result.subscribe({ next(data) { - const response = transformTRPCResponseItem(router, { - id, - result: { - type: 'data', - data, - }, - }); - respond(response); + respond({ + id, + result: { + type: 'data', + data, + }, + }); }, error(err) { const error = getTRPCErrorFromUnknown(err); @@ -96,7 +95,8 @@ export async function handleIPCOperation({ } catch (cause) { const error: TRPCError = getTRPCErrorFromUnknown(cause); - const response = transformTRPCResponseItem(router, { + return respond({ + id, error: router.getErrorShape({ error, type, @@ -105,7 +105,5 @@ export async function handleIPCOperation({ ctx, }), }); - - return respond({ id, ...response }); } } From 2339150211dbf9dd467d2b8f85de7069861126f8 Mon Sep 17 00:00:00 2001 From: Jason Nall Date: Fri, 14 Apr 2023 11:46:31 -0400 Subject: [PATCH 3/5] Add superjson example. --- .../CHANGELOG.md | 0 .../basic-react-superjson/electron/api.ts | 35 +++++++++ .../electron/index.ts | 0 .../index.html | 0 .../package.json | 4 +- .../preload/preload.ts | 0 examples/basic-react-superjson/src/index.tsx | 44 +++++++++++ .../tsconfig.json | 0 .../vite.config.ts | 0 examples/basic-react/CHANGELOG.md | 78 +++++++++++++++++++ .../{basic => basic-react}/electron/api.ts | 0 examples/basic-react/electron/index.ts | 28 +++++++ examples/basic-react/index.html | 14 ++++ examples/basic-react/package.json | 30 +++++++ examples/basic-react/preload/preload.ts | 5 ++ examples/{basic => basic-react}/src/index.tsx | 0 examples/basic-react/tsconfig.json | 22 ++++++ examples/basic-react/vite.config.ts | 21 +++++ pnpm-lock.yaml | 44 +++++++++-- 19 files changed, 318 insertions(+), 7 deletions(-) rename examples/{basic => basic-react-superjson}/CHANGELOG.md (100%) create mode 100644 examples/basic-react-superjson/electron/api.ts rename examples/{basic => basic-react-superjson}/electron/index.ts (100%) rename examples/{basic => basic-react-superjson}/index.html (100%) rename examples/{basic => basic-react-superjson}/package.json (90%) rename examples/{basic => basic-react-superjson}/preload/preload.ts (100%) create mode 100644 examples/basic-react-superjson/src/index.tsx rename examples/{basic => basic-react-superjson}/tsconfig.json (100%) rename examples/{basic => basic-react-superjson}/vite.config.ts (100%) create mode 100644 examples/basic-react/CHANGELOG.md rename examples/{basic => basic-react}/electron/api.ts (100%) create mode 100644 examples/basic-react/electron/index.ts create mode 100644 examples/basic-react/index.html create mode 100644 examples/basic-react/package.json create mode 100644 examples/basic-react/preload/preload.ts rename examples/{basic => basic-react}/src/index.tsx (100%) create mode 100644 examples/basic-react/tsconfig.json create mode 100644 examples/basic-react/vite.config.ts diff --git a/examples/basic/CHANGELOG.md b/examples/basic-react-superjson/CHANGELOG.md similarity index 100% rename from examples/basic/CHANGELOG.md rename to examples/basic-react-superjson/CHANGELOG.md diff --git a/examples/basic-react-superjson/electron/api.ts b/examples/basic-react-superjson/electron/api.ts new file mode 100644 index 00000000..3a6b6edf --- /dev/null +++ b/examples/basic-react-superjson/electron/api.ts @@ -0,0 +1,35 @@ +import z from 'zod'; +import { initTRPC } from '@trpc/server'; +import { observable } from '@trpc/server/observable'; +import { EventEmitter } from 'events'; +import superjson from 'superjson'; + +const ee = new EventEmitter(); + +const t = initTRPC.create({ isServer: true, transformer: superjson }); + +export const router = t.router({ + greeting: t.procedure.input(z.object({ name: z.string() })).query((req) => { + const { input } = req; + + ee.emit('greeting', `Greeted ${input.name}`); + return { + text: `Hello ${input.name}` as const, + }; + }), + subscription: t.procedure.subscription(() => { + return observable((emit) => { + function onGreet(text: string) { + emit.next({ text }); + } + + ee.on('greeting', onGreet); + + return () => { + ee.off('greeting', onGreet); + }; + }); + }), +}); + +export type AppRouter = typeof router; diff --git a/examples/basic/electron/index.ts b/examples/basic-react-superjson/electron/index.ts similarity index 100% rename from examples/basic/electron/index.ts rename to examples/basic-react-superjson/electron/index.ts diff --git a/examples/basic/index.html b/examples/basic-react-superjson/index.html similarity index 100% rename from examples/basic/index.html rename to examples/basic-react-superjson/index.html diff --git a/examples/basic/package.json b/examples/basic-react-superjson/package.json similarity index 90% rename from examples/basic/package.json rename to examples/basic-react-superjson/package.json index 9e5e3fb3..7d5f31a5 100644 --- a/examples/basic/package.json +++ b/examples/basic-react-superjson/package.json @@ -1,6 +1,5 @@ { - "name": "examples/basic", - "description": "Electron support for tRPC", + "name": "examples/basic-react-superjson", "version": "0.0.8", "private": true, "main": "dist-electron/index.js", @@ -18,6 +17,7 @@ "electron-trpc": "0.4.2", "react": "^18.2.0", "react-dom": "^18.2.0", + "superjson": "^1.12.2", "zod": "^3.19.1" }, "devDependencies": { diff --git a/examples/basic/preload/preload.ts b/examples/basic-react-superjson/preload/preload.ts similarity index 100% rename from examples/basic/preload/preload.ts rename to examples/basic-react-superjson/preload/preload.ts diff --git a/examples/basic-react-superjson/src/index.tsx b/examples/basic-react-superjson/src/index.tsx new file mode 100644 index 00000000..4a226100 --- /dev/null +++ b/examples/basic-react-superjson/src/index.tsx @@ -0,0 +1,44 @@ +import React, { useState } from 'react'; +import ReactDom from 'react-dom'; +import { ipcLink } from 'electron-trpc/renderer'; +import superjson from 'superjson'; +import { createTRPCReact } from '@trpc/react-query'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +import type { AppRouter } from '../electron/api'; + +const trpcReact = createTRPCReact(); + +function App() { + const [queryClient] = useState(() => new QueryClient()); + const [trpcClient] = useState(() => + trpcReact.createClient({ + links: [ipcLink()], + transformer: superjson, + }) + ); + + return ( + + + + + + ); +} + +function HelloElectron() { + const { data } = trpcReact.greeting.useQuery({ name: 'Electron' }); + trpcReact.subscription.useSubscription(undefined, { + onData: (data) => { + console.log(data); + }, + }); + + if (!data) { + return null; + } + + return
{data.text}
; +} + +ReactDom.render(, document.getElementById('react-root')); diff --git a/examples/basic/tsconfig.json b/examples/basic-react-superjson/tsconfig.json similarity index 100% rename from examples/basic/tsconfig.json rename to examples/basic-react-superjson/tsconfig.json diff --git a/examples/basic/vite.config.ts b/examples/basic-react-superjson/vite.config.ts similarity index 100% rename from examples/basic/vite.config.ts rename to examples/basic-react-superjson/vite.config.ts diff --git a/examples/basic-react/CHANGELOG.md b/examples/basic-react/CHANGELOG.md new file mode 100644 index 00000000..03634825 --- /dev/null +++ b/examples/basic-react/CHANGELOG.md @@ -0,0 +1,78 @@ +# examples/basic + +## 0.0.8 + +### Patch Changes + +- Updated dependencies [[`cbae157`](https://github.com/jsonnull/electron-trpc/commit/cbae1570ddeab2405950806656c0d4fc19d72855)]: + - electron-trpc@0.4.2 + +## 0.0.7 + +### Patch Changes + +- Updated dependencies [[`b73c1a8`](https://github.com/jsonnull/electron-trpc/commit/b73c1a89c77258bf4372991fda563d6fa0ba299f)]: + - electron-trpc@0.4.1 + +## 0.0.6 + +### Patch Changes + +- Updated dependencies [[`70e8e5c`](https://github.com/jsonnull/electron-trpc/commit/70e8e5c5f3e2654d055663a286c4107a66f362e7)]: + - electron-trpc@0.4.0 + +## 0.0.5 + +### Patch Changes + +- Updated dependencies [[`46d79ef`](https://github.com/jsonnull/electron-trpc/commit/46d79efde7ccc12cd1e99eb086413aa83bda29f8)]: + - electron-trpc@0.3.2 + +## 0.0.4 + +### Patch Changes + +- Updated dependencies [[`25b6c5a`](https://github.com/jsonnull/electron-trpc/commit/25b6c5a5cb56a93a4facf7345a10c3bb2db37730), [`25b6c5a`](https://github.com/jsonnull/electron-trpc/commit/25b6c5a5cb56a93a4facf7345a10c3bb2db37730), [`25b6c5a`](https://github.com/jsonnull/electron-trpc/commit/25b6c5a5cb56a93a4facf7345a10c3bb2db37730)]: + - electron-trpc@0.3.1 + +## 0.0.3 + +### Patch Changes + +- Updated dependencies [[`b67f2a7`](https://github.com/jsonnull/electron-trpc/commit/b67f2a7a87cd77b88d337e6996d78c6507a9c187)]: + - electron-trpc@0.3.0 + +## 0.0.2 + +### Patch Changes + +- Updated dependencies [[`c9031f5`](https://github.com/jsonnull/electron-trpc/commit/c9031f5b521095d3c648fc905b642471e875d86f)]: + - electron-trpc@0.2.1 + +## 0.0.1 + +### Patch Changes + +- Updated dependencies [[`231afea`](https://github.com/jsonnull/electron-trpc/commit/231afea9f21f0d4ba7f12c37fd781f22ca5d4141), [`960999f`](https://github.com/jsonnull/electron-trpc/commit/960999f5c2fec8b70152cfdf6cadc737c60edd48), [`3c76498`](https://github.com/jsonnull/electron-trpc/commit/3c76498c152e92fe1b084d3e7a5170d8f2c1dee3), [`7c7ee89`](https://github.com/jsonnull/electron-trpc/commit/7c7ee89b45c6c27527e26b0a6100fc0cb41d8ba6), [`ddc11cb`](https://github.com/jsonnull/electron-trpc/commit/ddc11cb1f1502568a028476acdefdb8d95d9562c), [`4615cf6`](https://github.com/jsonnull/electron-trpc/commit/4615cf63c382a0ea21781efb5093a531cc6378e6), [`006d01e`](https://github.com/jsonnull/electron-trpc/commit/006d01e73a995f756be622769192444bba3b4a87), [`c46f700`](https://github.com/jsonnull/electron-trpc/commit/c46f700b6171835a5b00d6d2c44061acdcd49874), [`42f2b09`](https://github.com/jsonnull/electron-trpc/commit/42f2b09efbaf322af42df176b74f72b972724f99), [`d2870a4`](https://github.com/jsonnull/electron-trpc/commit/d2870a4ef4429053c6a0d3e44bb204d0177adda9)]: + - electron-trpc@0.2.0 + +## 0.0.1-next.2 + +### Patch Changes + +- Updated dependencies [[`169c47f`](https://github.com/jsonnull/electron-trpc/commit/169c47f325de8899784187af06140c29758b0c0a)]: + - electron-trpc@0.2.0-next.7 + +## 0.0.1-next.1 + +### Patch Changes + +- Updated dependencies [[`a2103c4`](https://github.com/jsonnull/electron-trpc/commit/a2103c4e9789741aa98aa057fcebf78e4f339d9b)]: + - electron-trpc@0.2.0-next.6 + +## 0.0.1-next.0 + +### Patch Changes + +- Updated dependencies [[`333197f`](https://github.com/jsonnull/electron-trpc/commit/333197fb3e567aa37f350af992d123f8f8ed6796)]: + - electron-trpc@0.2.0-next.5 diff --git a/examples/basic/electron/api.ts b/examples/basic-react/electron/api.ts similarity index 100% rename from examples/basic/electron/api.ts rename to examples/basic-react/electron/api.ts diff --git a/examples/basic-react/electron/index.ts b/examples/basic-react/electron/index.ts new file mode 100644 index 00000000..62973aff --- /dev/null +++ b/examples/basic-react/electron/index.ts @@ -0,0 +1,28 @@ +import path from 'path'; +import { app, BrowserWindow } from 'electron'; +import { createIPCHandler } from 'electron-trpc/main'; +import { router } from './api'; + +process.env.DIST = path.join(__dirname, '../dist'); +process.env.PUBLIC = app.isPackaged ? process.env.DIST : path.join(process.env.DIST, '../public'); + +const preload = path.join(__dirname, './preload.js'); +const url = process.env['VITE_DEV_SERVER_URL']; + +app.on('ready', () => { + const win = new BrowserWindow({ + webPreferences: { + preload, + }, + }); + + createIPCHandler({ router, windows: [win] }); + + if (url) { + win.loadURL(url); + } else { + win.loadFile(path.join(process.env.DIST, 'index.html')); + } + + win.show(); +}); diff --git a/examples/basic-react/index.html b/examples/basic-react/index.html new file mode 100644 index 00000000..0d54cf10 --- /dev/null +++ b/examples/basic-react/index.html @@ -0,0 +1,14 @@ + + + + + + + + Hello from Electron renderer! + + +
+ + + diff --git a/examples/basic-react/package.json b/examples/basic-react/package.json new file mode 100644 index 00000000..88692df7 --- /dev/null +++ b/examples/basic-react/package.json @@ -0,0 +1,30 @@ +{ + "name": "examples/basic-react", + "version": "0.0.8", + "private": true, + "main": "dist-electron/index.js", + "license": "MIT", + "scripts": { + "start": "vite", + "build": "vite build" + }, + "dependencies": { + "@tanstack/react-query": "^4.8.0", + "@trpc/client": "10.4.3", + "@trpc/react-query": "10.4.3", + "@trpc/server": "10.4.3", + "electron": "^21.2.2", + "electron-trpc": "0.4.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "zod": "^3.19.1" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "@types/react": "^18.0.21", + "@types/react-dom": "^18.0.6", + "@vitejs/plugin-react": "^3.0.0", + "vite": "^3.0.3", + "vite-plugin-electron": "^0.11.0" + } +} diff --git a/examples/basic-react/preload/preload.ts b/examples/basic-react/preload/preload.ts new file mode 100644 index 00000000..4b7d56fa --- /dev/null +++ b/examples/basic-react/preload/preload.ts @@ -0,0 +1,5 @@ +import { exposeElectronTRPC } from 'electron-trpc/main'; + +process.once('loaded', async () => { + exposeElectronTRPC(); +}); diff --git a/examples/basic/src/index.tsx b/examples/basic-react/src/index.tsx similarity index 100% rename from examples/basic/src/index.tsx rename to examples/basic-react/src/index.tsx diff --git a/examples/basic-react/tsconfig.json b/examples/basic-react/tsconfig.json new file mode 100644 index 00000000..1a26c4e1 --- /dev/null +++ b/examples/basic-react/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "lib": ["dom", "esnext"], + "module": "esnext", + "moduleResolution": "node16", + "noEmit": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "useDefineForClassFields": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "esnext" + }, + "include": ["./*.ts", "./*.tsx"], + "exclude": ["node_modules"] +} diff --git a/examples/basic-react/vite.config.ts b/examples/basic-react/vite.config.ts new file mode 100644 index 00000000..03d72670 --- /dev/null +++ b/examples/basic-react/vite.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import electron from 'vite-plugin-electron'; + +export default defineConfig({ + mode: 'development', + plugins: [ + react(), + electron([ + { + entry: 'electron/index.ts', + }, + { + entry: 'preload/preload.ts', + onstart(options) { + options.reload(); + }, + }, + ]), + ], +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5317a5d4..96034ef0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ importers: vitepress: 1.0.0-alpha.45 vue: 3.2.45 - examples/basic: + examples/basic-react: specifiers: '@tanstack/react-query': ^4.8.0 '@trpc/client': 10.4.3 @@ -55,6 +55,43 @@ importers: vite: 3.2.3_@types+node@18.11.9 vite-plugin-electron: 0.11.1 + examples/basic-react-superjson: + specifiers: + '@tanstack/react-query': ^4.8.0 + '@trpc/client': 10.4.3 + '@trpc/react-query': 10.4.3 + '@trpc/server': 10.4.3 + '@types/node': ^18.0.0 + '@types/react': ^18.0.21 + '@types/react-dom': ^18.0.6 + '@vitejs/plugin-react': ^3.0.0 + electron: ^21.2.2 + electron-trpc: 0.4.2 + react: ^18.2.0 + react-dom: ^18.2.0 + superjson: ^1.12.2 + vite: ^3.0.3 + vite-plugin-electron: ^0.11.0 + zod: ^3.19.1 + dependencies: + '@tanstack/react-query': 4.14.5_biqbaboplfbrettd7655fr4n2y + '@trpc/client': 10.4.3_@trpc+server@10.4.3 + '@trpc/react-query': 10.4.3_4tjrxizjrzoh7m4zzvertzcuwu + '@trpc/server': 10.4.3 + electron: 21.2.3 + electron-trpc: link:../../packages/electron-trpc + react: 18.2.0 + react-dom: 18.2.0_react@18.2.0 + superjson: 1.12.2 + zod: 3.19.1 + devDependencies: + '@types/node': 18.11.9 + '@types/react': 18.0.25 + '@types/react-dom': 18.0.8 + '@vitejs/plugin-react': 3.0.1_vite@3.2.3 + vite: 3.2.3_@types+node@18.11.9 + vite-plugin-electron: 0.11.1 + packages/electron-trpc: specifiers: '@tanstack/react-query': ^4.8.0 @@ -1881,7 +1918,6 @@ packages: engines: {node: '>=12.13'} dependencies: is-what: 4.1.8 - dev: true /cross-spawn/5.1.0: resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} @@ -2936,7 +2972,6 @@ packages: /is-what/4.1.8: resolution: {integrity: sha512-yq8gMao5upkPoGEU9LsB2P+K3Kt8Q3fQFCGyNCWOAnJAMzEXVV9drYb0TXr42TTliLLhKIBvulgAXgtLLnwzGA==} engines: {node: '>=12.13'} - dev: true /is-windows/1.0.2: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} @@ -3973,7 +4008,6 @@ packages: engines: {node: '>=10'} dependencies: copy-anything: 3.0.3 - dev: true /supports-color/5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} @@ -4269,7 +4303,7 @@ packages: dependencies: '@types/node': 18.11.9 esbuild: 0.15.13 - postcss: 8.4.19 + postcss: 8.4.21 resolve: 1.22.1 rollup: 2.79.1 optionalDependencies: From 158520d6615a6df6502b59fe1fcb6e20de28731e Mon Sep 17 00:00:00 2001 From: Jason Nall Date: Fri, 14 Apr 2023 11:52:45 -0400 Subject: [PATCH 4/5] Merge CHANGELOG. --- CHANGELOG.md | 49 ----------------------------- packages/electron-trpc/CHANGELOG.md | 48 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 49 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 2cd12ed8..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,49 +0,0 @@ -# electron-trpc - -## 0.2.0-next.2 - -### Patch Changes - -- [#26](https://github.com/jsonnull/electron-trpc/pull/26) [`073eecb`](https://github.com/jsonnull/electron-trpc/commit/073eecb504917ad7e8865a8f904827ca0a4ca2ba) Thanks [@jsonnull](https://github.com/jsonnull)! - Fix server import from ipcLink. - -## 0.2.0-next.1 - -### Patch Changes - -- [#24](https://github.com/jsonnull/electron-trpc/pull/24) [`eba2b98`](https://github.com/jsonnull/electron-trpc/commit/eba2b98506bcf4590a3689397f445a0443fa9188) Thanks [@jsonnull](https://github.com/jsonnull)! - Set minimum version for electron peer dependency. - -## 0.2.0-next.0 - -### Minor Changes - -- [`d392431`](https://github.com/jsonnull/electron-trpc/commit/d39243176897dd7cd209d768db68dc90cab92c58) Thanks [@jsonnull](https://github.com/jsonnull)! - Move to tRPC v10. - -## 0.1.0 - -### Minor Changes - -- [#17](https://github.com/jsonnull/electron-trpc/pull/17) [`1dc8ac3`](https://github.com/jsonnull/electron-trpc/commit/1dc8ac3e3f54b471beb8bef6dea4fce4efafe5b4) Thanks [@jsonnull](https://github.com/jsonnull)! - Upgrade tRPC. - -## 0.0.4 - -### Patch Changes - -- [#14](https://github.com/jsonnull/electron-trpc/pull/14) [`e314c71`](https://github.com/jsonnull/electron-trpc/commit/e314c715f5b2734c357a564d23b5717089adb7ef) Thanks [@jsonnull](https://github.com/jsonnull)! - Make createContext param optional. - -## 0.0.3 - -### Patch Changes - -- [#10](https://github.com/jsonnull/electron-trpc/pull/10) [`357842e`](https://github.com/jsonnull/electron-trpc/commit/357842e81a8db0d089095a0cb91aa5b647c230d0) Thanks [@jsonnull](https://github.com/jsonnull)! - Update API for `exposeElectronTRPC`. - -## 0.0.2 - -### Patch Changes - -- [#8](https://github.com/jsonnull/electron-trpc/pull/8) [`50e4718`](https://github.com/jsonnull/electron-trpc/commit/50e4718d75803a5f2ed4675cfc42f713d3dff62b) Thanks [@jsonnull](https://github.com/jsonnull)! - Update docs and package description. - -## 0.0.1 - -### Patch Changes - -- [#2](https://github.com/jsonnull/electron-trpc/pull/2) [`693b1e0`](https://github.com/jsonnull/electron-trpc/commit/693b1e0e30d06c2cba6b1745967e1b3c38f3ed91) Thanks [@jsonnull](https://github.com/jsonnull)! - Initial version diff --git a/packages/electron-trpc/CHANGELOG.md b/packages/electron-trpc/CHANGELOG.md index 4b820033..bd3afa2c 100644 --- a/packages/electron-trpc/CHANGELOG.md +++ b/packages/electron-trpc/CHANGELOG.md @@ -103,3 +103,51 @@ ### Patch Changes - [#29](https://github.com/jsonnull/electron-trpc/pull/29) [`6d5ef0a`](https://github.com/jsonnull/electron-trpc/commit/6d5ef0a0265957f322b91daebdd3e851f61f1333) Thanks [@jsonnull](https://github.com/jsonnull)! - Fix transformer path. + +## 0.2.0-next.2 + +### Patch Changes + +- [#26](https://github.com/jsonnull/electron-trpc/pull/26) [`073eecb`](https://github.com/jsonnull/electron-trpc/commit/073eecb504917ad7e8865a8f904827ca0a4ca2ba) Thanks [@jsonnull](https://github.com/jsonnull)! - Fix server import from ipcLink. + +## 0.2.0-next.1 + +### Patch Changes + +- [#24](https://github.com/jsonnull/electron-trpc/pull/24) [`eba2b98`](https://github.com/jsonnull/electron-trpc/commit/eba2b98506bcf4590a3689397f445a0443fa9188) Thanks [@jsonnull](https://github.com/jsonnull)! - Set minimum version for electron peer dependency. + +## 0.2.0-next.0 + +### Minor Changes + +- [`d392431`](https://github.com/jsonnull/electron-trpc/commit/d39243176897dd7cd209d768db68dc90cab92c58) Thanks [@jsonnull](https://github.com/jsonnull)! - Move to tRPC v10. + +## 0.1.0 + +### Minor Changes + +- [#17](https://github.com/jsonnull/electron-trpc/pull/17) [`1dc8ac3`](https://github.com/jsonnull/electron-trpc/commit/1dc8ac3e3f54b471beb8bef6dea4fce4efafe5b4) Thanks [@jsonnull](https://github.com/jsonnull)! - Upgrade tRPC. + +## 0.0.4 + +### Patch Changes + +- [#14](https://github.com/jsonnull/electron-trpc/pull/14) [`e314c71`](https://github.com/jsonnull/electron-trpc/commit/e314c715f5b2734c357a564d23b5717089adb7ef) Thanks [@jsonnull](https://github.com/jsonnull)! - Make createContext param optional. + +## 0.0.3 + +### Patch Changes + +- [#10](https://github.com/jsonnull/electron-trpc/pull/10) [`357842e`](https://github.com/jsonnull/electron-trpc/commit/357842e81a8db0d089095a0cb91aa5b647c230d0) Thanks [@jsonnull](https://github.com/jsonnull)! - Update API for `exposeElectronTRPC`. + +## 0.0.2 + +### Patch Changes + +- [#8](https://github.com/jsonnull/electron-trpc/pull/8) [`50e4718`](https://github.com/jsonnull/electron-trpc/commit/50e4718d75803a5f2ed4675cfc42f713d3dff62b) Thanks [@jsonnull](https://github.com/jsonnull)! - Update docs and package description. + +## 0.0.1 + +### Patch Changes + +- [#2](https://github.com/jsonnull/electron-trpc/pull/2) [`693b1e0`](https://github.com/jsonnull/electron-trpc/commit/693b1e0e30d06c2cba6b1745967e1b3c38f3ed91) Thanks [@jsonnull](https://github.com/jsonnull)! - Initial version From 260f408ce5b9fdb8c94662e2dd63ce1c8ed2df47 Mon Sep 17 00:00:00 2001 From: Jason Nall Date: Fri, 14 Apr 2023 11:56:31 -0400 Subject: [PATCH 5/5] Add changeset. --- .changeset/red-pandas-behave.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/red-pandas-behave.md diff --git a/.changeset/red-pandas-behave.md b/.changeset/red-pandas-behave.md new file mode 100644 index 00000000..80e7625d --- /dev/null +++ b/.changeset/red-pandas-behave.md @@ -0,0 +1,7 @@ +--- +'electron-trpc': patch +--- + +Fix transforms not running for subscriptions. + +pr: 125