glitch-javascript-sdk 3.9.8 → 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 +31 -0
- package/dist/browser/hosting-runtime.js.map +1 -1
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Hosting.d.ts +134 -4
- package/dist/esm/index.js +31 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +131 -2
- package/package.json +1 -1
- package/src/api/Hosting.ts +153 -4
- package/src/routes/HostingRoute.ts +6 -0
|
@@ -2,8 +2,11 @@ import { AxiosPromise, AxiosProgressEvent } from 'axios';
|
|
|
2
2
|
import Response from '../util/Response';
|
|
3
3
|
export type HostingPlanKey = 'free' | 'launch' | 'growth' | 'scale' | 'studio';
|
|
4
4
|
export type HostingMode = 'static' | 'server';
|
|
5
|
-
export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql';
|
|
6
|
-
export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated';
|
|
5
|
+
export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql' | 'redis';
|
|
6
|
+
export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated' | 'cache_sandbox' | 'cache_launch' | 'cache_growth' | 'cache_scale';
|
|
7
|
+
export type HostingServiceRole = 'web' | 'api' | 'game' | 'realtime' | 'simulation' | 'worker' | 'scheduled';
|
|
8
|
+
export type HostingServiceVisibility = 'public' | 'internal' | 'none';
|
|
9
|
+
export type HostingCapacityModel = 'singleton' | 'replicated' | 'serverless';
|
|
7
10
|
export type HostingDeliveryChannel = 'glitch_store' | 'glitch_hosted_subdomain' | 'glitch_hosted_custom_domain' | 'external';
|
|
8
11
|
export type HostingBillingProvider = 'direct' | 'microsoft_marketplace' | 'aws_marketplace';
|
|
9
12
|
export interface HostingAccount {
|
|
@@ -27,12 +30,13 @@ export interface HostingRelease {
|
|
|
27
30
|
game_build_id?: string | null;
|
|
28
31
|
version: string;
|
|
29
32
|
status: 'uploading' | 'processing' | 'ready' | 'failed' | 'active' | 'inactive';
|
|
30
|
-
source_type: 'upload' | 'cli' | 'game_build';
|
|
33
|
+
source_type: 'upload' | 'cli' | 'game_build' | 'service_stack';
|
|
31
34
|
entry_point: string;
|
|
32
35
|
size_bytes: number;
|
|
33
36
|
checksum?: string | null;
|
|
34
37
|
error_message?: string | null;
|
|
35
38
|
promoted_at?: string | null;
|
|
39
|
+
service_deployments?: HostingServiceDeployment[];
|
|
36
40
|
}
|
|
37
41
|
export interface HostingDomain {
|
|
38
42
|
id: string;
|
|
@@ -54,7 +58,7 @@ export interface HostingDatabase {
|
|
|
54
58
|
engine: HostingDatabaseEngine;
|
|
55
59
|
plan: HostingDatabasePlan;
|
|
56
60
|
status: 'awaiting_payment' | 'requested' | 'provisioning' | 'ready' | 'resizing' | 'restoring' | 'failed' | 'deleting' | 'deleted';
|
|
57
|
-
deployment_model: 'shared' | 'dedicated' | 'serverless';
|
|
61
|
+
deployment_model: 'shared' | 'dedicated' | 'serverless' | 'managed_cache';
|
|
58
62
|
azure_region: string;
|
|
59
63
|
included_storage_bytes: number;
|
|
60
64
|
current_storage_bytes: number;
|
|
@@ -69,6 +73,27 @@ export interface HostingDatabase {
|
|
|
69
73
|
billing_active: boolean;
|
|
70
74
|
last_error?: string | null;
|
|
71
75
|
}
|
|
76
|
+
export interface HostingDatabaseCredentials {
|
|
77
|
+
database_id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
engine: HostingDatabaseEngine;
|
|
80
|
+
binding_name: string;
|
|
81
|
+
connection_string: string;
|
|
82
|
+
connection: {
|
|
83
|
+
driver?: string;
|
|
84
|
+
host?: string;
|
|
85
|
+
endpoint?: string;
|
|
86
|
+
port?: number;
|
|
87
|
+
database?: string;
|
|
88
|
+
username?: string;
|
|
89
|
+
password?: string;
|
|
90
|
+
key?: string;
|
|
91
|
+
tls: boolean;
|
|
92
|
+
};
|
|
93
|
+
revealed_at: string;
|
|
94
|
+
/** UI safety timer only; the database credential itself does not expire after this interval. */
|
|
95
|
+
hide_after_seconds: number;
|
|
96
|
+
}
|
|
72
97
|
export interface HostingSite {
|
|
73
98
|
id: string;
|
|
74
99
|
hosting_account_id: string;
|
|
@@ -86,6 +111,98 @@ export interface HostingSite {
|
|
|
86
111
|
active_release?: HostingRelease | null;
|
|
87
112
|
domains?: HostingDomain[];
|
|
88
113
|
databases?: HostingDatabase[];
|
|
114
|
+
services?: HostingService[];
|
|
115
|
+
}
|
|
116
|
+
export interface HostingServiceDeployment {
|
|
117
|
+
id: string;
|
|
118
|
+
hosting_service_id: string;
|
|
119
|
+
hosting_release_id: string;
|
|
120
|
+
game_build_id?: string | null;
|
|
121
|
+
version: string;
|
|
122
|
+
status: 'queued' | 'deploying' | 'ready' | 'active' | 'inactive' | 'failed';
|
|
123
|
+
image?: string | null;
|
|
124
|
+
azure_fqdn?: string | null;
|
|
125
|
+
error_message?: string | null;
|
|
126
|
+
ready_at?: string | null;
|
|
127
|
+
promoted_at?: string | null;
|
|
128
|
+
}
|
|
129
|
+
export interface HostingService {
|
|
130
|
+
id: string;
|
|
131
|
+
hosting_site_id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
slug: string;
|
|
134
|
+
role: HostingServiceRole;
|
|
135
|
+
runtime: 'node' | 'python' | 'rust' | 'container';
|
|
136
|
+
visibility: HostingServiceVisibility;
|
|
137
|
+
status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
|
|
138
|
+
is_primary: boolean;
|
|
139
|
+
target_port?: number | null;
|
|
140
|
+
transport: 'http' | 'http2' | 'tcp';
|
|
141
|
+
health_check_path?: string | null;
|
|
142
|
+
capacity_model: HostingCapacityModel;
|
|
143
|
+
container_cpu: number;
|
|
144
|
+
container_memory_mb: number;
|
|
145
|
+
min_replicas: number;
|
|
146
|
+
max_replicas: number;
|
|
147
|
+
schedule_cron?: string | null;
|
|
148
|
+
depends_on: string[];
|
|
149
|
+
database_bindings: string[];
|
|
150
|
+
secret_names: string[];
|
|
151
|
+
active_deployment?: HostingServiceDeployment | null;
|
|
152
|
+
deployments?: HostingServiceDeployment[];
|
|
153
|
+
}
|
|
154
|
+
export interface HostingServiceDefinition {
|
|
155
|
+
name?: string;
|
|
156
|
+
slug: string;
|
|
157
|
+
role?: HostingServiceRole;
|
|
158
|
+
runtime?: 'node' | 'python' | 'rust' | 'container';
|
|
159
|
+
visibility?: HostingServiceVisibility;
|
|
160
|
+
is_primary?: boolean;
|
|
161
|
+
target_port?: number;
|
|
162
|
+
transport?: 'http' | 'http2' | 'tcp';
|
|
163
|
+
health_check_path?: string;
|
|
164
|
+
capacity_model?: HostingCapacityModel;
|
|
165
|
+
container_cpu?: number;
|
|
166
|
+
container_memory_mb?: number;
|
|
167
|
+
min_replicas?: number;
|
|
168
|
+
max_replicas?: number;
|
|
169
|
+
schedule_cron?: string;
|
|
170
|
+
depends_on?: string[];
|
|
171
|
+
environment?: Record<string, string | number | boolean | null>;
|
|
172
|
+
database_bindings?: string[];
|
|
173
|
+
configuration?: Record<string, unknown>;
|
|
174
|
+
command?: string[];
|
|
175
|
+
arguments?: string[];
|
|
176
|
+
game_build_id?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface HostingServiceStackRequest {
|
|
179
|
+
preset?: 'single_server' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
|
|
180
|
+
game_build_id?: string;
|
|
181
|
+
builds?: Record<string, string>;
|
|
182
|
+
services?: HostingServiceDefinition[];
|
|
183
|
+
}
|
|
184
|
+
export interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
|
|
185
|
+
version: string;
|
|
186
|
+
test?: {
|
|
187
|
+
service: string;
|
|
188
|
+
command: string[];
|
|
189
|
+
};
|
|
190
|
+
migration?: {
|
|
191
|
+
service: string;
|
|
192
|
+
command: string[];
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export interface HostingServiceEstimate {
|
|
196
|
+
billing_provider: HostingBillingProvider;
|
|
197
|
+
estimated_monthly_floor_cents: number;
|
|
198
|
+
estimated_monthly_floor_dollars: number;
|
|
199
|
+
services: Array<Record<string, unknown>>;
|
|
200
|
+
rates: {
|
|
201
|
+
vcpu_hour_cents: number;
|
|
202
|
+
memory_gib_hour_cents: number;
|
|
203
|
+
requests_million_cents: number;
|
|
204
|
+
};
|
|
205
|
+
note: string;
|
|
89
206
|
}
|
|
90
207
|
export interface CreateHostingSiteRequest {
|
|
91
208
|
name: string;
|
|
@@ -176,12 +293,25 @@ declare class Hosting {
|
|
|
176
293
|
static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
|
|
177
294
|
static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
|
|
178
295
|
static aiInstructions<T>(title_id: string, site_id: string, data?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
296
|
+
static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
|
|
297
|
+
/** Calculate the always-on floor without creating resources or charges. */
|
|
298
|
+
static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>>;
|
|
299
|
+
/** Queue an immutable multi-service release. Publishing remains a separate operation. */
|
|
300
|
+
static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>>;
|
|
301
|
+
/** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
|
|
302
|
+
static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>>;
|
|
303
|
+
static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>>;
|
|
179
304
|
static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>>;
|
|
180
305
|
static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
|
|
181
306
|
static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
|
|
182
307
|
static databases<T>(title_id: string, site_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
183
308
|
static createDatabase<T>(title_id: string, site_id: string, data: CreateHostingDatabaseRequest): AxiosPromise<Response<T>>;
|
|
184
309
|
static database<T>(title_id: string, site_id: string, database_id: string): AxiosPromise<Response<T>>;
|
|
310
|
+
/**
|
|
311
|
+
* Reveal credentials to a signed-in business billing administrator after an
|
|
312
|
+
* exact database-name confirmation. Hosting and MCP tokens are rejected.
|
|
313
|
+
*/
|
|
314
|
+
static databaseCredentials<T = HostingDatabaseCredentials>(title_id: string, site_id: string, database_id: string, confirmation: string): AxiosPromise<Response<T>>;
|
|
185
315
|
static updateDatabase<T>(title_id: string, site_id: string, database_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
|
|
186
316
|
static retryDatabase<T>(title_id: string, site_id: string, database_id: string): AxiosPromise<Response<T>>;
|
|
187
317
|
static deleteDatabase<T>(title_id: string, site_id: string, database_id: string, confirmation: string): AxiosPromise<Response<T>>;
|
package/dist/esm/index.js
CHANGED
|
@@ -21341,12 +21341,18 @@ HostingRoute.routes = {
|
|
|
21341
21341
|
checkDomain: { url: '/hosting/domains/check', method: HTTP_METHODS.POST },
|
|
21342
21342
|
purchaseDomain: { url: '/titles/{title_id}/hosting/sites/{site_id}/domains/purchase', method: HTTP_METHODS.POST },
|
|
21343
21343
|
aiInstructions: { url: '/titles/{title_id}/hosting/sites/{site_id}/ai-instructions', method: HTTP_METHODS.POST },
|
|
21344
|
+
services: { url: '/titles/{title_id}/hosting/sites/{site_id}/services', method: HTTP_METHODS.GET },
|
|
21345
|
+
estimateServices: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/estimate', method: HTTP_METHODS.POST },
|
|
21346
|
+
applyServices: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/apply', method: HTTP_METHODS.POST },
|
|
21347
|
+
putServiceSecret: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/{service_id}/secrets/{name}', method: HTTP_METHODS.PUT },
|
|
21348
|
+
deleteServiceSecret: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/{service_id}/secrets/{name}', method: HTTP_METHODS.DELETE },
|
|
21344
21349
|
resolve: { url: '/hosting/resolve', method: HTTP_METHODS.GET },
|
|
21345
21350
|
startPlaySession: { url: '/hosting/play-sessions', method: HTTP_METHODS.POST },
|
|
21346
21351
|
heartbeatPlaySession: { url: '/hosting/play-sessions/{session_id}/heartbeat', method: HTTP_METHODS.POST },
|
|
21347
21352
|
databases: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases', method: HTTP_METHODS.GET },
|
|
21348
21353
|
createDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases', method: HTTP_METHODS.POST },
|
|
21349
21354
|
database: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}', method: HTTP_METHODS.GET },
|
|
21355
|
+
databaseCredentials: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}/credentials', method: HTTP_METHODS.POST },
|
|
21350
21356
|
updateDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}', method: HTTP_METHODS.PUT },
|
|
21351
21357
|
retryDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}/retry', method: HTTP_METHODS.POST },
|
|
21352
21358
|
deleteDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}', method: HTTP_METHODS.DELETE },
|
|
@@ -21438,6 +21444,24 @@ class Hosting {
|
|
|
21438
21444
|
static aiInstructions(title_id, site_id, data = {}) {
|
|
21439
21445
|
return Requests.processRoute(HostingRoute.routes.aiInstructions, data, { title_id, site_id });
|
|
21440
21446
|
}
|
|
21447
|
+
static services(title_id, site_id) {
|
|
21448
|
+
return Requests.processRoute(HostingRoute.routes.services, undefined, { title_id, site_id });
|
|
21449
|
+
}
|
|
21450
|
+
/** Calculate the always-on floor without creating resources or charges. */
|
|
21451
|
+
static estimateServices(title_id, site_id, data) {
|
|
21452
|
+
return Requests.processRoute(HostingRoute.routes.estimateServices, data, { title_id, site_id });
|
|
21453
|
+
}
|
|
21454
|
+
/** Queue an immutable multi-service release. Publishing remains a separate operation. */
|
|
21455
|
+
static applyServices(title_id, site_id, data) {
|
|
21456
|
+
return Requests.processRoute(HostingRoute.routes.applyServices, data, { title_id, site_id });
|
|
21457
|
+
}
|
|
21458
|
+
/** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
|
|
21459
|
+
static putServiceSecret(title_id, site_id, service_id, name, value) {
|
|
21460
|
+
return Requests.processRoute(HostingRoute.routes.putServiceSecret, { value }, { title_id, site_id, service_id, name });
|
|
21461
|
+
}
|
|
21462
|
+
static deleteServiceSecret(title_id, site_id, service_id, name) {
|
|
21463
|
+
return Requests.processRoute(HostingRoute.routes.deleteServiceSecret, undefined, { title_id, site_id, service_id, name });
|
|
21464
|
+
}
|
|
21441
21465
|
static resolve(hostname, gatewayToken) {
|
|
21442
21466
|
if (!gatewayToken) {
|
|
21443
21467
|
return Requests.processRoute(HostingRoute.routes.resolve, undefined, undefined, { hostname });
|
|
@@ -21466,6 +21490,13 @@ class Hosting {
|
|
|
21466
21490
|
static database(title_id, site_id, database_id) {
|
|
21467
21491
|
return Requests.processRoute(HostingRoute.routes.database, undefined, { title_id, site_id, database_id });
|
|
21468
21492
|
}
|
|
21493
|
+
/**
|
|
21494
|
+
* Reveal credentials to a signed-in business billing administrator after an
|
|
21495
|
+
* exact database-name confirmation. Hosting and MCP tokens are rejected.
|
|
21496
|
+
*/
|
|
21497
|
+
static databaseCredentials(title_id, site_id, database_id, confirmation) {
|
|
21498
|
+
return Requests.processRoute(HostingRoute.routes.databaseCredentials, { confirmation }, { title_id, site_id, database_id });
|
|
21499
|
+
}
|
|
21469
21500
|
static updateDatabase(title_id, site_id, database_id, data) {
|
|
21470
21501
|
return Requests.processRoute(HostingRoute.routes.updateDatabase, data, { title_id, site_id, database_id });
|
|
21471
21502
|
}
|