@spawnco/sdk-types 0.0.6 → 0.0.8

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 CHANGED
@@ -11,7 +11,7 @@ interface SpawnClientSDK__V1 {
11
11
  upgradeGuest(): Promise<void>;
12
12
  };
13
13
  room: {
14
- connect(options: {
14
+ connect(options?: {
15
15
  query?: Record<string, string>;
16
16
  headers?: Record<string, string>;
17
17
  }): Promise<Room>;
@@ -49,9 +49,16 @@ interface SpawnClientSDK__V1 {
49
49
  };
50
50
  }
51
51
  interface SpawnServerSDK__V1 {
52
- room: {
53
- broadcast(type: string, data: any, exclude?: string[]): void;
54
- kick(userId: string): void;
52
+ user: {
53
+ token: {
54
+ verify(token: string): Promise<{
55
+ valid: false;
56
+ } | {
57
+ valid: true;
58
+ user: User;
59
+ expires: Date;
60
+ }>;
61
+ };
55
62
  };
56
63
  economy: {
57
64
  redeemPurchase(token: string): Promise<{
@@ -110,7 +117,7 @@ interface Item {
110
117
  id: string;
111
118
  data?: Record<string, any>;
112
119
  }
113
- type SpawnClientSDK__V0 = Pick<SpawnClientSDK__V1, "user" | "ready" | "room">;
114
- type SpawnServerSDK__V0 = Pick<SpawnServerSDK__V1, "room">;
120
+ type SpawnClientSDK__V0 = Omit<SpawnClientSDK__V1, "economy" | "inventory" | "storage">;
121
+ type SpawnServerSDK__V0 = Omit<SpawnServerSDK__V1, "economy" | "inventory" | "storage" | "room">;
115
122
 
116
123
  export type { Item, Room, RoomInfo, RoomVisibility, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, User };
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ interface SpawnClientSDK__V1 {
11
11
  upgradeGuest(): Promise<void>;
12
12
  };
13
13
  room: {
14
- connect(options: {
14
+ connect(options?: {
15
15
  query?: Record<string, string>;
16
16
  headers?: Record<string, string>;
17
17
  }): Promise<Room>;
@@ -49,9 +49,16 @@ interface SpawnClientSDK__V1 {
49
49
  };
50
50
  }
51
51
  interface SpawnServerSDK__V1 {
52
- room: {
53
- broadcast(type: string, data: any, exclude?: string[]): void;
54
- kick(userId: string): void;
52
+ user: {
53
+ token: {
54
+ verify(token: string): Promise<{
55
+ valid: false;
56
+ } | {
57
+ valid: true;
58
+ user: User;
59
+ expires: Date;
60
+ }>;
61
+ };
55
62
  };
56
63
  economy: {
57
64
  redeemPurchase(token: string): Promise<{
@@ -110,7 +117,7 @@ interface Item {
110
117
  id: string;
111
118
  data?: Record<string, any>;
112
119
  }
113
- type SpawnClientSDK__V0 = Pick<SpawnClientSDK__V1, "user" | "ready" | "room">;
114
- type SpawnServerSDK__V0 = Pick<SpawnServerSDK__V1, "room">;
120
+ type SpawnClientSDK__V0 = Omit<SpawnClientSDK__V1, "economy" | "inventory" | "storage">;
121
+ type SpawnServerSDK__V0 = Omit<SpawnServerSDK__V1, "economy" | "inventory" | "storage" | "room">;
115
122
 
116
123
  export type { Item, Room, RoomInfo, RoomVisibility, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, User };
package/dist/index.js CHANGED
@@ -16,4 +16,3 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // src/index.ts
17
17
  var index_exports = {};
18
18
  module.exports = __toCommonJS(index_exports);
19
- //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spawnco/sdk-types",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "TypeScript type definitions for Spawn SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -17,8 +17,8 @@
17
17
  "src"
18
18
  ],
19
19
  "scripts": {
20
- "build": "tsup",
21
- "dev": "tsup --watch"
20
+ "build": "tsup src/index.ts --dts --format cjs,esm --clean",
21
+ "dev": "tsup src/index.ts --dts --format cjs,esm --watch"
22
22
  },
23
23
  "keywords": [
24
24
  "spawn",
package/src/v1.ts CHANGED
@@ -16,7 +16,7 @@ export interface SpawnClientSDK__V1 {
16
16
 
17
17
  room: {
18
18
  // only one room per game for v1
19
- connect(options: {
19
+ connect(options?: {
20
20
  query?: Record<string, string>;
21
21
  headers?: Record<string, string>;
22
22
  }): Promise<Room>;
@@ -63,9 +63,12 @@ export interface SpawnClientSDK__V1 {
63
63
 
64
64
  // Server SDK - available in Durable Objects
65
65
  export interface SpawnServerSDK__V1 {
66
- room: {
67
- broadcast(type: string, data: any, exclude?: string[]): void;
68
- kick(userId: string): void;
66
+ user: {
67
+ token: {
68
+ verify(
69
+ token: string
70
+ ): Promise<{ valid: false } | { valid: true; user: User; expires: Date }>;
71
+ };
69
72
  };
70
73
 
71
74
  economy: {
@@ -142,8 +145,11 @@ export interface Item {
142
145
 
143
146
  // v0 sdk types for testing
144
147
 
145
- export type SpawnClientSDK__V0 = Pick<
148
+ export type SpawnClientSDK__V0 = Omit<
146
149
  SpawnClientSDK__V1,
147
- "user" | "ready" | "room"
150
+ "economy" | "inventory" | "storage"
151
+ >;
152
+ export type SpawnServerSDK__V0 = Omit<
153
+ SpawnServerSDK__V1,
154
+ "economy" | "inventory" | "storage" | "room"
148
155
  >;
149
- export type SpawnServerSDK__V0 = Pick<SpawnServerSDK__V1, "room">;
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './v1';"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}