@pluv/types 5.0.0 → 5.0.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/dist/index.d.mts +19 -20
- package/dist/index.d.mts.map +1 -1
- package/package.json +9 -6
- package/.turbo/turbo-build.log +0 -13
- package/CHANGELOG.md +0 -542
- package/eslint.config.mjs +0 -4
- package/src/general.ts +0 -90
- package/src/index.ts +0 -82
- package/src/pluv/crdt.ts +0 -82
- package/src/pluv/enums.ts +0 -18
- package/src/pluv/index.ts +0 -4
- package/src/pluv/room.ts +0 -238
- package/src/pluv/shared.ts +0 -243
- package/tsconfig.json +0 -10
- package/tsdown.config.ts +0 -14
package/CHANGELOG.md
DELETED
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
# @pluv/types
|
|
2
|
-
|
|
3
|
-
## 5.0.0
|
|
4
|
-
|
|
5
|
-
## 4.1.0
|
|
6
|
-
|
|
7
|
-
## 4.0.2
|
|
8
|
-
|
|
9
|
-
### Patch Changes
|
|
10
|
-
|
|
11
|
-
- e1913b3: Upgraded internal dependencies
|
|
12
|
-
|
|
13
|
-
## 4.0.1
|
|
14
|
-
|
|
15
|
-
## 4.0.0
|
|
16
|
-
|
|
17
|
-
### Major Changes
|
|
18
|
-
|
|
19
|
-
- df5c39c: Update all packages to be ESM only.
|
|
20
|
-
|
|
21
|
-
### Minor Changes
|
|
22
|
-
|
|
23
|
-
- 037074e: Migrated build process from tsup to tsdown.
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- 2eb5def: Bumped dependencies.
|
|
28
|
-
|
|
29
|
-
## 3.2.2
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- 8665dbe: Updated types of `createClient` so that the types inferred from `createClient` are flattened and no-longer depend on `@pluv/server`.
|
|
34
|
-
|
|
35
|
-
## 3.2.1
|
|
36
|
-
|
|
37
|
-
## 3.2.0
|
|
38
|
-
|
|
39
|
-
## 3.1.7
|
|
40
|
-
|
|
41
|
-
## 3.1.6
|
|
42
|
-
|
|
43
|
-
## 3.1.5
|
|
44
|
-
|
|
45
|
-
## 3.1.4
|
|
46
|
-
|
|
47
|
-
## 3.1.3
|
|
48
|
-
|
|
49
|
-
## 3.1.2
|
|
50
|
-
|
|
51
|
-
## 3.1.1
|
|
52
|
-
|
|
53
|
-
## 3.1.0
|
|
54
|
-
|
|
55
|
-
## 3.0.0
|
|
56
|
-
|
|
57
|
-
## 2.3.1
|
|
58
|
-
|
|
59
|
-
## 2.3.0
|
|
60
|
-
|
|
61
|
-
## 2.2.8
|
|
62
|
-
|
|
63
|
-
## 2.2.7
|
|
64
|
-
|
|
65
|
-
## 2.2.6
|
|
66
|
-
|
|
67
|
-
## 2.2.5
|
|
68
|
-
|
|
69
|
-
## 2.2.4
|
|
70
|
-
|
|
71
|
-
## 2.2.3
|
|
72
|
-
|
|
73
|
-
## 2.2.2
|
|
74
|
-
|
|
75
|
-
## 2.2.1
|
|
76
|
-
|
|
77
|
-
## 2.2.0
|
|
78
|
-
|
|
79
|
-
## 2.1.0
|
|
80
|
-
|
|
81
|
-
## 2.0.2
|
|
82
|
-
|
|
83
|
-
## 2.0.1
|
|
84
|
-
|
|
85
|
-
## 2.0.0
|
|
86
|
-
|
|
87
|
-
### Patch Changes
|
|
88
|
-
|
|
89
|
-
- 047a1d8: Moved several internal types to `@pluv/types`.
|
|
90
|
-
|
|
91
|
-
## 1.0.2
|
|
92
|
-
|
|
93
|
-
## 1.0.1
|
|
94
|
-
|
|
95
|
-
## 1.0.0
|
|
96
|
-
|
|
97
|
-
### Major Changes
|
|
98
|
-
|
|
99
|
-
- af94706: pluv.io is now stable and production ready!
|
|
100
|
-
|
|
101
|
-
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.
|
|
102
|
-
|
|
103
|
-
Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
|
|
104
|
-
|
|
105
|
-
## 0.44.2
|
|
106
|
-
|
|
107
|
-
## 0.44.1
|
|
108
|
-
|
|
109
|
-
## 0.44.0
|
|
110
|
-
|
|
111
|
-
## 0.43.0
|
|
112
|
-
|
|
113
|
-
## 0.42.0
|
|
114
|
-
|
|
115
|
-
## 0.41.7
|
|
116
|
-
|
|
117
|
-
## 0.41.6
|
|
118
|
-
|
|
119
|
-
## 0.41.5
|
|
120
|
-
|
|
121
|
-
## 0.41.4
|
|
122
|
-
|
|
123
|
-
## 0.41.3
|
|
124
|
-
|
|
125
|
-
## 0.41.2
|
|
126
|
-
|
|
127
|
-
## 0.41.1
|
|
128
|
-
|
|
129
|
-
## 0.41.0
|
|
130
|
-
|
|
131
|
-
## 0.40.2
|
|
132
|
-
|
|
133
|
-
## 0.40.1
|
|
134
|
-
|
|
135
|
-
## 0.40.0
|
|
136
|
-
|
|
137
|
-
## 0.39.1
|
|
138
|
-
|
|
139
|
-
## 0.39.0
|
|
140
|
-
|
|
141
|
-
## 0.38.14
|
|
142
|
-
|
|
143
|
-
## 0.38.13
|
|
144
|
-
|
|
145
|
-
## 0.38.12
|
|
146
|
-
|
|
147
|
-
## 0.38.11
|
|
148
|
-
|
|
149
|
-
## 0.38.10
|
|
150
|
-
|
|
151
|
-
## 0.38.9
|
|
152
|
-
|
|
153
|
-
## 0.38.8
|
|
154
|
-
|
|
155
|
-
## 0.38.7
|
|
156
|
-
|
|
157
|
-
## 0.38.6
|
|
158
|
-
|
|
159
|
-
## 0.38.5
|
|
160
|
-
|
|
161
|
-
## 0.38.4
|
|
162
|
-
|
|
163
|
-
## 0.38.3
|
|
164
|
-
|
|
165
|
-
## 0.38.2
|
|
166
|
-
|
|
167
|
-
## 0.38.1
|
|
168
|
-
|
|
169
|
-
## 0.38.0
|
|
170
|
-
|
|
171
|
-
### Minor Changes
|
|
172
|
-
|
|
173
|
-
- f4ceca3: Updated internal event names to follow a new naming convention.
|
|
174
|
-
|
|
175
|
-
## 0.37.7
|
|
176
|
-
|
|
177
|
-
## 0.37.6
|
|
178
|
-
|
|
179
|
-
## 0.37.5
|
|
180
|
-
|
|
181
|
-
## 0.37.4
|
|
182
|
-
|
|
183
|
-
## 0.37.3
|
|
184
|
-
|
|
185
|
-
## 0.37.2
|
|
186
|
-
|
|
187
|
-
## 0.37.1
|
|
188
|
-
|
|
189
|
-
## 0.37.0
|
|
190
|
-
|
|
191
|
-
## 0.36.0
|
|
192
|
-
|
|
193
|
-
## 0.35.4
|
|
194
|
-
|
|
195
|
-
## 0.35.3
|
|
196
|
-
|
|
197
|
-
## 0.35.2
|
|
198
|
-
|
|
199
|
-
### Patch Changes
|
|
200
|
-
|
|
201
|
-
- 81cb692: Fixed type inference of the `authorize` option in `createIO` when used as a function.
|
|
202
|
-
|
|
203
|
-
## 0.35.1
|
|
204
|
-
|
|
205
|
-
## 0.35.0
|
|
206
|
-
|
|
207
|
-
## 0.34.1
|
|
208
|
-
|
|
209
|
-
## 0.34.0
|
|
210
|
-
|
|
211
|
-
## 0.33.0
|
|
212
|
-
|
|
213
|
-
## 0.32.9
|
|
214
|
-
|
|
215
|
-
## 0.32.8
|
|
216
|
-
|
|
217
|
-
## 0.32.7
|
|
218
|
-
|
|
219
|
-
## 0.32.6
|
|
220
|
-
|
|
221
|
-
## 0.32.5
|
|
222
|
-
|
|
223
|
-
## 0.32.4
|
|
224
|
-
|
|
225
|
-
## 0.32.3
|
|
226
|
-
|
|
227
|
-
## 0.32.2
|
|
228
|
-
|
|
229
|
-
## 0.32.1
|
|
230
|
-
|
|
231
|
-
## 0.32.0
|
|
232
|
-
|
|
233
|
-
## 0.31.0
|
|
234
|
-
|
|
235
|
-
## 0.30.2
|
|
236
|
-
|
|
237
|
-
## 0.30.1
|
|
238
|
-
|
|
239
|
-
## 0.30.0
|
|
240
|
-
|
|
241
|
-
## 0.29.0
|
|
242
|
-
|
|
243
|
-
## 0.28.0
|
|
244
|
-
|
|
245
|
-
## 0.27.0
|
|
246
|
-
|
|
247
|
-
## 0.26.0
|
|
248
|
-
|
|
249
|
-
## 0.25.4
|
|
250
|
-
|
|
251
|
-
## 0.25.3
|
|
252
|
-
|
|
253
|
-
## 0.25.2
|
|
254
|
-
|
|
255
|
-
## 0.25.1
|
|
256
|
-
|
|
257
|
-
## 0.25.0
|
|
258
|
-
|
|
259
|
-
## 0.24.1
|
|
260
|
-
|
|
261
|
-
## 0.24.0
|
|
262
|
-
|
|
263
|
-
## 0.23.0
|
|
264
|
-
|
|
265
|
-
## 0.22.0
|
|
266
|
-
|
|
267
|
-
## 0.21.1
|
|
268
|
-
|
|
269
|
-
## 0.21.0
|
|
270
|
-
|
|
271
|
-
## 0.20.0
|
|
272
|
-
|
|
273
|
-
## 0.19.0
|
|
274
|
-
|
|
275
|
-
## 0.18.0
|
|
276
|
-
|
|
277
|
-
### Minor Changes
|
|
278
|
-
|
|
279
|
-
- 99b5ca9: ## Breaking Changes
|
|
280
|
-
- `@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.
|
|
281
|
-
|
|
282
|
-
### Before:
|
|
283
|
-
|
|
284
|
-
```ts
|
|
285
|
-
// backend/io.ts
|
|
286
|
-
|
|
287
|
-
import { createIO } from "@pluv/io";
|
|
288
|
-
import { createPluvHandler, platformNode } from "@pluv/platform-node";
|
|
289
|
-
import { z } from "zod";
|
|
290
|
-
|
|
291
|
-
export const io = createIO({
|
|
292
|
-
platform: platformNode(),
|
|
293
|
-
})
|
|
294
|
-
.event("SEND_MESSAGE", {
|
|
295
|
-
input: z.object({ message: z.string() }),
|
|
296
|
-
resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
|
|
297
|
-
})
|
|
298
|
-
.event("DOUBLE_VALUE", {
|
|
299
|
-
input: z.object({ value: z.number() }),
|
|
300
|
-
resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
const Pluv = createPluvHandler({
|
|
304
|
-
io,
|
|
305
|
-
/* ... */
|
|
306
|
-
});
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
```ts
|
|
310
|
-
// frontend/pluv.ts
|
|
311
|
-
|
|
312
|
-
import { createClient } from "@pluv/react";
|
|
313
|
-
import type { io } from "../backend/io";
|
|
314
|
-
|
|
315
|
-
const client = createClient<typeof io>({
|
|
316
|
-
/* ... */
|
|
317
|
-
});
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### Now:
|
|
321
|
-
|
|
322
|
-
```ts
|
|
323
|
-
import { createIO } from "@pluv/io";
|
|
324
|
-
import { createPluvHandler, platformNode } from "@pluv/platform-node";
|
|
325
|
-
import { z } from "zod";
|
|
326
|
-
|
|
327
|
-
const io = createIO({
|
|
328
|
-
platform: platformNode(),
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
const router = io.router({
|
|
332
|
-
SEND_MESSAGE: io.procedure
|
|
333
|
-
.input(z.object({ message: z.string() }))
|
|
334
|
-
.broadcast(({ message }) => ({
|
|
335
|
-
RECEIVE_MESSAGE: { message },
|
|
336
|
-
})),
|
|
337
|
-
DOUBLE_VALUE: io.procedure
|
|
338
|
-
.input(z.object({ value: z.number() }))
|
|
339
|
-
.broadcast(({ value }) => ({
|
|
340
|
-
VALUE_DOUBLED: { value: value * 2 },
|
|
341
|
-
})),
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
export const ioServer = io.server({ router });
|
|
345
|
-
|
|
346
|
-
const Pluv = createPluvHandler({
|
|
347
|
-
io: ioServer, // <- This uses the PluvServer now
|
|
348
|
-
/* ... */
|
|
349
|
-
});
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
```ts
|
|
353
|
-
// frontend/pluv.ts
|
|
354
|
-
|
|
355
|
-
import { createClient } from "@pluv/react";
|
|
356
|
-
import type { ioServer } from "../backend/io";
|
|
357
|
-
|
|
358
|
-
// This users the PluvServer type now
|
|
359
|
-
const client = createClient<typeof ioServer>({
|
|
360
|
-
/* ... */
|
|
361
|
-
});
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
- `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:
|
|
365
|
-
|
|
366
|
-
```ts
|
|
367
|
-
const router = io.mergeRouters(router1, router2);
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
## 0.17.3
|
|
371
|
-
|
|
372
|
-
## 0.17.2
|
|
373
|
-
|
|
374
|
-
## 0.17.1
|
|
375
|
-
|
|
376
|
-
## 0.17.0
|
|
377
|
-
|
|
378
|
-
### Minor Changes
|
|
379
|
-
|
|
380
|
-
- 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
|
|
381
|
-
This allows accessing the `env` in Cloudflare workers.
|
|
382
|
-
|
|
383
|
-
```ts
|
|
384
|
-
import { createIO } from "@pluv/io";
|
|
385
|
-
import { platformCloudflare } from "@pluv/platform-cloudflare";
|
|
386
|
-
import { z } from "zod";
|
|
387
|
-
|
|
388
|
-
const io = createIO({
|
|
389
|
-
authorize: ({ env }) => ({
|
|
390
|
-
required: true,
|
|
391
|
-
secret: env.PLUV_AUTHORIZE_SECRET,
|
|
392
|
-
user: z.object({
|
|
393
|
-
id: z.string(),
|
|
394
|
-
name: z.string(),
|
|
395
|
-
}),
|
|
396
|
-
}),
|
|
397
|
-
platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
|
|
398
|
-
// ...
|
|
399
|
-
});
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
This also requires that the platform contexts are passed to `io.createToken`.
|
|
403
|
-
|
|
404
|
-
```ts
|
|
405
|
-
// If using `platformNode`
|
|
406
|
-
await io.createToken({
|
|
407
|
-
req, // This `IncomingMessage` is now required
|
|
408
|
-
room,
|
|
409
|
-
user: {
|
|
410
|
-
id: "user_123",
|
|
411
|
-
name: "john doe",
|
|
412
|
-
},
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
// If using `platformCloudflare`
|
|
416
|
-
await io.createToken({
|
|
417
|
-
env, // This env is now required from the handler's fetch function
|
|
418
|
-
room,
|
|
419
|
-
user: {
|
|
420
|
-
id: "user_123",
|
|
421
|
-
name: "john doe",
|
|
422
|
-
},
|
|
423
|
-
});
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
## 0.16.3
|
|
427
|
-
|
|
428
|
-
## 0.16.2
|
|
429
|
-
|
|
430
|
-
## 0.16.1
|
|
431
|
-
|
|
432
|
-
## 0.16.0
|
|
433
|
-
|
|
434
|
-
## 0.15.0
|
|
435
|
-
|
|
436
|
-
## 0.14.1
|
|
437
|
-
|
|
438
|
-
## 0.14.0
|
|
439
|
-
|
|
440
|
-
## 0.13.0
|
|
441
|
-
|
|
442
|
-
## 0.12.3
|
|
443
|
-
|
|
444
|
-
## 0.12.2
|
|
445
|
-
|
|
446
|
-
### Patch Changes
|
|
447
|
-
|
|
448
|
-
- 259a7da: Bumped dependencies
|
|
449
|
-
|
|
450
|
-
## 0.12.1
|
|
451
|
-
|
|
452
|
-
## 0.12.0
|
|
453
|
-
|
|
454
|
-
## 0.11.1
|
|
455
|
-
|
|
456
|
-
## 0.11.0
|
|
457
|
-
|
|
458
|
-
## 0.10.3
|
|
459
|
-
|
|
460
|
-
## 0.10.2
|
|
461
|
-
|
|
462
|
-
## 0.10.1
|
|
463
|
-
|
|
464
|
-
### Patch Changes
|
|
465
|
-
|
|
466
|
-
- 885835d: remove unnecessary dependency
|
|
467
|
-
|
|
468
|
-
## 0.10.0
|
|
469
|
-
|
|
470
|
-
### Minor Changes
|
|
471
|
-
|
|
472
|
-
- f43f1cc: Change packages to all be versioned together for consistency.
|
|
473
|
-
|
|
474
|
-
## 0.2.2
|
|
475
|
-
|
|
476
|
-
### Patch Changes
|
|
477
|
-
|
|
478
|
-
- 8fba48b: fix including incorrect dependency
|
|
479
|
-
- 8997c65: bumped dependencies
|
|
480
|
-
|
|
481
|
-
## 0.2.1
|
|
482
|
-
|
|
483
|
-
### Patch Changes
|
|
484
|
-
|
|
485
|
-
- 8d11672: bumped dependencies to latest
|
|
486
|
-
|
|
487
|
-
## 0.2.0
|
|
488
|
-
|
|
489
|
-
### Minor Changes
|
|
490
|
-
|
|
491
|
-
- bb2886b: allow sending multiple output types (broadcast, self, sync) per event
|
|
492
|
-
- ae679a8: updated offline presence to be set when reconnecting to a room
|
|
493
|
-
|
|
494
|
-
### Patch Changes
|
|
495
|
-
|
|
496
|
-
- 0dd847e: updated storage to be synced when reconnected to the room
|
|
497
|
-
|
|
498
|
-
## 0.1.6
|
|
499
|
-
|
|
500
|
-
### Patch Changes
|
|
501
|
-
|
|
502
|
-
- 850626e: bumped dependencies
|
|
503
|
-
|
|
504
|
-
## 0.1.5
|
|
505
|
-
|
|
506
|
-
### Patch Changes
|
|
507
|
-
|
|
508
|
-
- 74870ee: bumped dependencies
|
|
509
|
-
|
|
510
|
-
## 0.1.4
|
|
511
|
-
|
|
512
|
-
### Patch Changes
|
|
513
|
-
|
|
514
|
-
- 9516a4e: updated typescript to 5.0
|
|
515
|
-
- 7b6da1c: bumped dependencies
|
|
516
|
-
- e9c1514: bumped dependencies
|
|
517
|
-
|
|
518
|
-
## 0.1.3
|
|
519
|
-
|
|
520
|
-
### Patch Changes
|
|
521
|
-
|
|
522
|
-
- 8bf62cb: bumped dependencies
|
|
523
|
-
- 7e52685: Bumped dependencies
|
|
524
|
-
- 8e97fb2: Updated dependencies
|
|
525
|
-
|
|
526
|
-
## 0.1.2
|
|
527
|
-
|
|
528
|
-
### Patch Changes
|
|
529
|
-
|
|
530
|
-
- fe80d7b: added preview disclaimer about breaking changes in the readme
|
|
531
|
-
|
|
532
|
-
## 0.1.1
|
|
533
|
-
|
|
534
|
-
### Patch Changes
|
|
535
|
-
|
|
536
|
-
- 24016e6: Updated dependencies
|
|
537
|
-
|
|
538
|
-
## 0.1.0
|
|
539
|
-
|
|
540
|
-
### Minor Changes
|
|
541
|
-
|
|
542
|
-
- a22f525: Added documentation
|
package/eslint.config.mjs
DELETED
package/src/general.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export type Constructable = { new (...args: any[]): any };
|
|
2
|
-
|
|
3
|
-
export type HasRequiredProperty<T> = {
|
|
4
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
5
|
-
}[keyof T] extends never
|
|
6
|
-
? false
|
|
7
|
-
: true;
|
|
8
|
-
|
|
9
|
-
export type Maybe<T> = T | Nil;
|
|
10
|
-
export type MaybePromise<T> = Promise<T> | T;
|
|
11
|
-
export type MaybeReadonlyArray<T> = T[] | readonly T[];
|
|
12
|
-
export type Nil = null | undefined;
|
|
13
|
-
|
|
14
|
-
type OptionalPropertyNames<T> = {
|
|
15
|
-
[K in keyof T]-?: {} extends { [P in K]: T[K] } ? K : never;
|
|
16
|
-
}[keyof T];
|
|
17
|
-
|
|
18
|
-
export type SpreadProperties<L, R, K extends keyof L & keyof R> = {
|
|
19
|
-
[P in K]: L[P] | Exclude<R[P], undefined>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type Id<T> = T extends Nil
|
|
23
|
-
? T
|
|
24
|
-
: T extends infer U
|
|
25
|
-
? U extends Constructable
|
|
26
|
-
? U
|
|
27
|
-
: { [K in keyof U]: U[K] }
|
|
28
|
-
: never;
|
|
29
|
-
|
|
30
|
-
export type Primitive = string | number | boolean | null | undefined;
|
|
31
|
-
|
|
32
|
-
type SpreadTwo<L, R> = Id<
|
|
33
|
-
Pick<L, Exclude<keyof L, keyof R>> &
|
|
34
|
-
Pick<R, Exclude<keyof R, OptionalPropertyNames<R>>> &
|
|
35
|
-
Pick<R, Exclude<OptionalPropertyNames<R>, keyof L>> &
|
|
36
|
-
SpreadProperties<L, R, OptionalPropertyNames<R> & keyof L>
|
|
37
|
-
>;
|
|
38
|
-
|
|
39
|
-
export type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R]
|
|
40
|
-
? SpreadTwo<L, Spread<R>>
|
|
41
|
-
: unknown;
|
|
42
|
-
|
|
43
|
-
export type DeepPartial<T> = {
|
|
44
|
-
[P in keyof T]?: T[P] extends Array<infer U>
|
|
45
|
-
? Array<DeepPartial<U>>
|
|
46
|
-
: T[P] extends ReadonlyArray<infer U>
|
|
47
|
-
? ReadonlyArray<DeepPartial<U>>
|
|
48
|
-
: DeepPartial<T[P]>;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type DeepWriteable<T> = {
|
|
52
|
-
-readonly [P in keyof T]: DeepWriteable<T[P]>;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type UndefinedProps<T extends Record<string, any>, K extends keyof T = keyof T> = Id<
|
|
56
|
-
{ [P in K]?: undefined } & { [P in Exclude<keyof T, K>]: T[P] }
|
|
57
|
-
>;
|
|
58
|
-
|
|
59
|
-
export type OptionalProps<T extends Record<string, any>, K extends keyof T = keyof T> = Omit<T, K> &
|
|
60
|
-
Partial<Pick<T, K>>;
|
|
61
|
-
|
|
62
|
-
export type NonNilProps<T extends Record<string, any>, K extends keyof T = keyof T> = Omit<T, K> & {
|
|
63
|
-
[P in K]-?: NonNullable<T[P]>;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export type JsonPrimitive = string | number | boolean | null;
|
|
67
|
-
|
|
68
|
-
export type Json = JsonPrimitive | Json[] | readonly Json[] | { [key: string]: Json };
|
|
69
|
-
|
|
70
|
-
export type JsonObject = Record<string, Json>;
|
|
71
|
-
|
|
72
|
-
export type StringLiteral<T> = T extends string ? (string extends T ? never : T) : never;
|
|
73
|
-
|
|
74
|
-
export type UnionToIntersection<U> = (U extends any ? (arg: U) => any : never) extends (
|
|
75
|
-
arg: infer I,
|
|
76
|
-
) => void
|
|
77
|
-
? I
|
|
78
|
-
: never;
|
|
79
|
-
|
|
80
|
-
// Check if all properties in T are optional
|
|
81
|
-
// - If T is {} (no keys), all properties are optional (none exist)
|
|
82
|
-
// - Use HasRequiredProperty which properly handles intersection types
|
|
83
|
-
// - If HasRequiredProperty<T> is false, then all properties are optional
|
|
84
|
-
export type AreAllOptional<T> = [T] extends [{}]
|
|
85
|
-
? keyof T extends never
|
|
86
|
-
? true // T is {} - no properties, so all are "optional" (none exist)
|
|
87
|
-
: HasRequiredProperty<T> extends true
|
|
88
|
-
? false // T has at least one required property
|
|
89
|
-
: true // T has no required properties, so all are optional
|
|
90
|
-
: false;
|
package/src/index.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
AreAllOptional,
|
|
3
|
-
Constructable,
|
|
4
|
-
DeepPartial,
|
|
5
|
-
DeepWriteable,
|
|
6
|
-
HasRequiredProperty,
|
|
7
|
-
Id,
|
|
8
|
-
Json,
|
|
9
|
-
JsonObject,
|
|
10
|
-
JsonPrimitive,
|
|
11
|
-
Maybe,
|
|
12
|
-
MaybePromise,
|
|
13
|
-
MaybeReadonlyArray,
|
|
14
|
-
NonNilProps,
|
|
15
|
-
OptionalProps,
|
|
16
|
-
Spread,
|
|
17
|
-
SpreadProperties,
|
|
18
|
-
UndefinedProps,
|
|
19
|
-
} from "./general";
|
|
20
|
-
export { ConnectionState, StorageState } from "./pluv";
|
|
21
|
-
export type {
|
|
22
|
-
BaseClientEventRecord,
|
|
23
|
-
BaseClientMessage,
|
|
24
|
-
BaseIOEventRecord,
|
|
25
|
-
BaseUser,
|
|
26
|
-
BroadcastProxy,
|
|
27
|
-
CrdtDocFactory,
|
|
28
|
-
CrdtDocLike,
|
|
29
|
-
CrdtLibraryType,
|
|
30
|
-
CrdtType,
|
|
31
|
-
DocApplyEncodedStateParams,
|
|
32
|
-
DocBatchApplyEncodedStateParams,
|
|
33
|
-
DocSubscribeCallbackParams,
|
|
34
|
-
EventMessage,
|
|
35
|
-
EventNotifierSubscriptionCallback,
|
|
36
|
-
EventProxy,
|
|
37
|
-
EventRecord,
|
|
38
|
-
GetEventMessage,
|
|
39
|
-
InferCrdtJson,
|
|
40
|
-
InferEventMessage,
|
|
41
|
-
InferEventsInput,
|
|
42
|
-
InferEventsOutput,
|
|
43
|
-
InferIOAuthorize,
|
|
44
|
-
InferIOAuthorizeUser,
|
|
45
|
-
InferIOCrdt,
|
|
46
|
-
InferIOCrdtKind,
|
|
47
|
-
InferIOEvents,
|
|
48
|
-
InferIOInput,
|
|
49
|
-
InferIOOutput,
|
|
50
|
-
InferIOProcedureInput,
|
|
51
|
-
InferIOProcedureOutput,
|
|
52
|
-
InputZodLike,
|
|
53
|
-
IOAuthorize,
|
|
54
|
-
IOAuthorizeEventMessage,
|
|
55
|
-
IOEventMessage,
|
|
56
|
-
IOLike,
|
|
57
|
-
IORouterLike,
|
|
58
|
-
MergeEvents,
|
|
59
|
-
OthersSubscriptionCallback,
|
|
60
|
-
OthersSubscriptionEvent,
|
|
61
|
-
OthersSubscriptionFn,
|
|
62
|
-
OtherSubscriptionCallback,
|
|
63
|
-
OtherSubscriptionFn,
|
|
64
|
-
PluvRouterEventConfig,
|
|
65
|
-
ProcedureLike,
|
|
66
|
-
RoomEventListenerMap,
|
|
67
|
-
RoomLike,
|
|
68
|
-
StateNotifierSubjects,
|
|
69
|
-
StorageInfo,
|
|
70
|
-
StorageProxy,
|
|
71
|
-
StorageRootSubscriptionCallback,
|
|
72
|
-
StorageRootSubscriptionFn,
|
|
73
|
-
StorageSubscriptionCallback,
|
|
74
|
-
StorageSubscriptionFn,
|
|
75
|
-
SubscribeFn,
|
|
76
|
-
SubscribeProxy,
|
|
77
|
-
SubscriptionCallback,
|
|
78
|
-
UpdateMyPresenceAction,
|
|
79
|
-
UserInfo,
|
|
80
|
-
WebSocketConnection,
|
|
81
|
-
WebSocketState,
|
|
82
|
-
} from "./pluv";
|