@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.
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +128 -126
- package/package.json +5 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/types@2.2.
|
|
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
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.
|
|
7
|
+
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[32mCJS[39m [1mdist/index.js [22m[32m1.37 KB[39m
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 41ms
|
|
13
13
|
[32mESM[39m [1mdist/index.mjs [22m[32m330.00 B[39m
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 45ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1512ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m18.73 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m18.73 KB[39m
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
213
|
+
### Before:
|
|
212
214
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
```ts
|
|
216
|
+
// backend/io.ts
|
|
215
217
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
import { createIO } from "@pluv/io";
|
|
219
|
+
import { createPluvHandler, platformNode } from "@pluv/platform-node";
|
|
220
|
+
import { z } from "zod";
|
|
219
221
|
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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.
|
|
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.
|
|
20
|
-
"tsup": "^8.
|
|
19
|
+
"eslint": "^9.27.0",
|
|
20
|
+
"tsup": "^8.5.0",
|
|
21
21
|
"typescript": "^5.8.3",
|
|
22
|
-
"@pluv/tsconfig": "^2.2.
|
|
23
|
-
"eslint-config-pluv": "^2.2.
|
|
22
|
+
"@pluv/tsconfig": "^2.2.2",
|
|
23
|
+
"eslint-config-pluv": "^2.2.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"wonka": "^6.3.5"
|