@pluv/types 0.18.0 → 0.20.0

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@0.18.0 build /home/runner/work/pluv/pluv/packages/types
2
+ > @pluv/types@0.20.0 build /home/runner/work/pluv/pluv/packages/types
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.0.2
8
- CLI Target: es6
9
- ESM Build start
10
- CJS Build start
11
- ESM dist/index.mjs 0 B
12
- ESM ⚡️ Build success in 27ms
13
- CJS dist/index.js 754.00 B
14
- CJS ⚡️ Build success in 27ms
15
- DTS Build start
16
- DTS ⚡️ Build success in 889ms
17
- DTS dist/index.d.mts 7.31 KB
18
- DTS dist/index.d.ts 7.31 KB
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.1.0
8
+ CLI Target: es6
9
+ ESM Build start
10
+ CJS Build start
11
+ CJS dist/index.js 754.00 B
12
+ CJS ⚡️ Build success in 27ms
13
+ ESM dist/index.mjs 0 B
14
+ ESM ⚡️ Build success in 28ms
15
+ DTS Build start
16
+ DTS ⚡️ Build success in 807ms
17
+ DTS dist/index.d.mts 7.35 KB
18
+ DTS dist/index.d.ts 7.35 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @pluv/types
2
2
 
3
+ ## 0.20.0
4
+
5
+ ## 0.19.0
6
+
3
7
  ## 0.18.0
4
8
 
5
9
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
1
  type Constructable = {
2
2
  new (...args: any[]): any;
3
3
  };
4
- type Maybe<T> = T | null | undefined;
4
+ type Maybe<T> = T | Nil;
5
5
  type MaybePromise<T> = Promise<T> | T;
6
6
  type MaybeReadonlyArray<T> = T[] | readonly T[];
7
+ type Nil = null | undefined;
7
8
  type OptionalPropertyNames<T> = {
8
9
  [K in keyof T]-?: {} extends {
9
10
  [P in K]: T[K];
@@ -12,9 +13,9 @@ type OptionalPropertyNames<T> = {
12
13
  type SpreadProperties<L, R, K extends keyof L & keyof R> = {
13
14
  [P in K]: L[P] | Exclude<R[P], undefined>;
14
15
  };
15
- type Id<T> = T extends infer U ? (U extends Constructable ? U : {
16
+ type Id<T> = T extends Nil ? T : T extends infer U ? U extends Constructable ? U : {
16
17
  [K in keyof U]: U[K];
17
- }) : never;
18
+ } : never;
18
19
  type SpreadTwo<L, R> = Id<Pick<L, Exclude<keyof L, keyof R>> & Pick<R, Exclude<keyof R, OptionalPropertyNames<R>>> & Pick<R, Exclude<OptionalPropertyNames<R>, keyof L>> & SpreadProperties<L, R, OptionalPropertyNames<R> & keyof L>>;
19
20
  type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R] ? SpreadTwo<L, Spread<R>> : unknown;
20
21
  type DeepPartial<T> = {
@@ -65,13 +66,13 @@ interface BaseIOAuthorizeEventRecord<TAuthorize extends IOAuthorize<any, any, an
65
66
  connectionId: string;
66
67
  presence: JsonObject | null;
67
68
  room: string | null;
68
- user: InferIOAuthorizeUser<TAuthorize>;
69
+ user: Id<InferIOAuthorizeUser<TAuthorize>>;
69
70
  };
70
71
  };
71
72
  };
72
73
  $USER_JOINED: {
73
74
  connectionId: string;
74
- user: NonNullable<InferIOAuthorizeUser<TAuthorize>>;
75
+ user: NonNullable<Id<InferIOAuthorizeUser<TAuthorize>>>;
75
76
  presence: JsonObject;
76
77
  };
77
78
  }
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  type Constructable = {
2
2
  new (...args: any[]): any;
3
3
  };
4
- type Maybe<T> = T | null | undefined;
4
+ type Maybe<T> = T | Nil;
5
5
  type MaybePromise<T> = Promise<T> | T;
6
6
  type MaybeReadonlyArray<T> = T[] | readonly T[];
7
+ type Nil = null | undefined;
7
8
  type OptionalPropertyNames<T> = {
8
9
  [K in keyof T]-?: {} extends {
9
10
  [P in K]: T[K];
@@ -12,9 +13,9 @@ type OptionalPropertyNames<T> = {
12
13
  type SpreadProperties<L, R, K extends keyof L & keyof R> = {
13
14
  [P in K]: L[P] | Exclude<R[P], undefined>;
14
15
  };
15
- type Id<T> = T extends infer U ? (U extends Constructable ? U : {
16
+ type Id<T> = T extends Nil ? T : T extends infer U ? U extends Constructable ? U : {
16
17
  [K in keyof U]: U[K];
17
- }) : never;
18
+ } : never;
18
19
  type SpreadTwo<L, R> = Id<Pick<L, Exclude<keyof L, keyof R>> & Pick<R, Exclude<keyof R, OptionalPropertyNames<R>>> & Pick<R, Exclude<OptionalPropertyNames<R>, keyof L>> & SpreadProperties<L, R, OptionalPropertyNames<R> & keyof L>>;
19
20
  type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R] ? SpreadTwo<L, Spread<R>> : unknown;
20
21
  type DeepPartial<T> = {
@@ -65,13 +66,13 @@ interface BaseIOAuthorizeEventRecord<TAuthorize extends IOAuthorize<any, any, an
65
66
  connectionId: string;
66
67
  presence: JsonObject | null;
67
68
  room: string | null;
68
- user: InferIOAuthorizeUser<TAuthorize>;
69
+ user: Id<InferIOAuthorizeUser<TAuthorize>>;
69
70
  };
70
71
  };
71
72
  };
72
73
  $USER_JOINED: {
73
74
  connectionId: string;
74
- user: NonNullable<InferIOAuthorizeUser<TAuthorize>>;
75
+ user: NonNullable<Id<InferIOAuthorizeUser<TAuthorize>>>;
75
76
  presence: JsonObject;
76
77
  };
77
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/types",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "@pluv/io shared types",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "devDependencies": {
19
- "tsup": "^8.0.2",
19
+ "tsup": "^8.1.0",
20
20
  "typescript": "^5.4.5",
21
- "@pluv/tsconfig": "^0.18.0",
22
- "eslint-config-pluv": "^0.18.0"
21
+ "@pluv/tsconfig": "^0.20.0",
22
+ "eslint-config-pluv": "^0.20.0"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/general.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export type Constructable = { new (...args: any[]): any };
2
2
 
3
- export type Maybe<T> = T | null | undefined;
3
+ export type Maybe<T> = T | Nil;
4
4
  export type MaybePromise<T> = Promise<T> | T;
5
5
  export type MaybeReadonlyArray<T> = T[] | readonly T[];
6
+ export type Nil = null | undefined;
6
7
 
7
8
  type OptionalPropertyNames<T> = {
8
9
  [K in keyof T]-?: {} extends { [P in K]: T[K] } ? K : never;
@@ -12,7 +13,15 @@ export type SpreadProperties<L, R, K extends keyof L & keyof R> = {
12
13
  [P in K]: L[P] | Exclude<R[P], undefined>;
13
14
  };
14
15
 
15
- export type Id<T> = T extends infer U ? (U extends Constructable ? U : { [K in keyof U]: U[K] }) : never;
16
+ export type Id<T> = T extends Nil
17
+ ? T
18
+ : T extends infer U
19
+ ? U extends Constructable
20
+ ? U
21
+ : { [K in keyof U]: U[K] }
22
+ : never;
23
+
24
+ export type Primitive = string | number | boolean | null | undefined;
16
25
 
17
26
  type SpreadTwo<L, R> = Id<
18
27
  Pick<L, Exclude<keyof L, keyof R>> &
package/src/pluv.ts CHANGED
@@ -35,13 +35,13 @@ export interface BaseIOAuthorizeEventRecord<TAuthorize extends IOAuthorize<any,
35
35
  connectionId: string;
36
36
  presence: JsonObject | null;
37
37
  room: string | null;
38
- user: InferIOAuthorizeUser<TAuthorize>;
38
+ user: Id<InferIOAuthorizeUser<TAuthorize>>;
39
39
  };
40
40
  };
41
41
  };
42
42
  $USER_JOINED: {
43
43
  connectionId: string;
44
- user: NonNullable<InferIOAuthorizeUser<TAuthorize>>;
44
+ user: NonNullable<Id<InferIOAuthorizeUser<TAuthorize>>>;
45
45
  presence: JsonObject;
46
46
  };
47
47
  }