@pluv/types 2.2.1 → 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.1 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
11
  CJS dist/index.js 1.37 KB
12
- CJS ⚡️ Build success in 37ms
12
+ CJS ⚡️ Build success in 41ms
13
13
  ESM dist/index.mjs 330.00 B
14
- ESM ⚡️ Build success in 38ms
14
+ ESM ⚡️ Build success in 45ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 1276ms
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,7 @@
1
1
  # @pluv/types
2
2
 
3
+ ## 2.2.2
4
+
3
5
  ## 2.2.1
4
6
 
5
7
  ## 2.2.0
@@ -26,9 +28,9 @@
26
28
 
27
29
  - af94706: pluv.io is now stable and production ready!
28
30
 
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.
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.
30
32
 
31
- 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!
32
34
 
33
35
  ## 0.44.2
34
36
 
@@ -206,95 +208,95 @@
206
208
 
207
209
  - 99b5ca9: ## Breaking Changes
208
210
 
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.
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.
210
212
 
211
- ### Before:
213
+ ### Before:
212
214
 
213
- ```ts
214
- // backend/io.ts
215
+ ```ts
216
+ // backend/io.ts
215
217
 
216
- import { createIO } from "@pluv/io";
217
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
218
- import { z } from "zod";
218
+ import { createIO } from "@pluv/io";
219
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
220
+ import { z } from "zod";
219
221
 
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 } }),
222
+ export const io = createIO({
223
+ platform: platformNode(),
226
224
  })
227
- .event("DOUBLE_VALUE", {
228
- input: z.object({ value: z.number() }),
229
- 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(),
230
260
  });
231
261
 
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
- ```
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
+ })),
273
+ });
274
+
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
+ ```
298
300
 
299
301
  ## 0.17.3
300
302
 
@@ -309,48 +311,48 @@
309
311
  - 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
310
312
  This allows accessing the `env` in Cloudflare workers.
311
313
 
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
- ```
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
+ ```
354
356
 
355
357
  ## 0.16.3
356
358
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/types",
3
- "version": "2.2.1",
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.1",
23
- "eslint-config-pluv": "^2.2.1"
22
+ "@pluv/tsconfig": "^2.2.2",
23
+ "eslint-config-pluv": "^2.2.2"
24
24
  },
25
25
  "dependencies": {
26
26
  "wonka": "^6.3.5"