Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit 05a1829

Browse files
authored
Add config types (#93)
1 parent c345dad commit 05a1829

File tree

2 files changed

+236
-0
lines changed

2 files changed

+236
-0
lines changed

external/types/config.d.ts

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
type Metrics = {
2+
env: string,
3+
send: boolean
4+
};
5+
6+
type Plan = {
7+
id: number,
8+
type: string,
9+
};
10+
11+
type Project = {
12+
id: number,
13+
name: string,
14+
permissions: {
15+
admin: number[]
16+
read: number[],
17+
write: number[]
18+
},
19+
private: boolean,
20+
primaryApp: number,
21+
playUrl: string,
22+
settings: object
23+
};
24+
25+
type Scene = {
26+
id: string,
27+
uniqueId: string,
28+
};
29+
30+
type Sentry = {
31+
enabled: true,
32+
env: string,
33+
version: string
34+
send: boolean,
35+
service: string,
36+
page: string
37+
disable_breadcrumbs: boolean
38+
} | {
39+
enabled: false
40+
};
41+
42+
type ModelSchema = {
43+
scene: object,
44+
settings: object,
45+
asset: object,
46+
};
47+
48+
type Url = {
49+
api: string,
50+
launch: string,
51+
home: string,
52+
realtime: {
53+
http: string,
54+
},
55+
messenger: {
56+
http: string,
57+
ws: string,
58+
},
59+
relay: {
60+
http: string,
61+
ws: string,
62+
},
63+
frontend: string,
64+
engine: string,
65+
useCustomEngine: boolean,
66+
};
67+
68+
type EngineVersions = {
69+
current: { version: string, description: string },
70+
force: { version: string, description: string },
71+
previous?: { version: string, description: string },
72+
releaseCandidate?: { version: string, description: string },
73+
};
74+
75+
type WasmModule = {
76+
moduleName: string,
77+
glueUrl: string,
78+
wasmUrl: string,
79+
fallbackUrl: string,
80+
preload: boolean
81+
};
82+
83+
export type EditorBlankConfig = {
84+
version: string,
85+
self: {
86+
id: number,
87+
username: string,
88+
flags: Record<string, any>,
89+
plan: Plan,
90+
branch: {
91+
id: null
92+
},
93+
diskAllowance: number
94+
},
95+
accessToken: string,
96+
project: {
97+
id: null
98+
},
99+
url: Url & {
100+
store: string,
101+
howdoi: string,
102+
static: string,
103+
images: string,
104+
},
105+
schema: ModelSchema,
106+
engineVersions: EngineVersions
107+
sentry: Sentry,
108+
metrics: Metrics,
109+
oneTrustDomainKey: string,
110+
wasmModules: WasmModule[]
111+
};
112+
113+
export type EditorConfig = {
114+
version: string,
115+
self: {
116+
id: number
117+
username: string,
118+
flags: Record<string, any>,
119+
branch: {
120+
id: string,
121+
name: string,
122+
createdAt: string,
123+
latestCheckpointId: string,
124+
merge?: object
125+
},
126+
plan: Plan,
127+
locale: string
128+
},
129+
owner: {
130+
id: number,
131+
username: string,
132+
plan: Plan,
133+
size: number,
134+
diskAllowance: number
135+
},
136+
accessToken: string,
137+
project: Project & {
138+
description: string,
139+
privateAssets: boolean,
140+
hasPrivateSettings: boolean,
141+
thumbnails: {
142+
s?: string,
143+
m?: string,
144+
l?: string,
145+
xl?: string
146+
}
147+
masterBranch: string,
148+
},
149+
aws: {
150+
s3Prefix: string,
151+
},
152+
store: {
153+
sketchfab: {
154+
clientId: string,
155+
cookieName: string,
156+
redirectUrl: string,
157+
}
158+
},
159+
scene: Scene,
160+
url: Url & {
161+
store: string,
162+
howdoi: string,
163+
static: string,
164+
images: string,
165+
},
166+
engineVersions: EngineVersions,
167+
sentry: Sentry,
168+
metrics: Metrics,
169+
oneTrustDomainKey: string,
170+
schema: ModelSchema,
171+
wasmModules: WasmModule[],
172+
};
173+
174+
export type CodeEditorConfig = {
175+
self: {
176+
id: number,
177+
username: string,
178+
flags: Record<string, any>,
179+
branch: {
180+
id: string,
181+
name: string,
182+
merge?: object,
183+
}
184+
},
185+
project: Project,
186+
tabs: number[],
187+
file: {
188+
line?: number,
189+
col?: number,
190+
error?: string,
191+
},
192+
title: string,
193+
url: Url & {
194+
autocomplete: string,
195+
},
196+
sentry: Sentry,
197+
metrics: Metrics,
198+
oneTrustDomainKey: string,
199+
schema: ModelSchema
200+
};
201+
202+
export type LaunchConfig = {
203+
self: {
204+
id: string;
205+
username: string;
206+
branch: {
207+
id: string,
208+
},
209+
locale: string;
210+
},
211+
project: Pick<Project, 'id' | 'name' | 'settings'> & {
212+
repositoryUrl: string,
213+
scriptPrefix: string,
214+
hasReadAccess: boolean
215+
}
216+
scene: Scene,
217+
scenes: {
218+
name: string,
219+
url: string
220+
}[],
221+
url: Omit<Url, 'launch' | 'relay' | 'useCustomEngine'> & {
222+
engineExtras: string,
223+
physics: string,
224+
webvr: string,
225+
scriptsBeforeEngine: { url: string }[],
226+
scriptsAfterEngine: { url: string }[]
227+
},
228+
importMap: string,
229+
sentry: Sentry,
230+
metrics: Metrics,
231+
oneTrustDomainKey: string,
232+
schema: ModelSchema,
233+
engineVersions: EngineVersions,
234+
wasmModules?: WasmModule[]
235+
};

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* @module Editor
1010
*/
1111
// types
12+
export type * from '../external/types/config';
1213
export type * from '../external/types/asset';
1314
export type * from '../external/types/entity';
1415
export type * from '../external/types/scene-settings';

0 commit comments

Comments
 (0)