@pluv/types 2.2.0 → 2.2.2

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.0 build /home/runner/work/pluv/pluv/packages/types
2
+ > @pluv/types@2.2.2 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
- ESM dist/index.mjs 330.00 B
12
- ESM ⚡️ Build success in 33ms
13
11
  CJS dist/index.js 1.37 KB
14
- CJS ⚡️ Build success in 33ms
12
+ CJS ⚡️ Build success in 41ms
13
+ ESM dist/index.mjs 330.00 B
14
+ ESM ⚡️ Build success in 45ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 1278ms
16
+ DTS ⚡️ Build success in 1512ms
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.2
4
+
5
+ ## 2.2.1
6
+
3
7
  ## 2.2.0
4
8
 
5
9
  ## 2.1.0
@@ -24,9 +28,9 @@
24
28
 
25
29
  - af94706: pluv.io is now stable and production ready!
26
30
 
27
- 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.
31
+ 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.
28
32
 
29
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
33
+ Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
30
34
 
31
35
  ## 0.44.2
32
36
 
@@ -204,95 +208,95 @@
204
208
 
205
209
  - 99b5ca9: ## Breaking Changes
206
210
 
207
- - `@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.
211
+ - `@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.
208
212
 
209
- ### Before:
213
+ ### Before:
210
214
 
211
- ```ts
212
- // backend/io.ts
215
+ ```ts
216
+ // backend/io.ts
213
217
 
214
- import { createIO } from "@pluv/io";
215
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
216
- import { z } from "zod";
218
+ import { createIO } from "@pluv/io";
219
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
220
+ import { z } from "zod";
217
221
 
218
- export const io = createIO({
219
- platform: platformNode(),
220
- })
221
- .event("SEND_MESSAGE", {
222
- input: z.object({ message: z.string() }),
223
- resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
222
+ export const io = createIO({
223
+ platform: platformNode(),
224
224
  })
225
- .event("DOUBLE_VALUE", {
226
- input: z.object({ value: z.number() }),
227
- resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
225
+ .event("SEND_MESSAGE", {
226
+ input: z.object({ message: z.string() }),
227
+ resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
228
+ })
229
+ .event("DOUBLE_VALUE", {
230
+ input: z.object({ value: z.number() }),
231
+ resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
232
+ });
233
+
234
+ const Pluv = createPluvHandler({
235
+ io,
236
+ /* ... */
237
+ });
238
+ ```
239
+
240
+ ```ts
241
+ // frontend/pluv.ts
242
+
243
+ import { createClient } from "@pluv/react";
244
+ import type { io } from "../backend/io";
245
+
246
+ const client = createClient<typeof io>({
247
+ /* ... */
248
+ });
249
+ ```
250
+
251
+ ### Now:
252
+
253
+ ```ts
254
+ import { createIO } from "@pluv/io";
255
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
256
+ import { z } from "zod";
257
+
258
+ const io = createIO({
259
+ platform: platformNode(),
260
+ });
261
+
262
+ const router = io.router({
263
+ SEND_MESSAGE: io.procedure
264
+ .input(z.object({ message: z.string() }))
265
+ .broadcast(({ message }) => ({
266
+ RECEIVE_MESSAGE: { message },
267
+ })),
268
+ DOUBLE_VALUE: io.procedure
269
+ .input(z.object({ value: z.number() }))
270
+ .broadcast(({ value }) => ({
271
+ VALUE_DOUBLED: { value: value * 2 },
272
+ })),
228
273
  });
229
274
 
230
- const Pluv = createPluvHandler({
231
- io,
232
- /* ... */
233
- });
234
- ```
235
-
236
- ```ts
237
- // frontend/pluv.ts
238
-
239
- import { createClient } from "@pluv/react";
240
- import type { io } from "../backend/io";
241
-
242
- const client = createClient<typeof io>({
243
- /* ... */
244
- });
245
- ```
246
-
247
- ### Now:
248
-
249
- ```ts
250
- import { createIO } from "@pluv/io";
251
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
252
- import { z } from "zod";
253
-
254
- const io = createIO({
255
- platform: platformNode(),
256
- });
257
-
258
- const router = io.router({
259
- SEND_MESSAGE: io.procedure
260
- .input(z.object({ message: z.string() }))
261
- .broadcast(({ message }) => ({
262
- RECEIVE_MESSAGE: { message },
263
- })),
264
- DOUBLE_VALUE: io.procedure
265
- .input(z.object({ value: z.number() }))
266
- .broadcast(({ value }) => ({
267
- VALUE_DOUBLED: { value: value * 2 },
268
- })),
269
- });
270
-
271
- export const ioServer = io.server({ router });
272
-
273
- const Pluv = createPluvHandler({
274
- io: ioServer, // <- This uses the PluvServer now
275
- /* ... */
276
- });
277
- ```
278
-
279
- ```ts
280
- // frontend/pluv.ts
281
-
282
- import { createClient } from "@pluv/react";
283
- import type { ioServer } from "../backend/io";
284
-
285
- // This users the PluvServer type now
286
- const client = createClient<typeof ioServer>({
287
- /* ... */
288
- });
289
- ```
290
-
291
- - `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:
292
-
293
- ```ts
294
- const router = io.mergeRouters(router1, router2);
295
- ```
275
+ export const ioServer = io.server({ router });
276
+
277
+ const Pluv = createPluvHandler({
278
+ io: ioServer, // <- This uses the PluvServer now
279
+ /* ... */
280
+ });
281
+ ```
282
+
283
+ ```ts
284
+ // frontend/pluv.ts
285
+
286
+ import { createClient } from "@pluv/react";
287
+ import type { ioServer } from "../backend/io";
288
+
289
+ // This users the PluvServer type now
290
+ const client = createClient<typeof ioServer>({
291
+ /* ... */
292
+ });
293
+ ```
294
+
295
+ - `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:
296
+
297
+ ```ts
298
+ const router = io.mergeRouters(router1, router2);
299
+ ```
296
300
 
297
301
  ## 0.17.3
298
302
 
@@ -307,48 +311,48 @@
307
311
  - 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
308
312
  This allows accessing the `env` in Cloudflare workers.
309
313
 
310
- ```ts
311
- import { createIO } from "@pluv/io";
312
- import { platformCloudflare } from "@pluv/platform-cloudflare";
313
- import { z } from "zod";
314
-
315
- const io = createIO({
316
- authorize: ({ env }) => ({
317
- required: true,
318
- secret: env.PLUV_AUTHORIZE_SECRET,
319
- user: z.object({
320
- id: z.string(),
321
- name: z.string(),
322
- }),
323
- }),
324
- platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
325
- // ...
326
- });
327
- ```
328
-
329
- This also requires that the platform contexts are passed to `io.createToken`.
330
-
331
- ```ts
332
- // If using `platformNode`
333
- await io.createToken({
334
- req, // This `IncomingMessage` is now required
335
- room,
336
- user: {
337
- id: "user_123",
338
- name: "john doe",
339
- },
340
- });
341
-
342
- // If using `platformCloudflare`
343
- await io.createToken({
344
- env, // This env is now required from the handler's fetch function
345
- room,
346
- user: {
347
- id: "user_123",
348
- name: "john doe",
349
- },
350
- });
351
- ```
314
+ ```ts
315
+ import { createIO } from "@pluv/io";
316
+ import { platformCloudflare } from "@pluv/platform-cloudflare";
317
+ import { z } from "zod";
318
+
319
+ const io = createIO({
320
+ authorize: ({ env }) => ({
321
+ required: true,
322
+ secret: env.PLUV_AUTHORIZE_SECRET,
323
+ user: z.object({
324
+ id: z.string(),
325
+ name: z.string(),
326
+ }),
327
+ }),
328
+ platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
329
+ // ...
330
+ });
331
+ ```
332
+
333
+ This also requires that the platform contexts are passed to `io.createToken`.
334
+
335
+ ```ts
336
+ // If using `platformNode`
337
+ await io.createToken({
338
+ req, // This `IncomingMessage` is now required
339
+ room,
340
+ user: {
341
+ id: "user_123",
342
+ name: "john doe",
343
+ },
344
+ });
345
+
346
+ // If using `platformCloudflare`
347
+ await io.createToken({
348
+ env, // This env is now required from the handler's fetch function
349
+ room,
350
+ user: {
351
+ id: "user_123",
352
+ name: "john doe",
353
+ },
354
+ });
355
+ ```
352
356
 
353
357
  ## 0.16.3
354
358
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/types",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
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.0",
23
- "eslint-config-pluv": "^2.2.0"
22
+ "@pluv/tsconfig": "^2.2.2",
23
+ "eslint-config-pluv": "^2.2.2"
24
24
  },
25
25
  "dependencies": {
26
26
  "wonka": "^6.3.5"