@spawnco/sdk-types 0.0.39 → 0.0.41

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
@@ -4,6 +4,51 @@
4
4
  * Current modules: user, room, economy, inventory, storage
5
5
  * Future modules: friends, achievements, chat, ai, leaderboards, tournaments
6
6
  */
7
+ interface MagicCdnMediaToken {
8
+ token: string;
9
+ expiresAtMs: number;
10
+ }
11
+ interface MagicCdnApi {
12
+ getMediaToken(): Promise<MagicCdnMediaToken>;
13
+ }
14
+ type ClipFormat = 'gif' | 'webm';
15
+ type ClipKind = 'world' | (string & {});
16
+ type ClipStatus = 'ready' | 'processing';
17
+ interface ClipDescriptor {
18
+ clipId: string;
19
+ kind: ClipKind;
20
+ variantId: string;
21
+ format: ClipFormat;
22
+ status: ClipStatus;
23
+ assetUrl?: string;
24
+ contentType: string;
25
+ width?: number;
26
+ height?: number;
27
+ durationMs?: number;
28
+ fileSizeBytes?: number;
29
+ metadata?: Record<string, unknown>;
30
+ createdAtMs: number;
31
+ updatedAtMs: number;
32
+ }
33
+ interface ClipLookupOptions {
34
+ clipId: string;
35
+ kind?: ClipKind;
36
+ }
37
+ interface ClipListOptions {
38
+ kind?: ClipKind;
39
+ }
40
+ interface UploadClipOptions {
41
+ clipId: string;
42
+ blob: Blob;
43
+ format?: ClipFormat;
44
+ kind?: ClipKind;
45
+ contentType?: string;
46
+ durationMs?: number;
47
+ width?: number;
48
+ height?: number;
49
+ metadata?: Record<string, unknown>;
50
+ signal?: AbortSignal;
51
+ }
7
52
  interface SpawnClientSDK__V1<TConfig = any> {
8
53
  ready(): Promise<void>;
9
54
  user: {
@@ -63,6 +108,12 @@ interface SpawnClientSDK__V1<TConfig = any> {
63
108
  analytics: {
64
109
  track(event: string, data: Record<string, any>): Promise<void>;
65
110
  };
111
+ clips: {
112
+ worldHasClip(options: ClipLookupOptions): Promise<ClipDescriptor | null>;
113
+ list(options?: ClipListOptions): Promise<ClipDescriptor[]>;
114
+ uploadClip(options: UploadClipOptions): Promise<ClipDescriptor>;
115
+ delete(options: ClipLookupOptions): Promise<void>;
116
+ };
66
117
  leaderboard: {
67
118
  submit(leaderboardId: string, score: number): Promise<{
68
119
  rank: number;
@@ -96,6 +147,7 @@ interface SpawnClientSDK__V1<TConfig = any> {
96
147
  error?: string;
97
148
  }>;
98
149
  };
150
+ magicCdn: MagicCdnApi;
99
151
  }
100
152
  interface SpawnServerSDK__V1<TConfig = any> {
101
153
  user: {
@@ -260,4 +312,4 @@ interface LeaderboardEntry {
260
312
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
261
313
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room'>;
262
314
 
263
- export type { InventoryItem, Item, LeaderboardEntry, Room, RoomInfo, RoomVisibility, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, User };
315
+ export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, InventoryItem, Item, LeaderboardEntry, Room, RoomInfo, RoomVisibility, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, UploadClipOptions, User };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,51 @@
4
4
  * Current modules: user, room, economy, inventory, storage
5
5
  * Future modules: friends, achievements, chat, ai, leaderboards, tournaments
6
6
  */
7
+ interface MagicCdnMediaToken {
8
+ token: string;
9
+ expiresAtMs: number;
10
+ }
11
+ interface MagicCdnApi {
12
+ getMediaToken(): Promise<MagicCdnMediaToken>;
13
+ }
14
+ type ClipFormat = 'gif' | 'webm';
15
+ type ClipKind = 'world' | (string & {});
16
+ type ClipStatus = 'ready' | 'processing';
17
+ interface ClipDescriptor {
18
+ clipId: string;
19
+ kind: ClipKind;
20
+ variantId: string;
21
+ format: ClipFormat;
22
+ status: ClipStatus;
23
+ assetUrl?: string;
24
+ contentType: string;
25
+ width?: number;
26
+ height?: number;
27
+ durationMs?: number;
28
+ fileSizeBytes?: number;
29
+ metadata?: Record<string, unknown>;
30
+ createdAtMs: number;
31
+ updatedAtMs: number;
32
+ }
33
+ interface ClipLookupOptions {
34
+ clipId: string;
35
+ kind?: ClipKind;
36
+ }
37
+ interface ClipListOptions {
38
+ kind?: ClipKind;
39
+ }
40
+ interface UploadClipOptions {
41
+ clipId: string;
42
+ blob: Blob;
43
+ format?: ClipFormat;
44
+ kind?: ClipKind;
45
+ contentType?: string;
46
+ durationMs?: number;
47
+ width?: number;
48
+ height?: number;
49
+ metadata?: Record<string, unknown>;
50
+ signal?: AbortSignal;
51
+ }
7
52
  interface SpawnClientSDK__V1<TConfig = any> {
8
53
  ready(): Promise<void>;
9
54
  user: {
@@ -63,6 +108,12 @@ interface SpawnClientSDK__V1<TConfig = any> {
63
108
  analytics: {
64
109
  track(event: string, data: Record<string, any>): Promise<void>;
65
110
  };
111
+ clips: {
112
+ worldHasClip(options: ClipLookupOptions): Promise<ClipDescriptor | null>;
113
+ list(options?: ClipListOptions): Promise<ClipDescriptor[]>;
114
+ uploadClip(options: UploadClipOptions): Promise<ClipDescriptor>;
115
+ delete(options: ClipLookupOptions): Promise<void>;
116
+ };
66
117
  leaderboard: {
67
118
  submit(leaderboardId: string, score: number): Promise<{
68
119
  rank: number;
@@ -96,6 +147,7 @@ interface SpawnClientSDK__V1<TConfig = any> {
96
147
  error?: string;
97
148
  }>;
98
149
  };
150
+ magicCdn: MagicCdnApi;
99
151
  }
100
152
  interface SpawnServerSDK__V1<TConfig = any> {
101
153
  user: {
@@ -260,4 +312,4 @@ interface LeaderboardEntry {
260
312
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
261
313
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room'>;
262
314
 
263
- export type { InventoryItem, Item, LeaderboardEntry, Room, RoomInfo, RoomVisibility, SpawnClientSDK__V0, SpawnClientSDK__V1, SpawnServerSDK__V0, SpawnServerSDK__V1, TokenPayload, User };
315
+ export type { ClipDescriptor, ClipFormat, ClipKind, ClipListOptions, ClipLookupOptions, ClipStatus, InventoryItem, Item, LeaderboardEntry, Room, RoomInfo, RoomVisibility, 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.39",
3
+ "version": "0.0.41",
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
@@ -5,6 +5,58 @@
5
5
  * Future modules: friends, achievements, chat, ai, leaderboards, tournaments
6
6
  */
7
7
 
8
+ interface MagicCdnMediaToken {
9
+ token: string;
10
+ expiresAtMs: number;
11
+ }
12
+
13
+ interface MagicCdnApi {
14
+ getMediaToken(): Promise<MagicCdnMediaToken>;
15
+ }
16
+
17
+ export type ClipFormat = 'gif' | 'webm';
18
+ export type ClipKind = 'world' | (string & {});
19
+ export type ClipStatus = 'ready' | 'processing';
20
+
21
+ export interface ClipDescriptor {
22
+ clipId: string;
23
+ kind: ClipKind;
24
+ variantId: string;
25
+ format: ClipFormat;
26
+ status: ClipStatus;
27
+ assetUrl?: string;
28
+ contentType: string;
29
+ width?: number;
30
+ height?: number;
31
+ durationMs?: number;
32
+ fileSizeBytes?: number;
33
+ metadata?: Record<string, unknown>;
34
+ createdAtMs: number;
35
+ updatedAtMs: number;
36
+ }
37
+
38
+ export interface ClipLookupOptions {
39
+ clipId: string;
40
+ kind?: ClipKind;
41
+ }
42
+
43
+ export interface ClipListOptions {
44
+ kind?: ClipKind;
45
+ }
46
+
47
+ export interface UploadClipOptions {
48
+ clipId: string;
49
+ blob: Blob;
50
+ format?: ClipFormat;
51
+ kind?: ClipKind;
52
+ contentType?: string;
53
+ durationMs?: number;
54
+ width?: number;
55
+ height?: number;
56
+ metadata?: Record<string, unknown>;
57
+ signal?: AbortSignal;
58
+ }
59
+
8
60
  // Client SDK - available in browser
9
61
  export interface SpawnClientSDK__V1<TConfig = any> {
10
62
  ready(): Promise<void>;
@@ -76,6 +128,13 @@ export interface SpawnClientSDK__V1<TConfig = any> {
76
128
  track(event: string, data: Record<string, any>): Promise<void>;
77
129
  };
78
130
 
131
+ clips: {
132
+ worldHasClip(options: ClipLookupOptions): Promise<ClipDescriptor | null>;
133
+ list(options?: ClipListOptions): Promise<ClipDescriptor[]>;
134
+ uploadClip(options: UploadClipOptions): Promise<ClipDescriptor>;
135
+ delete(options: ClipLookupOptions): Promise<void>;
136
+ };
137
+
79
138
  leaderboard: {
80
139
  submit(
81
140
  leaderboardId: string,
@@ -113,6 +172,8 @@ export interface SpawnClientSDK__V1<TConfig = any> {
113
172
  error?: string;
114
173
  }>;
115
174
  };
175
+
176
+ magicCdn: MagicCdnApi;
116
177
  }
117
178
 
118
179
  // Server SDK - available in Durable Objects