@spawnco/sdk-types 0.0.55 → 0.0.56
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 +28 -2
- package/dist/index.d.ts +28 -2
- package/package.json +1 -1
- package/src/v1.ts +35 -1
package/dist/index.d.mts
CHANGED
|
@@ -35,7 +35,7 @@ type GameSpecMutation = {
|
|
|
35
35
|
key: string;
|
|
36
36
|
value: unknown;
|
|
37
37
|
} | {
|
|
38
|
-
kind: '
|
|
38
|
+
kind: 'replaceState';
|
|
39
39
|
id: string;
|
|
40
40
|
state: Record<string, unknown>;
|
|
41
41
|
} | {
|
|
@@ -51,6 +51,22 @@ interface GameSpecMutationResult {
|
|
|
51
51
|
mutationCount: number;
|
|
52
52
|
updated: boolean;
|
|
53
53
|
}
|
|
54
|
+
interface RoomRegistrationOptions {
|
|
55
|
+
maxPlayers?: number;
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
interface RoomHeartbeatOptions {
|
|
59
|
+
playerCount: number;
|
|
60
|
+
metadata?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
interface RoomPlayerJoinOptions {
|
|
63
|
+
userId: string;
|
|
64
|
+
}
|
|
65
|
+
interface RoomRegistrationResult {
|
|
66
|
+
success: boolean;
|
|
67
|
+
roomId: string;
|
|
68
|
+
appId: string;
|
|
69
|
+
}
|
|
54
70
|
interface ClipThumbnailDescriptor {
|
|
55
71
|
assetUrl: string;
|
|
56
72
|
contentType: string;
|
|
@@ -246,6 +262,16 @@ interface SpawnServerSDK__V1<TConfig = any> {
|
|
|
246
262
|
success: boolean;
|
|
247
263
|
}>;
|
|
248
264
|
};
|
|
265
|
+
roomRegistry: {
|
|
266
|
+
/** Register this room with the central registry. Call once on room startup. */
|
|
267
|
+
register(options?: RoomRegistrationOptions): Promise<RoomRegistrationResult>;
|
|
268
|
+
/** Send heartbeat with current metrics. Call every 30s. */
|
|
269
|
+
heartbeat(options: RoomHeartbeatOptions): Promise<void>;
|
|
270
|
+
/** Track a player joining this room. Call when a player connects. */
|
|
271
|
+
playerJoin(options: RoomPlayerJoinOptions): Promise<void>;
|
|
272
|
+
/** Deregister this room. Call on graceful shutdown. */
|
|
273
|
+
deregister(): Promise<void>;
|
|
274
|
+
};
|
|
249
275
|
sparks: {
|
|
250
276
|
verifyPurchase({ purchaseId, price }: {
|
|
251
277
|
purchaseId: string;
|
|
@@ -545,4 +571,4 @@ interface JobFnEnv {
|
|
|
545
571
|
type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
|
|
546
572
|
type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
|
|
547
573
|
|
|
548
|
-
export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, ClipThumbnailDescriptor, GameSpecMutation, GameSpecMutationResult, InventoryItem, Item, JobDewEnv, JobFnEnv, LeaderboardEntry, LlmApi, LlmChatOptions, LlmChatResponse, LlmModel, Room, RoomInfo, RoomVisibility, SoundSettings, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
|
|
574
|
+
export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, ClipThumbnailDescriptor, GameSpecMutation, GameSpecMutationResult, InventoryItem, Item, JobDewEnv, JobFnEnv, LeaderboardEntry, LlmApi, LlmChatOptions, LlmChatResponse, LlmModel, Room, RoomHeartbeatOptions, RoomInfo, RoomPlayerJoinOptions, RoomRegistrationOptions, RoomRegistrationResult, RoomVisibility, SoundSettings, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ type GameSpecMutation = {
|
|
|
35
35
|
key: string;
|
|
36
36
|
value: unknown;
|
|
37
37
|
} | {
|
|
38
|
-
kind: '
|
|
38
|
+
kind: 'replaceState';
|
|
39
39
|
id: string;
|
|
40
40
|
state: Record<string, unknown>;
|
|
41
41
|
} | {
|
|
@@ -51,6 +51,22 @@ interface GameSpecMutationResult {
|
|
|
51
51
|
mutationCount: number;
|
|
52
52
|
updated: boolean;
|
|
53
53
|
}
|
|
54
|
+
interface RoomRegistrationOptions {
|
|
55
|
+
maxPlayers?: number;
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
interface RoomHeartbeatOptions {
|
|
59
|
+
playerCount: number;
|
|
60
|
+
metadata?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
interface RoomPlayerJoinOptions {
|
|
63
|
+
userId: string;
|
|
64
|
+
}
|
|
65
|
+
interface RoomRegistrationResult {
|
|
66
|
+
success: boolean;
|
|
67
|
+
roomId: string;
|
|
68
|
+
appId: string;
|
|
69
|
+
}
|
|
54
70
|
interface ClipThumbnailDescriptor {
|
|
55
71
|
assetUrl: string;
|
|
56
72
|
contentType: string;
|
|
@@ -246,6 +262,16 @@ interface SpawnServerSDK__V1<TConfig = any> {
|
|
|
246
262
|
success: boolean;
|
|
247
263
|
}>;
|
|
248
264
|
};
|
|
265
|
+
roomRegistry: {
|
|
266
|
+
/** Register this room with the central registry. Call once on room startup. */
|
|
267
|
+
register(options?: RoomRegistrationOptions): Promise<RoomRegistrationResult>;
|
|
268
|
+
/** Send heartbeat with current metrics. Call every 30s. */
|
|
269
|
+
heartbeat(options: RoomHeartbeatOptions): Promise<void>;
|
|
270
|
+
/** Track a player joining this room. Call when a player connects. */
|
|
271
|
+
playerJoin(options: RoomPlayerJoinOptions): Promise<void>;
|
|
272
|
+
/** Deregister this room. Call on graceful shutdown. */
|
|
273
|
+
deregister(): Promise<void>;
|
|
274
|
+
};
|
|
249
275
|
sparks: {
|
|
250
276
|
verifyPurchase({ purchaseId, price }: {
|
|
251
277
|
purchaseId: string;
|
|
@@ -545,4 +571,4 @@ interface JobFnEnv {
|
|
|
545
571
|
type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
|
|
546
572
|
type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
|
|
547
573
|
|
|
548
|
-
export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, ClipThumbnailDescriptor, GameSpecMutation, GameSpecMutationResult, InventoryItem, Item, JobDewEnv, JobFnEnv, LeaderboardEntry, LlmApi, LlmChatOptions, LlmChatResponse, LlmModel, Room, RoomInfo, RoomVisibility, SoundSettings, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
|
|
574
|
+
export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, ClipThumbnailDescriptor, GameSpecMutation, GameSpecMutationResult, InventoryItem, Item, JobDewEnv, JobFnEnv, LeaderboardEntry, LlmApi, LlmChatOptions, LlmChatResponse, LlmModel, Room, RoomHeartbeatOptions, RoomInfo, RoomPlayerJoinOptions, RoomRegistrationOptions, RoomRegistrationResult, RoomVisibility, SoundSettings, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
|
package/package.json
CHANGED
package/src/v1.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type GameSpecMutation =
|
|
|
31
31
|
| { kind: 'spawn'; id: string; spec: Record<string, unknown> }
|
|
32
32
|
| { kind: 'destroy'; id: string }
|
|
33
33
|
| { kind: 'setProperty'; id: string; key: string; value: unknown }
|
|
34
|
-
| { kind: '
|
|
34
|
+
| { kind: 'replaceState'; id: string; state: Record<string, unknown> }
|
|
35
35
|
| { kind: 'patchState'; id: string; patch: Record<string, unknown> };
|
|
36
36
|
|
|
37
37
|
export interface GameSpecMutationResult {
|
|
@@ -43,6 +43,26 @@ export interface GameSpecMutationResult {
|
|
|
43
43
|
updated: boolean;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
export interface RoomRegistrationOptions {
|
|
47
|
+
maxPlayers?: number;
|
|
48
|
+
metadata?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface RoomHeartbeatOptions {
|
|
52
|
+
playerCount: number;
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface RoomPlayerJoinOptions {
|
|
57
|
+
userId: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RoomRegistrationResult {
|
|
61
|
+
success: boolean;
|
|
62
|
+
roomId: string;
|
|
63
|
+
appId: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
export interface ClipThumbnailDescriptor {
|
|
47
67
|
assetUrl: string;
|
|
48
68
|
contentType: string;
|
|
@@ -251,6 +271,20 @@ export interface SpawnServerSDK__V1<TConfig = any> {
|
|
|
251
271
|
notifyDm(options: { message: string; source?: string; entityId?: string }): Promise<{ success: boolean }>;
|
|
252
272
|
};
|
|
253
273
|
|
|
274
|
+
roomRegistry: {
|
|
275
|
+
/** Register this room with the central registry. Call once on room startup. */
|
|
276
|
+
register(options?: RoomRegistrationOptions): Promise<RoomRegistrationResult>;
|
|
277
|
+
|
|
278
|
+
/** Send heartbeat with current metrics. Call every 30s. */
|
|
279
|
+
heartbeat(options: RoomHeartbeatOptions): Promise<void>;
|
|
280
|
+
|
|
281
|
+
/** Track a player joining this room. Call when a player connects. */
|
|
282
|
+
playerJoin(options: RoomPlayerJoinOptions): Promise<void>;
|
|
283
|
+
|
|
284
|
+
/** Deregister this room. Call on graceful shutdown. */
|
|
285
|
+
deregister(): Promise<void>;
|
|
286
|
+
};
|
|
287
|
+
|
|
254
288
|
sparks: {
|
|
255
289
|
verifyPurchase({ purchaseId, price }: { purchaseId: string; price: number }): Promise<boolean>;
|
|
256
290
|
};
|