@websimai/socket-types 0.0.7 → 0.1.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.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @websimai/socket-types
2
-
3
- Type declarations for the `WebsimSocket` class
1
+ # @websimai/socket-types
2
+
3
+ Type declarations for the `WebsimSocket` class
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  //#region src/types/utils/index.d.ts
2
- type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
3
2
  type KeyValue = Record<string, any>;
4
3
  //#endregion
5
4
  //#region src/types/collection-api.d.ts
5
+ type Prettify<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
6
6
  type BaseData<$Type extends string, Id extends string = string> = {
7
7
  readonly id: Id;
8
8
  readonly $type: $Type;
@@ -10,19 +10,19 @@ type BaseData<$Type extends string, Id extends string = string> = {
10
10
  readonly username: string;
11
11
  };
12
12
  interface CollectionAPI<$Type extends string> {
13
- getList<Data extends KeyValue>(): Expand<Data & BaseData<$Type> & {
13
+ getList<Data extends KeyValue>(): Prettify<Data & BaseData<$Type> & {
14
14
  readonly updated_at: string;
15
15
  readonly user_id: string;
16
16
  }>[];
17
- create<Data extends KeyValue>(data: Data): Promise<Expand<Data & BaseData<$Type>>>;
18
- update<Id extends string, Data extends KeyValue>(id: Id, data: Data): Promise<Expand<Data & BaseData<$Type, Id>>>;
17
+ create<Data extends KeyValue>(data: Data): Promise<Prettify<Data & BaseData<$Type>>>;
18
+ update<Id extends string, Data extends KeyValue>(id: Id, data: Data): Promise<Prettify<Data & BaseData<$Type, Id>>>;
19
19
  upsert<Data extends KeyValue & {
20
20
  id?: Id;
21
- }, Id extends string = string>(data: Data): Promise<Expand<(Data extends {
21
+ }, Id extends string = string>(data: Data): Promise<Prettify<(Data extends {
22
22
  id: Id;
23
23
  } ? Data & KeyValue : Data) & BaseData<$Type, Id>>>;
24
24
  delete(id: string): Promise<void>;
25
- subscribe(callback: (records: Expand<KeyValue & {
25
+ subscribe(callback: (records: Prettify<KeyValue & {
26
26
  id: string;
27
27
  $type: $Type;
28
28
  created_at: string;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {};
package/package.json CHANGED
@@ -1,37 +1,33 @@
1
1
  {
2
2
  "name": "@websimai/socket-types",
3
- "version": "0.0.7",
3
+ "version": "0.1.0",
4
4
  "description": "Type declarations for the `WebsimSocket` class",
5
- "type": "module",
6
- "author": "gameroman",
5
+ "keywords": [
6
+ "types",
7
+ "typescript",
8
+ "websim"
9
+ ],
7
10
  "license": "MIT",
8
- "publishConfig": {
9
- "access": "public"
10
- },
11
+ "author": "gameroman",
11
12
  "repository": {
12
13
  "type": "git",
13
14
  "url": "https://github.com/websimnpm/websim.git",
14
15
  "directory": "packages/socket-types"
15
16
  },
16
- "keywords": [
17
- "websim",
18
- "types",
19
- "typescript"
20
- ],
21
- "scripts": {
22
- "build": "bunx --bun tsdown",
23
- "prepublishOnly": "bun run build"
24
- },
25
17
  "files": [
26
- "dist/**/*",
27
- "README.md"
18
+ "dist"
28
19
  ],
20
+ "type": "module",
29
21
  "types": "./dist/index.d.mts",
30
22
  "exports": {
31
23
  ".": "./dist/index.mjs",
32
24
  "./package.json": "./package.json"
33
25
  },
26
+ "scripts": {
27
+ "build": "bunx --bun tsdown",
28
+ "prepublishOnly": "bun run build"
29
+ },
34
30
  "devDependencies": {
35
- "tsdown": "^0.20.1"
31
+ "tsdown": "^0.21.4"
36
32
  }
37
33
  }