@pluv/types 1.0.0 → 1.0.1

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,5 +1,5 @@
1
1
 
2
- > @pluv/types@1.0.0 build /home/runner/work/pluv/pluv/packages/types
2
+ > @pluv/types@1.0.1 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
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 0 B
12
- ESM ⚡️ Build success in 36ms
13
11
  CJS dist/index.js 758.00 B
14
- CJS ⚡️ Build success in 37ms
12
+ CJS ⚡️ Build success in 31ms
13
+ ESM dist/index.mjs 0 B
14
+ ESM ⚡️ Build success in 32ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 749ms
17
- DTS dist/index.d.mts 7.39 KB
18
- DTS dist/index.d.ts 7.39 KB
16
+ DTS ⚡️ Build success in 728ms
17
+ DTS dist/index.d.mts 7.42 KB
18
+ DTS dist/index.d.ts 7.42 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @pluv/types
2
2
 
3
+ ## 1.0.1
4
+
3
5
  ## 1.0.0
4
6
 
5
7
  ### Major Changes
package/dist/index.d.mts CHANGED
@@ -90,6 +90,7 @@ type BaseIOEventRecord<TAuthorize extends IOAuthorize<any, any>> = {
90
90
  $registered: {
91
91
  presence: JsonObject | null;
92
92
  sessionId: string;
93
+ state: string;
93
94
  timers: {
94
95
  presence: number | null;
95
96
  };
package/dist/index.d.ts CHANGED
@@ -90,6 +90,7 @@ type BaseIOEventRecord<TAuthorize extends IOAuthorize<any, any>> = {
90
90
  $registered: {
91
91
  presence: JsonObject | null;
92
92
  sessionId: string;
93
+ state: string;
93
94
  timers: {
94
95
  presence: number | null;
95
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/types",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "@pluv/io shared types",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -19,8 +19,8 @@
19
19
  "eslint": "^9.25.1",
20
20
  "tsup": "^8.4.0",
21
21
  "typescript": "^5.8.3",
22
- "@pluv/tsconfig": "^1.0.0",
23
- "eslint-config-pluv": "^1.0.0"
22
+ "@pluv/tsconfig": "^1.0.1",
23
+ "eslint-config-pluv": "^1.0.1"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/general.ts CHANGED
@@ -30,7 +30,9 @@ type SpreadTwo<L, R> = Id<
30
30
  SpreadProperties<L, R, OptionalPropertyNames<R> & keyof L>
31
31
  >;
32
32
 
33
- export type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R] ? SpreadTwo<L, Spread<R>> : unknown;
33
+ export type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R]
34
+ ? SpreadTwo<L, Spread<R>>
35
+ : unknown;
34
36
 
35
37
  export type DeepPartial<T> = {
36
38
  [P in keyof T]?: T[P] extends Array<infer U>
@@ -63,6 +65,8 @@ export type JsonObject = Record<string, Json>;
63
65
 
64
66
  export type StringLiteral<T> = T extends string ? (string extends T ? never : T) : never;
65
67
 
66
- export type UnionToIntersection<U> = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void
68
+ export type UnionToIntersection<U> = (U extends any ? (arg: U) => any : never) extends (
69
+ arg: infer I,
70
+ ) => void
67
71
  ? I
68
72
  : never;
package/src/pluv.ts CHANGED
@@ -49,6 +49,7 @@ export type BaseIOEventRecord<TAuthorize extends IOAuthorize<any, any>> = {
49
49
  $registered: {
50
50
  presence: JsonObject | null;
51
51
  sessionId: string;
52
+ state: string;
52
53
  timers: { presence: number | null };
53
54
  };
54
55
  $storageReceived: {
@@ -77,11 +78,13 @@ export type EventRecord<TEvent extends string, TData extends JsonObject> = {
77
78
  [key in `${TEvent}`]: TData;
78
79
  };
79
80
 
80
- export type GetEventMessage<T extends EventRecord<string, any>, TEvent extends keyof T> = TEvent extends string
81
- ? EventMessage<TEvent, T[TEvent]>
82
- : never;
81
+ export type GetEventMessage<
82
+ T extends EventRecord<string, any>,
83
+ TEvent extends keyof T,
84
+ > = TEvent extends string ? EventMessage<TEvent, T[TEvent]> : never;
83
85
 
84
- export type InferIOAuthorize<TIO extends IOLike<any, any>> = TIO extends IOLike<infer IAuthorize> ? IAuthorize : never;
86
+ export type InferIOAuthorize<TIO extends IOLike<any, any>> =
87
+ TIO extends IOLike<infer IAuthorize> ? IAuthorize : never;
85
88
 
86
89
  export type InferIOAuthorizeUser<TAuthorize extends IOAuthorize<any, any> | null> =
87
90
  TAuthorize extends IOAuthorize<infer IUser, any> ? IUser : null;
@@ -90,7 +93,10 @@ export type InputZodLike<TData extends JsonObject> = {
90
93
  parse: (data: unknown) => TData;
91
94
  } & ({ _input: TData } | { _zod: { input: TData } });
92
95
 
93
- export type IOAuthorize<TUser extends BaseUser | null = any, TContext extends Record<string, unknown> = {}> =
96
+ export type IOAuthorize<
97
+ TUser extends BaseUser | null = any,
98
+ TContext extends Record<string, unknown> = {},
99
+ > =
94
100
  | (TUser extends BaseUser
95
101
  ? {
96
102
  secret?: string;
@@ -109,9 +115,14 @@ export type IOAuthorizeEventMessage<TIO extends IOLike> = {
109
115
  user: InferIOAuthorizeUser<InferIOAuthorize<TIO>>;
110
116
  };
111
117
 
112
- export type ProcedureLike<TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = {
118
+ export type ProcedureLike<
119
+ TInput extends JsonObject = {},
120
+ TOutput extends EventRecord<string, any> = {},
121
+ > = {
113
122
  config: {
114
- broadcast?: ((data: TInput, ...args: any[]) => MaybePromise<Partial<TOutput> | void>) | null;
123
+ broadcast?:
124
+ | ((data: TInput, ...args: any[]) => MaybePromise<Partial<TOutput> | void>)
125
+ | null;
115
126
  input?: InputZodLike<TInput> | null;
116
127
  resolver: (data: TInput, ...args: any[]) => MaybePromise<TOutput>;
117
128
  self?: ((data: TInput, ...args: any[]) => MaybePromise<Partial<TOutput> | void>) | null;
@@ -139,11 +150,14 @@ export type InferEventsInput<TEvents extends Record<string, ProcedureLike<any, a
139
150
  [P in keyof TEvents]: TEvents[P] extends ProcedureLike<infer IInput, any> ? IInput : never;
140
151
  };
141
152
 
142
- export type InferEventsOutput<TEvents extends Record<string, ProcedureLike<any, any>>> = UnionToIntersection<
143
- {
144
- [P in keyof TEvents]: TEvents[P] extends ProcedureLike<any, infer IOutput> ? IOutput : never;
145
- }[keyof TEvents]
146
- >;
153
+ export type InferEventsOutput<TEvents extends Record<string, ProcedureLike<any, any>>> =
154
+ UnionToIntersection<
155
+ {
156
+ [P in keyof TEvents]: TEvents[P] extends ProcedureLike<any, infer IOutput>
157
+ ? IOutput
158
+ : never;
159
+ }[keyof TEvents]
160
+ >;
147
161
 
148
162
  export type InferIOInput<TRouter extends IORouterLike<any>> =
149
163
  TRouter extends IORouterLike<infer IEvents> ? InferEventsInput<IEvents> : never;
@@ -151,7 +165,10 @@ export type InferIOInput<TRouter extends IORouterLike<any>> =
151
165
  export type InferIOOutput<TRouter extends IORouterLike<any>> =
152
166
  TRouter extends IORouterLike<infer IEvents> ? InferEventsOutput<IEvents> : never;
153
167
 
154
- export type InferEventMessage<TEvents = EventRecord<string, any>, TEvent extends keyof TEvents = keyof TEvents> =
168
+ export type InferEventMessage<
169
+ TEvents = EventRecord<string, any>,
170
+ TEvent extends keyof TEvents = keyof TEvents,
171
+ > =
155
172
  TEvents extends EventRecord<string, any>
156
173
  ? { [P in TEvent]: P extends string ? Id<EventMessage<P, TEvents[P]>> : never }[TEvent]
157
174
  : never;