@spawnco/sdk-types 0.0.55 → 0.0.60
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 +29 -21
- package/dist/index.d.ts +29 -21
- package/package.json +1 -1
- package/src/v1.ts +35 -6
package/dist/index.d.mts
CHANGED
|
@@ -23,26 +23,8 @@ interface SoundSettings {
|
|
|
23
23
|
voice: number;
|
|
24
24
|
}
|
|
25
25
|
type GameSpecMutation = {
|
|
26
|
-
kind:
|
|
27
|
-
|
|
28
|
-
spec: Record<string, unknown>;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'destroy';
|
|
31
|
-
id: string;
|
|
32
|
-
} | {
|
|
33
|
-
kind: 'setProperty';
|
|
34
|
-
id: string;
|
|
35
|
-
key: string;
|
|
36
|
-
value: unknown;
|
|
37
|
-
} | {
|
|
38
|
-
kind: 'setState';
|
|
39
|
-
id: string;
|
|
40
|
-
state: Record<string, unknown>;
|
|
41
|
-
} | {
|
|
42
|
-
kind: 'patchState';
|
|
43
|
-
id: string;
|
|
44
|
-
patch: Record<string, unknown>;
|
|
45
|
-
};
|
|
26
|
+
kind: string;
|
|
27
|
+
} & Record<string, unknown>;
|
|
46
28
|
interface GameSpecMutationResult {
|
|
47
29
|
appId: string;
|
|
48
30
|
version: number;
|
|
@@ -51,6 +33,22 @@ interface GameSpecMutationResult {
|
|
|
51
33
|
mutationCount: number;
|
|
52
34
|
updated: boolean;
|
|
53
35
|
}
|
|
36
|
+
interface RoomRegistrationOptions {
|
|
37
|
+
maxPlayers?: number;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
interface RoomHeartbeatOptions {
|
|
41
|
+
playerCount: number;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
interface RoomPlayerJoinOptions {
|
|
45
|
+
userId: string;
|
|
46
|
+
}
|
|
47
|
+
interface RoomRegistrationResult {
|
|
48
|
+
success: boolean;
|
|
49
|
+
roomId: string;
|
|
50
|
+
appId: string;
|
|
51
|
+
}
|
|
54
52
|
interface ClipThumbnailDescriptor {
|
|
55
53
|
assetUrl: string;
|
|
56
54
|
contentType: string;
|
|
@@ -246,6 +244,16 @@ interface SpawnServerSDK__V1<TConfig = any> {
|
|
|
246
244
|
success: boolean;
|
|
247
245
|
}>;
|
|
248
246
|
};
|
|
247
|
+
roomRegistry: {
|
|
248
|
+
/** Register this room with the central registry. Call once on room startup. */
|
|
249
|
+
register(options?: RoomRegistrationOptions): Promise<RoomRegistrationResult>;
|
|
250
|
+
/** Send heartbeat with current metrics. Call every 30s. */
|
|
251
|
+
heartbeat(options: RoomHeartbeatOptions): Promise<void>;
|
|
252
|
+
/** Track a player joining this room. Call when a player connects. */
|
|
253
|
+
playerJoin(options: RoomPlayerJoinOptions): Promise<void>;
|
|
254
|
+
/** Deregister this room. Call on graceful shutdown. */
|
|
255
|
+
deregister(): Promise<void>;
|
|
256
|
+
};
|
|
249
257
|
sparks: {
|
|
250
258
|
verifyPurchase({ purchaseId, price }: {
|
|
251
259
|
purchaseId: string;
|
|
@@ -545,4 +553,4 @@ interface JobFnEnv {
|
|
|
545
553
|
type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
|
|
546
554
|
type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
|
|
547
555
|
|
|
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 };
|
|
556
|
+
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
|
@@ -23,26 +23,8 @@ interface SoundSettings {
|
|
|
23
23
|
voice: number;
|
|
24
24
|
}
|
|
25
25
|
type GameSpecMutation = {
|
|
26
|
-
kind:
|
|
27
|
-
|
|
28
|
-
spec: Record<string, unknown>;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'destroy';
|
|
31
|
-
id: string;
|
|
32
|
-
} | {
|
|
33
|
-
kind: 'setProperty';
|
|
34
|
-
id: string;
|
|
35
|
-
key: string;
|
|
36
|
-
value: unknown;
|
|
37
|
-
} | {
|
|
38
|
-
kind: 'setState';
|
|
39
|
-
id: string;
|
|
40
|
-
state: Record<string, unknown>;
|
|
41
|
-
} | {
|
|
42
|
-
kind: 'patchState';
|
|
43
|
-
id: string;
|
|
44
|
-
patch: Record<string, unknown>;
|
|
45
|
-
};
|
|
26
|
+
kind: string;
|
|
27
|
+
} & Record<string, unknown>;
|
|
46
28
|
interface GameSpecMutationResult {
|
|
47
29
|
appId: string;
|
|
48
30
|
version: number;
|
|
@@ -51,6 +33,22 @@ interface GameSpecMutationResult {
|
|
|
51
33
|
mutationCount: number;
|
|
52
34
|
updated: boolean;
|
|
53
35
|
}
|
|
36
|
+
interface RoomRegistrationOptions {
|
|
37
|
+
maxPlayers?: number;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
interface RoomHeartbeatOptions {
|
|
41
|
+
playerCount: number;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
interface RoomPlayerJoinOptions {
|
|
45
|
+
userId: string;
|
|
46
|
+
}
|
|
47
|
+
interface RoomRegistrationResult {
|
|
48
|
+
success: boolean;
|
|
49
|
+
roomId: string;
|
|
50
|
+
appId: string;
|
|
51
|
+
}
|
|
54
52
|
interface ClipThumbnailDescriptor {
|
|
55
53
|
assetUrl: string;
|
|
56
54
|
contentType: string;
|
|
@@ -246,6 +244,16 @@ interface SpawnServerSDK__V1<TConfig = any> {
|
|
|
246
244
|
success: boolean;
|
|
247
245
|
}>;
|
|
248
246
|
};
|
|
247
|
+
roomRegistry: {
|
|
248
|
+
/** Register this room with the central registry. Call once on room startup. */
|
|
249
|
+
register(options?: RoomRegistrationOptions): Promise<RoomRegistrationResult>;
|
|
250
|
+
/** Send heartbeat with current metrics. Call every 30s. */
|
|
251
|
+
heartbeat(options: RoomHeartbeatOptions): Promise<void>;
|
|
252
|
+
/** Track a player joining this room. Call when a player connects. */
|
|
253
|
+
playerJoin(options: RoomPlayerJoinOptions): Promise<void>;
|
|
254
|
+
/** Deregister this room. Call on graceful shutdown. */
|
|
255
|
+
deregister(): Promise<void>;
|
|
256
|
+
};
|
|
249
257
|
sparks: {
|
|
250
258
|
verifyPurchase({ purchaseId, price }: {
|
|
251
259
|
purchaseId: string;
|
|
@@ -545,4 +553,4 @@ interface JobFnEnv {
|
|
|
545
553
|
type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
|
|
546
554
|
type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
|
|
547
555
|
|
|
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 };
|
|
556
|
+
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
|
@@ -27,12 +27,7 @@ export interface SoundSettings {
|
|
|
27
27
|
voice: number; // 0-1
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export type GameSpecMutation =
|
|
31
|
-
| { kind: 'spawn'; id: string; spec: Record<string, unknown> }
|
|
32
|
-
| { kind: 'destroy'; id: string }
|
|
33
|
-
| { kind: 'setProperty'; id: string; key: string; value: unknown }
|
|
34
|
-
| { kind: 'setState'; id: string; state: Record<string, unknown> }
|
|
35
|
-
| { kind: 'patchState'; id: string; patch: Record<string, unknown> };
|
|
30
|
+
export type GameSpecMutation = { kind: string } & Record<string, unknown>;
|
|
36
31
|
|
|
37
32
|
export interface GameSpecMutationResult {
|
|
38
33
|
appId: string;
|
|
@@ -43,6 +38,26 @@ export interface GameSpecMutationResult {
|
|
|
43
38
|
updated: boolean;
|
|
44
39
|
}
|
|
45
40
|
|
|
41
|
+
export interface RoomRegistrationOptions {
|
|
42
|
+
maxPlayers?: number;
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface RoomHeartbeatOptions {
|
|
47
|
+
playerCount: number;
|
|
48
|
+
metadata?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface RoomPlayerJoinOptions {
|
|
52
|
+
userId: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface RoomRegistrationResult {
|
|
56
|
+
success: boolean;
|
|
57
|
+
roomId: string;
|
|
58
|
+
appId: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
46
61
|
export interface ClipThumbnailDescriptor {
|
|
47
62
|
assetUrl: string;
|
|
48
63
|
contentType: string;
|
|
@@ -251,6 +266,20 @@ export interface SpawnServerSDK__V1<TConfig = any> {
|
|
|
251
266
|
notifyDm(options: { message: string; source?: string; entityId?: string }): Promise<{ success: boolean }>;
|
|
252
267
|
};
|
|
253
268
|
|
|
269
|
+
roomRegistry: {
|
|
270
|
+
/** Register this room with the central registry. Call once on room startup. */
|
|
271
|
+
register(options?: RoomRegistrationOptions): Promise<RoomRegistrationResult>;
|
|
272
|
+
|
|
273
|
+
/** Send heartbeat with current metrics. Call every 30s. */
|
|
274
|
+
heartbeat(options: RoomHeartbeatOptions): Promise<void>;
|
|
275
|
+
|
|
276
|
+
/** Track a player joining this room. Call when a player connects. */
|
|
277
|
+
playerJoin(options: RoomPlayerJoinOptions): Promise<void>;
|
|
278
|
+
|
|
279
|
+
/** Deregister this room. Call on graceful shutdown. */
|
|
280
|
+
deregister(): Promise<void>;
|
|
281
|
+
};
|
|
282
|
+
|
|
254
283
|
sparks: {
|
|
255
284
|
verifyPurchase({ purchaseId, price }: { purchaseId: string; price: number }): Promise<boolean>;
|
|
256
285
|
};
|