@spawnco/sdk-types 0.0.40 → 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
@@ -11,6 +11,44 @@ interface MagicCdnMediaToken {
11
11
  interface MagicCdnApi {
12
12
  getMediaToken(): Promise<MagicCdnMediaToken>;
13
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
+ }
14
52
  interface SpawnClientSDK__V1<TConfig = any> {
15
53
  ready(): Promise<void>;
16
54
  user: {
@@ -70,6 +108,12 @@ interface SpawnClientSDK__V1<TConfig = any> {
70
108
  analytics: {
71
109
  track(event: string, data: Record<string, any>): Promise<void>;
72
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
+ };
73
117
  leaderboard: {
74
118
  submit(leaderboardId: string, score: number): Promise<{
75
119
  rank: number;
@@ -268,4 +312,4 @@ interface LeaderboardEntry {
268
312
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
269
313
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room'>;
270
314
 
271
- 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
@@ -11,6 +11,44 @@ interface MagicCdnMediaToken {
11
11
  interface MagicCdnApi {
12
12
  getMediaToken(): Promise<MagicCdnMediaToken>;
13
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
+ }
14
52
  interface SpawnClientSDK__V1<TConfig = any> {
15
53
  ready(): Promise<void>;
16
54
  user: {
@@ -70,6 +108,12 @@ interface SpawnClientSDK__V1<TConfig = any> {
70
108
  analytics: {
71
109
  track(event: string, data: Record<string, any>): Promise<void>;
72
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
+ };
73
117
  leaderboard: {
74
118
  submit(leaderboardId: string, score: number): Promise<{
75
119
  rank: number;
@@ -268,4 +312,4 @@ interface LeaderboardEntry {
268
312
  type SpawnClientSDK__V0<TConfig = any> = Omit<SpawnClientSDK__V1<TConfig>, 'economy'>;
269
313
  type SpawnServerSDK__V0<TConfig = any> = Omit<SpawnServerSDK__V1<TConfig>, 'economy' | 'room'>;
270
314
 
271
- 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.40",
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
@@ -14,6 +14,49 @@ interface MagicCdnApi {
14
14
  getMediaToken(): Promise<MagicCdnMediaToken>;
15
15
  }
16
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
+
17
60
  // Client SDK - available in browser
18
61
  export interface SpawnClientSDK__V1<TConfig = any> {
19
62
  ready(): Promise<void>;
@@ -85,6 +128,13 @@ export interface SpawnClientSDK__V1<TConfig = any> {
85
128
  track(event: string, data: Record<string, any>): Promise<void>;
86
129
  };
87
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
+
88
138
  leaderboard: {
89
139
  submit(
90
140
  leaderboardId: string,