glitch-javascript-sdk 3.9.9 → 3.10.0
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/browser/hosting-runtime.js +23 -0
- package/dist/browser/hosting-runtime.js.map +1 -1
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Hosting.d.ts +108 -4
- package/dist/esm/index.js +23 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +105 -2
- package/package.json +1 -1
- package/src/api/Hosting.ts +123 -4
- package/src/routes/HostingRoute.ts +5 -0
package/dist/index.d.ts
CHANGED
|
@@ -11550,8 +11550,12 @@ declare class GameAdvertising {
|
|
|
11550
11550
|
|
|
11551
11551
|
type HostingPlanKey = 'free' | 'launch' | 'growth' | 'scale' | 'studio';
|
|
11552
11552
|
type HostingMode = 'static' | 'server';
|
|
11553
|
-
type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql';
|
|
11554
|
-
type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated';
|
|
11553
|
+
type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql' | 'redis';
|
|
11554
|
+
type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated' | 'cache_sandbox' | 'cache_launch' | 'cache_growth' | 'cache_scale';
|
|
11555
|
+
type HostingServiceRole = 'web' | 'api' | 'game' | 'realtime' | 'simulation' | 'worker' | 'scheduled';
|
|
11556
|
+
type HostingServiceVisibility = 'public' | 'internal' | 'none';
|
|
11557
|
+
type HostingCapacityModel = 'singleton' | 'replicated' | 'serverless';
|
|
11558
|
+
type HostingBillingProvider = 'direct' | 'microsoft_marketplace' | 'aws_marketplace';
|
|
11555
11559
|
interface HostingDatabaseCredentials {
|
|
11556
11560
|
database_id: string;
|
|
11557
11561
|
name: string;
|
|
@@ -11573,6 +11577,97 @@ interface HostingDatabaseCredentials {
|
|
|
11573
11577
|
/** UI safety timer only; the database credential itself does not expire after this interval. */
|
|
11574
11578
|
hide_after_seconds: number;
|
|
11575
11579
|
}
|
|
11580
|
+
interface HostingServiceDeployment {
|
|
11581
|
+
id: string;
|
|
11582
|
+
hosting_service_id: string;
|
|
11583
|
+
hosting_release_id: string;
|
|
11584
|
+
game_build_id?: string | null;
|
|
11585
|
+
version: string;
|
|
11586
|
+
status: 'queued' | 'deploying' | 'ready' | 'active' | 'inactive' | 'failed';
|
|
11587
|
+
image?: string | null;
|
|
11588
|
+
azure_fqdn?: string | null;
|
|
11589
|
+
error_message?: string | null;
|
|
11590
|
+
ready_at?: string | null;
|
|
11591
|
+
promoted_at?: string | null;
|
|
11592
|
+
}
|
|
11593
|
+
interface HostingService {
|
|
11594
|
+
id: string;
|
|
11595
|
+
hosting_site_id: string;
|
|
11596
|
+
name: string;
|
|
11597
|
+
slug: string;
|
|
11598
|
+
role: HostingServiceRole;
|
|
11599
|
+
runtime: 'node' | 'python' | 'rust' | 'container';
|
|
11600
|
+
visibility: HostingServiceVisibility;
|
|
11601
|
+
status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
|
|
11602
|
+
is_primary: boolean;
|
|
11603
|
+
target_port?: number | null;
|
|
11604
|
+
transport: 'http' | 'http2' | 'tcp';
|
|
11605
|
+
health_check_path?: string | null;
|
|
11606
|
+
capacity_model: HostingCapacityModel;
|
|
11607
|
+
container_cpu: number;
|
|
11608
|
+
container_memory_mb: number;
|
|
11609
|
+
min_replicas: number;
|
|
11610
|
+
max_replicas: number;
|
|
11611
|
+
schedule_cron?: string | null;
|
|
11612
|
+
depends_on: string[];
|
|
11613
|
+
database_bindings: string[];
|
|
11614
|
+
secret_names: string[];
|
|
11615
|
+
active_deployment?: HostingServiceDeployment | null;
|
|
11616
|
+
deployments?: HostingServiceDeployment[];
|
|
11617
|
+
}
|
|
11618
|
+
interface HostingServiceDefinition {
|
|
11619
|
+
name?: string;
|
|
11620
|
+
slug: string;
|
|
11621
|
+
role?: HostingServiceRole;
|
|
11622
|
+
runtime?: 'node' | 'python' | 'rust' | 'container';
|
|
11623
|
+
visibility?: HostingServiceVisibility;
|
|
11624
|
+
is_primary?: boolean;
|
|
11625
|
+
target_port?: number;
|
|
11626
|
+
transport?: 'http' | 'http2' | 'tcp';
|
|
11627
|
+
health_check_path?: string;
|
|
11628
|
+
capacity_model?: HostingCapacityModel;
|
|
11629
|
+
container_cpu?: number;
|
|
11630
|
+
container_memory_mb?: number;
|
|
11631
|
+
min_replicas?: number;
|
|
11632
|
+
max_replicas?: number;
|
|
11633
|
+
schedule_cron?: string;
|
|
11634
|
+
depends_on?: string[];
|
|
11635
|
+
environment?: Record<string, string | number | boolean | null>;
|
|
11636
|
+
database_bindings?: string[];
|
|
11637
|
+
configuration?: Record<string, unknown>;
|
|
11638
|
+
command?: string[];
|
|
11639
|
+
arguments?: string[];
|
|
11640
|
+
game_build_id?: string;
|
|
11641
|
+
}
|
|
11642
|
+
interface HostingServiceStackRequest {
|
|
11643
|
+
preset?: 'single_server' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
|
|
11644
|
+
game_build_id?: string;
|
|
11645
|
+
builds?: Record<string, string>;
|
|
11646
|
+
services?: HostingServiceDefinition[];
|
|
11647
|
+
}
|
|
11648
|
+
interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
|
|
11649
|
+
version: string;
|
|
11650
|
+
test?: {
|
|
11651
|
+
service: string;
|
|
11652
|
+
command: string[];
|
|
11653
|
+
};
|
|
11654
|
+
migration?: {
|
|
11655
|
+
service: string;
|
|
11656
|
+
command: string[];
|
|
11657
|
+
};
|
|
11658
|
+
}
|
|
11659
|
+
interface HostingServiceEstimate {
|
|
11660
|
+
billing_provider: HostingBillingProvider;
|
|
11661
|
+
estimated_monthly_floor_cents: number;
|
|
11662
|
+
estimated_monthly_floor_dollars: number;
|
|
11663
|
+
services: Array<Record<string, unknown>>;
|
|
11664
|
+
rates: {
|
|
11665
|
+
vcpu_hour_cents: number;
|
|
11666
|
+
memory_gib_hour_cents: number;
|
|
11667
|
+
requests_million_cents: number;
|
|
11668
|
+
};
|
|
11669
|
+
note: string;
|
|
11670
|
+
}
|
|
11576
11671
|
interface CreateHostingSiteRequest {
|
|
11577
11672
|
name: string;
|
|
11578
11673
|
slug: string;
|
|
@@ -11631,6 +11726,14 @@ declare class Hosting {
|
|
|
11631
11726
|
static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
|
|
11632
11727
|
static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11633
11728
|
static aiInstructions<T>(title_id: string, site_id: string, data?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11729
|
+
static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
|
|
11730
|
+
/** Calculate the always-on floor without creating resources or charges. */
|
|
11731
|
+
static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>>;
|
|
11732
|
+
/** Queue an immutable multi-service release. Publishing remains a separate operation. */
|
|
11733
|
+
static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>>;
|
|
11734
|
+
/** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
|
|
11735
|
+
static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>>;
|
|
11736
|
+
static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>>;
|
|
11634
11737
|
static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>>;
|
|
11635
11738
|
static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11636
11739
|
static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
|
package/package.json
CHANGED
package/src/api/Hosting.ts
CHANGED
|
@@ -6,8 +6,11 @@ import Response from '../util/Response';
|
|
|
6
6
|
|
|
7
7
|
export type HostingPlanKey = 'free' | 'launch' | 'growth' | 'scale' | 'studio';
|
|
8
8
|
export type HostingMode = 'static' | 'server';
|
|
9
|
-
export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql';
|
|
10
|
-
export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated';
|
|
9
|
+
export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql' | 'redis';
|
|
10
|
+
export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated' | 'cache_sandbox' | 'cache_launch' | 'cache_growth' | 'cache_scale';
|
|
11
|
+
export type HostingServiceRole = 'web' | 'api' | 'game' | 'realtime' | 'simulation' | 'worker' | 'scheduled';
|
|
12
|
+
export type HostingServiceVisibility = 'public' | 'internal' | 'none';
|
|
13
|
+
export type HostingCapacityModel = 'singleton' | 'replicated' | 'serverless';
|
|
11
14
|
export type HostingDeliveryChannel = 'glitch_store' | 'glitch_hosted_subdomain' | 'glitch_hosted_custom_domain' | 'external';
|
|
12
15
|
export type HostingBillingProvider = 'direct' | 'microsoft_marketplace' | 'aws_marketplace';
|
|
13
16
|
|
|
@@ -33,12 +36,13 @@ export interface HostingRelease {
|
|
|
33
36
|
game_build_id?: string | null;
|
|
34
37
|
version: string;
|
|
35
38
|
status: 'uploading' | 'processing' | 'ready' | 'failed' | 'active' | 'inactive';
|
|
36
|
-
source_type: 'upload' | 'cli' | 'game_build';
|
|
39
|
+
source_type: 'upload' | 'cli' | 'game_build' | 'service_stack';
|
|
37
40
|
entry_point: string;
|
|
38
41
|
size_bytes: number;
|
|
39
42
|
checksum?: string | null;
|
|
40
43
|
error_message?: string | null;
|
|
41
44
|
promoted_at?: string | null;
|
|
45
|
+
service_deployments?: HostingServiceDeployment[];
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
export interface HostingDomain {
|
|
@@ -62,7 +66,7 @@ export interface HostingDatabase {
|
|
|
62
66
|
engine: HostingDatabaseEngine;
|
|
63
67
|
plan: HostingDatabasePlan;
|
|
64
68
|
status: 'awaiting_payment' | 'requested' | 'provisioning' | 'ready' | 'resizing' | 'restoring' | 'failed' | 'deleting' | 'deleted';
|
|
65
|
-
deployment_model: 'shared' | 'dedicated' | 'serverless';
|
|
69
|
+
deployment_model: 'shared' | 'dedicated' | 'serverless' | 'managed_cache';
|
|
66
70
|
azure_region: string;
|
|
67
71
|
included_storage_bytes: number;
|
|
68
72
|
current_storage_bytes: number;
|
|
@@ -117,6 +121,98 @@ export interface HostingSite {
|
|
|
117
121
|
active_release?: HostingRelease | null;
|
|
118
122
|
domains?: HostingDomain[];
|
|
119
123
|
databases?: HostingDatabase[];
|
|
124
|
+
services?: HostingService[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface HostingServiceDeployment {
|
|
128
|
+
id: string;
|
|
129
|
+
hosting_service_id: string;
|
|
130
|
+
hosting_release_id: string;
|
|
131
|
+
game_build_id?: string | null;
|
|
132
|
+
version: string;
|
|
133
|
+
status: 'queued' | 'deploying' | 'ready' | 'active' | 'inactive' | 'failed';
|
|
134
|
+
image?: string | null;
|
|
135
|
+
azure_fqdn?: string | null;
|
|
136
|
+
error_message?: string | null;
|
|
137
|
+
ready_at?: string | null;
|
|
138
|
+
promoted_at?: string | null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface HostingService {
|
|
142
|
+
id: string;
|
|
143
|
+
hosting_site_id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
slug: string;
|
|
146
|
+
role: HostingServiceRole;
|
|
147
|
+
runtime: 'node' | 'python' | 'rust' | 'container';
|
|
148
|
+
visibility: HostingServiceVisibility;
|
|
149
|
+
status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
|
|
150
|
+
is_primary: boolean;
|
|
151
|
+
target_port?: number | null;
|
|
152
|
+
transport: 'http' | 'http2' | 'tcp';
|
|
153
|
+
health_check_path?: string | null;
|
|
154
|
+
capacity_model: HostingCapacityModel;
|
|
155
|
+
container_cpu: number;
|
|
156
|
+
container_memory_mb: number;
|
|
157
|
+
min_replicas: number;
|
|
158
|
+
max_replicas: number;
|
|
159
|
+
schedule_cron?: string | null;
|
|
160
|
+
depends_on: string[];
|
|
161
|
+
database_bindings: string[];
|
|
162
|
+
secret_names: string[];
|
|
163
|
+
active_deployment?: HostingServiceDeployment | null;
|
|
164
|
+
deployments?: HostingServiceDeployment[];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface HostingServiceDefinition {
|
|
168
|
+
name?: string;
|
|
169
|
+
slug: string;
|
|
170
|
+
role?: HostingServiceRole;
|
|
171
|
+
runtime?: 'node' | 'python' | 'rust' | 'container';
|
|
172
|
+
visibility?: HostingServiceVisibility;
|
|
173
|
+
is_primary?: boolean;
|
|
174
|
+
target_port?: number;
|
|
175
|
+
transport?: 'http' | 'http2' | 'tcp';
|
|
176
|
+
health_check_path?: string;
|
|
177
|
+
capacity_model?: HostingCapacityModel;
|
|
178
|
+
container_cpu?: number;
|
|
179
|
+
container_memory_mb?: number;
|
|
180
|
+
min_replicas?: number;
|
|
181
|
+
max_replicas?: number;
|
|
182
|
+
schedule_cron?: string;
|
|
183
|
+
depends_on?: string[];
|
|
184
|
+
environment?: Record<string, string | number | boolean | null>;
|
|
185
|
+
database_bindings?: string[];
|
|
186
|
+
configuration?: Record<string, unknown>;
|
|
187
|
+
command?: string[];
|
|
188
|
+
arguments?: string[];
|
|
189
|
+
game_build_id?: string;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface HostingServiceStackRequest {
|
|
193
|
+
preset?: 'single_server' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
|
|
194
|
+
game_build_id?: string;
|
|
195
|
+
builds?: Record<string, string>;
|
|
196
|
+
services?: HostingServiceDefinition[];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
|
|
200
|
+
version: string;
|
|
201
|
+
test?: { service: string; command: string[] };
|
|
202
|
+
migration?: { service: string; command: string[] };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface HostingServiceEstimate {
|
|
206
|
+
billing_provider: HostingBillingProvider;
|
|
207
|
+
estimated_monthly_floor_cents: number;
|
|
208
|
+
estimated_monthly_floor_dollars: number;
|
|
209
|
+
services: Array<Record<string, unknown>>;
|
|
210
|
+
rates: {
|
|
211
|
+
vcpu_hour_cents: number;
|
|
212
|
+
memory_gib_hour_cents: number;
|
|
213
|
+
requests_million_cents: number;
|
|
214
|
+
};
|
|
215
|
+
note: string;
|
|
120
216
|
}
|
|
121
217
|
|
|
122
218
|
export interface CreateHostingSiteRequest {
|
|
@@ -285,6 +381,29 @@ class Hosting {
|
|
|
285
381
|
return Requests.processRoute(HostingRoute.routes.aiInstructions, data, { title_id, site_id });
|
|
286
382
|
}
|
|
287
383
|
|
|
384
|
+
public static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>> {
|
|
385
|
+
return Requests.processRoute(HostingRoute.routes.services, undefined, { title_id, site_id });
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** Calculate the always-on floor without creating resources or charges. */
|
|
389
|
+
public static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>> {
|
|
390
|
+
return Requests.processRoute(HostingRoute.routes.estimateServices, data, { title_id, site_id });
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/** Queue an immutable multi-service release. Publishing remains a separate operation. */
|
|
394
|
+
public static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>> {
|
|
395
|
+
return Requests.processRoute(HostingRoute.routes.applyServices, data, { title_id, site_id });
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
|
|
399
|
+
public static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>> {
|
|
400
|
+
return Requests.processRoute(HostingRoute.routes.putServiceSecret, { value }, { title_id, site_id, service_id, name });
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
public static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>> {
|
|
404
|
+
return Requests.processRoute(HostingRoute.routes.deleteServiceSecret, undefined, { title_id, site_id, service_id, name });
|
|
405
|
+
}
|
|
406
|
+
|
|
288
407
|
public static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>> {
|
|
289
408
|
if (!gatewayToken) {
|
|
290
409
|
return Requests.processRoute(HostingRoute.routes.resolve, undefined, undefined, { hostname });
|
|
@@ -26,6 +26,11 @@ class HostingRoute {
|
|
|
26
26
|
checkDomain: { url: '/hosting/domains/check', method: HTTP_METHODS.POST },
|
|
27
27
|
purchaseDomain: { url: '/titles/{title_id}/hosting/sites/{site_id}/domains/purchase', method: HTTP_METHODS.POST },
|
|
28
28
|
aiInstructions: { url: '/titles/{title_id}/hosting/sites/{site_id}/ai-instructions', method: HTTP_METHODS.POST },
|
|
29
|
+
services: { url: '/titles/{title_id}/hosting/sites/{site_id}/services', method: HTTP_METHODS.GET },
|
|
30
|
+
estimateServices: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/estimate', method: HTTP_METHODS.POST },
|
|
31
|
+
applyServices: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/apply', method: HTTP_METHODS.POST },
|
|
32
|
+
putServiceSecret: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/{service_id}/secrets/{name}', method: HTTP_METHODS.PUT },
|
|
33
|
+
deleteServiceSecret: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/{service_id}/secrets/{name}', method: HTTP_METHODS.DELETE },
|
|
29
34
|
resolve: { url: '/hosting/resolve', method: HTTP_METHODS.GET },
|
|
30
35
|
startPlaySession: { url: '/hosting/play-sessions', method: HTTP_METHODS.POST },
|
|
31
36
|
heartbeatPlaySession: { url: '/hosting/play-sessions/{session_id}/heartbeat', method: HTTP_METHODS.POST },
|