@spawnco/sdk-types 0.0.54 → 0.0.55

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
@@ -22,6 +22,35 @@ interface SoundSettings {
22
22
  ambience: number;
23
23
  voice: number;
24
24
  }
25
+ type GameSpecMutation = {
26
+ kind: 'spawn';
27
+ id: string;
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
+ };
46
+ interface GameSpecMutationResult {
47
+ appId: string;
48
+ version: number;
49
+ applied: number;
50
+ skipped: number;
51
+ mutationCount: number;
52
+ updated: boolean;
53
+ }
25
54
  interface ClipThumbnailDescriptor {
26
55
  assetUrl: string;
27
56
  contentType: string;
@@ -287,6 +316,13 @@ interface SpawnServerSDK__V1<TConfig = any> {
287
316
  version: number;
288
317
  gameSpec: Record<string, unknown>;
289
318
  } | null>;
319
+ /**
320
+ * Apply script-style mutations (spawn/destroy/setProperty/state) to the game spec.
321
+ */
322
+ applyMutations(options: {
323
+ mutations: GameSpecMutation[];
324
+ appId?: string;
325
+ }): Promise<GameSpecMutationResult>;
290
326
  };
291
327
  config: {
292
328
  get(): Promise<TConfig>;
@@ -509,4 +545,4 @@ interface JobFnEnv {
509
545
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
510
546
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
511
547
 
512
- export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, ClipThumbnailDescriptor, InventoryItem, Item, JobDewEnv, JobFnEnv, LeaderboardEntry, LlmApi, LlmChatOptions, LlmChatResponse, LlmModel, Room, RoomInfo, RoomVisibility, SoundSettings, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
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 };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,35 @@ interface SoundSettings {
22
22
  ambience: number;
23
23
  voice: number;
24
24
  }
25
+ type GameSpecMutation = {
26
+ kind: 'spawn';
27
+ id: string;
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
+ };
46
+ interface GameSpecMutationResult {
47
+ appId: string;
48
+ version: number;
49
+ applied: number;
50
+ skipped: number;
51
+ mutationCount: number;
52
+ updated: boolean;
53
+ }
25
54
  interface ClipThumbnailDescriptor {
26
55
  assetUrl: string;
27
56
  contentType: string;
@@ -287,6 +316,13 @@ interface SpawnServerSDK__V1<TConfig = any> {
287
316
  version: number;
288
317
  gameSpec: Record<string, unknown>;
289
318
  } | null>;
319
+ /**
320
+ * Apply script-style mutations (spawn/destroy/setProperty/state) to the game spec.
321
+ */
322
+ applyMutations(options: {
323
+ mutations: GameSpecMutation[];
324
+ appId?: string;
325
+ }): Promise<GameSpecMutationResult>;
290
326
  };
291
327
  config: {
292
328
  get(): Promise<TConfig>;
@@ -509,4 +545,4 @@ interface JobFnEnv {
509
545
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
510
546
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
511
547
 
512
- export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, ClipThumbnailDescriptor, InventoryItem, Item, JobDewEnv, JobFnEnv, LeaderboardEntry, LlmApi, LlmChatOptions, LlmChatResponse, LlmModel, Room, RoomInfo, RoomVisibility, SoundSettings, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spawnco/sdk-types",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "description": "TypeScript type definitions for Spawn SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/v1.ts CHANGED
@@ -27,6 +27,22 @@ 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> };
36
+
37
+ export interface GameSpecMutationResult {
38
+ appId: string;
39
+ version: number;
40
+ applied: number;
41
+ skipped: number;
42
+ mutationCount: number;
43
+ updated: boolean;
44
+ }
45
+
30
46
  export interface ClipThumbnailDescriptor {
31
47
  assetUrl: string;
32
48
  contentType: string;
@@ -310,6 +326,11 @@ export interface SpawnServerSDK__V1<TConfig = any> {
310
326
  version: number;
311
327
  gameSpec: Record<string, unknown>;
312
328
  } | null>;
329
+
330
+ /**
331
+ * Apply script-style mutations (spawn/destroy/setProperty/state) to the game spec.
332
+ */
333
+ applyMutations(options: { mutations: GameSpecMutation[]; appId?: string }): Promise<GameSpecMutationResult>;
313
334
  };
314
335
 
315
336
  config: {