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/index.d.ts CHANGED
@@ -11550,8 +11550,124 @@ 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';
11559
+ interface HostingDatabaseCredentials {
11560
+ database_id: string;
11561
+ name: string;
11562
+ engine: HostingDatabaseEngine;
11563
+ binding_name: string;
11564
+ connection_string: string;
11565
+ connection: {
11566
+ driver?: string;
11567
+ host?: string;
11568
+ endpoint?: string;
11569
+ port?: number;
11570
+ database?: string;
11571
+ username?: string;
11572
+ password?: string;
11573
+ key?: string;
11574
+ tls: boolean;
11575
+ };
11576
+ revealed_at: string;
11577
+ /** UI safety timer only; the database credential itself does not expire after this interval. */
11578
+ hide_after_seconds: number;
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
+ }
11555
11671
  interface CreateHostingSiteRequest {
11556
11672
  name: string;
11557
11673
  slug: string;
@@ -11610,12 +11726,25 @@ declare class Hosting {
11610
11726
  static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
11611
11727
  static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
11612
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>>;
11613
11737
  static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>>;
11614
11738
  static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
11615
11739
  static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
11616
11740
  static databases<T>(title_id: string, site_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
11617
11741
  static createDatabase<T>(title_id: string, site_id: string, data: CreateHostingDatabaseRequest): AxiosPromise<Response<T>>;
11618
11742
  static database<T>(title_id: string, site_id: string, database_id: string): AxiosPromise<Response<T>>;
11743
+ /**
11744
+ * Reveal credentials to a signed-in business billing administrator after an
11745
+ * exact database-name confirmation. Hosting and MCP tokens are rejected.
11746
+ */
11747
+ static databaseCredentials<T = HostingDatabaseCredentials>(title_id: string, site_id: string, database_id: string, confirmation: string): AxiosPromise<Response<T>>;
11619
11748
  static updateDatabase<T>(title_id: string, site_id: string, database_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
11620
11749
  static retryDatabase<T>(title_id: string, site_id: string, database_id: string): AxiosPromise<Response<T>>;
11621
11750
  static deleteDatabase<T>(title_id: string, site_id: string, database_id: string, confirmation: string): AxiosPromise<Response<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.9.8",
3
+ "version": "3.10.0",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -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;
@@ -78,6 +82,28 @@ export interface HostingDatabase {
78
82
  last_error?: string | null;
79
83
  }
80
84
 
85
+ export interface HostingDatabaseCredentials {
86
+ database_id: string;
87
+ name: string;
88
+ engine: HostingDatabaseEngine;
89
+ binding_name: string;
90
+ connection_string: string;
91
+ connection: {
92
+ driver?: string;
93
+ host?: string;
94
+ endpoint?: string;
95
+ port?: number;
96
+ database?: string;
97
+ username?: string;
98
+ password?: string;
99
+ key?: string;
100
+ tls: boolean;
101
+ };
102
+ revealed_at: string;
103
+ /** UI safety timer only; the database credential itself does not expire after this interval. */
104
+ hide_after_seconds: number;
105
+ }
106
+
81
107
  export interface HostingSite {
82
108
  id: string;
83
109
  hosting_account_id: string;
@@ -95,6 +121,98 @@ export interface HostingSite {
95
121
  active_release?: HostingRelease | null;
96
122
  domains?: HostingDomain[];
97
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;
98
216
  }
99
217
 
100
218
  export interface CreateHostingSiteRequest {
@@ -263,6 +381,29 @@ class Hosting {
263
381
  return Requests.processRoute(HostingRoute.routes.aiInstructions, data, { title_id, site_id });
264
382
  }
265
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
+
266
407
  public static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>> {
267
408
  if (!gatewayToken) {
268
409
  return Requests.processRoute(HostingRoute.routes.resolve, undefined, undefined, { hostname });
@@ -298,6 +439,14 @@ class Hosting {
298
439
  return Requests.processRoute(HostingRoute.routes.database, undefined, { title_id, site_id, database_id });
299
440
  }
300
441
 
442
+ /**
443
+ * Reveal credentials to a signed-in business billing administrator after an
444
+ * exact database-name confirmation. Hosting and MCP tokens are rejected.
445
+ */
446
+ public static databaseCredentials<T = HostingDatabaseCredentials>(title_id: string, site_id: string, database_id: string, confirmation: string): AxiosPromise<Response<T>> {
447
+ return Requests.processRoute(HostingRoute.routes.databaseCredentials, { confirmation }, { title_id, site_id, database_id });
448
+ }
449
+
301
450
  public static updateDatabase<T>(title_id: string, site_id: string, database_id: string, data: Record<string, any>): AxiosPromise<Response<T>> {
302
451
  return Requests.processRoute(HostingRoute.routes.updateDatabase, data, { title_id, site_id, database_id });
303
452
  }
@@ -26,12 +26,18 @@ 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 },
32
37
  databases: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases', method: HTTP_METHODS.GET },
33
38
  createDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases', method: HTTP_METHODS.POST },
34
39
  database: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}', method: HTTP_METHODS.GET },
40
+ databaseCredentials: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}/credentials', method: HTTP_METHODS.POST },
35
41
  updateDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}', method: HTTP_METHODS.PUT },
36
42
  retryDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}/retry', method: HTTP_METHODS.POST },
37
43
  deleteDatabase: { url: '/titles/{title_id}/hosting/sites/{site_id}/databases/{database_id}', method: HTTP_METHODS.DELETE },