@spawnco/sdk-types 0.0.53 → 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;
@@ -271,6 +300,30 @@ interface SpawnServerSDK__V1<TConfig = any> {
271
300
  */
272
301
  unlock(key: string): Promise<void>;
273
302
  };
303
+ /**
304
+ * Game spec access (Tome).
305
+ * Returns the latest resolved game_spec for an app.
306
+ */
307
+ gameSpec: {
308
+ /**
309
+ * Fetch the latest game spec for this variant's app, or an explicit appId override.
310
+ * Returns null if no spec exists.
311
+ */
312
+ latest(options?: {
313
+ appId?: string;
314
+ }): Promise<{
315
+ appId: string;
316
+ version: number;
317
+ gameSpec: Record<string, unknown>;
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>;
326
+ };
274
327
  config: {
275
328
  get(): Promise<TConfig>;
276
329
  version(): Promise<string>;
@@ -492,4 +545,4 @@ interface JobFnEnv {
492
545
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
493
546
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
494
547
 
495
- 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;
@@ -271,6 +300,30 @@ interface SpawnServerSDK__V1<TConfig = any> {
271
300
  */
272
301
  unlock(key: string): Promise<void>;
273
302
  };
303
+ /**
304
+ * Game spec access (Tome).
305
+ * Returns the latest resolved game_spec for an app.
306
+ */
307
+ gameSpec: {
308
+ /**
309
+ * Fetch the latest game spec for this variant's app, or an explicit appId override.
310
+ * Returns null if no spec exists.
311
+ */
312
+ latest(options?: {
313
+ appId?: string;
314
+ }): Promise<{
315
+ appId: string;
316
+ version: number;
317
+ gameSpec: Record<string, unknown>;
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>;
326
+ };
274
327
  config: {
275
328
  get(): Promise<TConfig>;
276
329
  version(): Promise<string>;
@@ -492,4 +545,4 @@ interface JobFnEnv {
492
545
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
493
546
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room' | 'llm'>;
494
547
 
495
- 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.53",
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;
@@ -296,6 +312,27 @@ export interface SpawnServerSDK__V1<TConfig = any> {
296
312
  unlock(key: string): Promise<void>;
297
313
  };
298
314
 
315
+ /**
316
+ * Game spec access (Tome).
317
+ * Returns the latest resolved game_spec for an app.
318
+ */
319
+ gameSpec: {
320
+ /**
321
+ * Fetch the latest game spec for this variant's app, or an explicit appId override.
322
+ * Returns null if no spec exists.
323
+ */
324
+ latest(options?: { appId?: string }): Promise<{
325
+ appId: string;
326
+ version: number;
327
+ gameSpec: Record<string, unknown>;
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>;
334
+ };
335
+
299
336
  config: {
300
337
  get(): Promise<TConfig>;
301
338
  version(): Promise<string>;