@pluv/types 2.2.1 → 2.2.3

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.
@@ -1,18 +1,18 @@
1
1
 
2
- > @pluv/types@2.2.1 build /home/runner/work/pluv/pluv/packages/types
2
+ > @pluv/types@2.2.3 build /home/runner/work/pluv/pluv/packages/types
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.4.0
7
+ CLI tsup v8.5.0
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 1.37 KB
12
- CJS ⚡️ Build success in 37ms
13
11
  ESM dist/index.mjs 330.00 B
14
- ESM ⚡️ Build success in 38ms
12
+ ESM ⚡️ Build success in 37ms
13
+ CJS dist/index.js 1.37 KB
14
+ CJS ⚡️ Build success in 36ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 1276ms
16
+ DTS ⚡️ Build success in 1355ms
17
17
  DTS dist/index.d.mts 18.73 KB
18
18
  DTS dist/index.d.ts 18.73 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @pluv/types
2
2
 
3
+ ## 2.2.3
4
+
5
+ ## 2.2.2
6
+
3
7
  ## 2.2.1
4
8
 
5
9
  ## 2.2.0
@@ -26,9 +30,9 @@
26
30
 
27
31
  - af94706: pluv.io is now stable and production ready!
28
32
 
29
- With this v1 release, pluv.io will now follow [semantic versioning](https://semver.org/) with more comprehensive release notes for future changes to the library.
33
+ With this v1 release, pluv.io will now follow [semantic versioning](https://semver.org/) with more comprehensive release notes for future changes to the library.
30
34
 
31
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
35
+ Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
32
36
 
33
37
  ## 0.44.2
34
38
 
@@ -206,95 +210,95 @@
206
210
 
207
211
  - 99b5ca9: ## Breaking Changes
208
212
 
209
- - `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
213
+ - `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
210
214
 
211
- ### Before:
215
+ ### Before:
212
216
 
213
- ```ts
214
- // backend/io.ts
217
+ ```ts
218
+ // backend/io.ts
215
219
 
216
- import { createIO } from "@pluv/io";
217
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
218
- import { z } from "zod";
220
+ import { createIO } from "@pluv/io";
221
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
222
+ import { z } from "zod";
219
223
 
220
- export const io = createIO({
221
- platform: platformNode(),
222
- })
223
- .event("SEND_MESSAGE", {
224
- input: z.object({ message: z.string() }),
225
- resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
224
+ export const io = createIO({
225
+ platform: platformNode(),
226
226
  })
227
- .event("DOUBLE_VALUE", {
228
- input: z.object({ value: z.number() }),
229
- resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
227
+ .event("SEND_MESSAGE", {
228
+ input: z.object({ message: z.string() }),
229
+ resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
230
+ })
231
+ .event("DOUBLE_VALUE", {
232
+ input: z.object({ value: z.number() }),
233
+ resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
234
+ });
235
+
236
+ const Pluv = createPluvHandler({
237
+ io,
238
+ /* ... */
239
+ });
240
+ ```
241
+
242
+ ```ts
243
+ // frontend/pluv.ts
244
+
245
+ import { createClient } from "@pluv/react";
246
+ import type { io } from "../backend/io";
247
+
248
+ const client = createClient<typeof io>({
249
+ /* ... */
250
+ });
251
+ ```
252
+
253
+ ### Now:
254
+
255
+ ```ts
256
+ import { createIO } from "@pluv/io";
257
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
258
+ import { z } from "zod";
259
+
260
+ const io = createIO({
261
+ platform: platformNode(),
262
+ });
263
+
264
+ const router = io.router({
265
+ SEND_MESSAGE: io.procedure
266
+ .input(z.object({ message: z.string() }))
267
+ .broadcast(({ message }) => ({
268
+ RECEIVE_MESSAGE: { message },
269
+ })),
270
+ DOUBLE_VALUE: io.procedure
271
+ .input(z.object({ value: z.number() }))
272
+ .broadcast(({ value }) => ({
273
+ VALUE_DOUBLED: { value: value * 2 },
274
+ })),
230
275
  });
231
276
 
232
- const Pluv = createPluvHandler({
233
- io,
234
- /* ... */
235
- });
236
- ```
237
-
238
- ```ts
239
- // frontend/pluv.ts
240
-
241
- import { createClient } from "@pluv/react";
242
- import type { io } from "../backend/io";
243
-
244
- const client = createClient<typeof io>({
245
- /* ... */
246
- });
247
- ```
248
-
249
- ### Now:
250
-
251
- ```ts
252
- import { createIO } from "@pluv/io";
253
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
254
- import { z } from "zod";
255
-
256
- const io = createIO({
257
- platform: platformNode(),
258
- });
259
-
260
- const router = io.router({
261
- SEND_MESSAGE: io.procedure
262
- .input(z.object({ message: z.string() }))
263
- .broadcast(({ message }) => ({
264
- RECEIVE_MESSAGE: { message },
265
- })),
266
- DOUBLE_VALUE: io.procedure
267
- .input(z.object({ value: z.number() }))
268
- .broadcast(({ value }) => ({
269
- VALUE_DOUBLED: { value: value * 2 },
270
- })),
271
- });
272
-
273
- export const ioServer = io.server({ router });
274
-
275
- const Pluv = createPluvHandler({
276
- io: ioServer, // <- This uses the PluvServer now
277
- /* ... */
278
- });
279
- ```
280
-
281
- ```ts
282
- // frontend/pluv.ts
283
-
284
- import { createClient } from "@pluv/react";
285
- import type { ioServer } from "../backend/io";
286
-
287
- // This users the PluvServer type now
288
- const client = createClient<typeof ioServer>({
289
- /* ... */
290
- });
291
- ```
292
-
293
- - `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
294
-
295
- ```ts
296
- const router = io.mergeRouters(router1, router2);
297
- ```
277
+ export const ioServer = io.server({ router });
278
+
279
+ const Pluv = createPluvHandler({
280
+ io: ioServer, // <- This uses the PluvServer now
281
+ /* ... */
282
+ });
283
+ ```
284
+
285
+ ```ts
286
+ // frontend/pluv.ts
287
+
288
+ import { createClient } from "@pluv/react";
289
+ import type { ioServer } from "../backend/io";
290
+
291
+ // This users the PluvServer type now
292
+ const client = createClient<typeof ioServer>({
293
+ /* ... */
294
+ });
295
+ ```
296
+
297
+ - `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
298
+
299
+ ```ts
300
+ const router = io.mergeRouters(router1, router2);
301
+ ```
298
302
 
299
303
  ## 0.17.3
300
304
 
@@ -309,48 +313,48 @@
309
313
  - 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
310
314
  This allows accessing the `env` in Cloudflare workers.
311
315
 
312
- ```ts
313
- import { createIO } from "@pluv/io";
314
- import { platformCloudflare } from "@pluv/platform-cloudflare";
315
- import { z } from "zod";
316
-
317
- const io = createIO({
318
- authorize: ({ env }) => ({
319
- required: true,
320
- secret: env.PLUV_AUTHORIZE_SECRET,
321
- user: z.object({
322
- id: z.string(),
323
- name: z.string(),
324
- }),
325
- }),
326
- platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
327
- // ...
328
- });
329
- ```
330
-
331
- This also requires that the platform contexts are passed to `io.createToken`.
332
-
333
- ```ts
334
- // If using `platformNode`
335
- await io.createToken({
336
- req, // This `IncomingMessage` is now required
337
- room,
338
- user: {
339
- id: "user_123",
340
- name: "john doe",
341
- },
342
- });
343
-
344
- // If using `platformCloudflare`
345
- await io.createToken({
346
- env, // This env is now required from the handler's fetch function
347
- room,
348
- user: {
349
- id: "user_123",
350
- name: "john doe",
351
- },
352
- });
353
- ```
316
+ ```ts
317
+ import { createIO } from "@pluv/io";
318
+ import { platformCloudflare } from "@pluv/platform-cloudflare";
319
+ import { z } from "zod";
320
+
321
+ const io = createIO({
322
+ authorize: ({ env }) => ({
323
+ required: true,
324
+ secret: env.PLUV_AUTHORIZE_SECRET,
325
+ user: z.object({
326
+ id: z.string(),
327
+ name: z.string(),
328
+ }),
329
+ }),
330
+ platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
331
+ // ...
332
+ });
333
+ ```
334
+
335
+ This also requires that the platform contexts are passed to `io.createToken`.
336
+
337
+ ```ts
338
+ // If using `platformNode`
339
+ await io.createToken({
340
+ req, // This `IncomingMessage` is now required
341
+ room,
342
+ user: {
343
+ id: "user_123",
344
+ name: "john doe",
345
+ },
346
+ });
347
+
348
+ // If using `platformCloudflare`
349
+ await io.createToken({
350
+ env, // This env is now required from the handler's fetch function
351
+ room,
352
+ user: {
353
+ id: "user_123",
354
+ name: "john doe",
355
+ },
356
+ });
357
+ ```
354
358
 
355
359
  ## 0.16.3
356
360
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/types",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "@pluv/io shared types",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -16,11 +16,11 @@
16
16
  "access": "public"
17
17
  },
18
18
  "devDependencies": {
19
- "eslint": "^9.26.0",
20
- "tsup": "^8.4.0",
19
+ "eslint": "^9.27.0",
20
+ "tsup": "^8.5.0",
21
21
  "typescript": "^5.8.3",
22
- "@pluv/tsconfig": "^2.2.1",
23
- "eslint-config-pluv": "^2.2.1"
22
+ "@pluv/tsconfig": "^2.2.3",
23
+ "eslint-config-pluv": "^2.2.3"
24
24
  },
25
25
  "dependencies": {
26
26
  "wonka": "^6.3.5"