glitch-javascript-sdk 3.9.9 → 3.10.1

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,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,116 @@ 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 HostingServiceVolume {
11581
+ name: string;
11582
+ mount_path: string;
11583
+ size_gb: number;
11584
+ access_mode?: 'ReadOnly' | 'ReadWrite';
11585
+ }
11586
+ interface HostingServiceDeployment {
11587
+ id: string;
11588
+ hosting_service_id: string;
11589
+ hosting_release_id: string;
11590
+ game_build_id?: string | null;
11591
+ version: string;
11592
+ status: 'queued' | 'deploying' | 'ready' | 'active' | 'inactive' | 'failed';
11593
+ image?: string | null;
11594
+ azure_fqdn?: string | null;
11595
+ error_message?: string | null;
11596
+ ready_at?: string | null;
11597
+ promoted_at?: string | null;
11598
+ }
11599
+ interface HostingService {
11600
+ id: string;
11601
+ hosting_site_id: string;
11602
+ name: string;
11603
+ slug: string;
11604
+ role: HostingServiceRole;
11605
+ runtime: 'node' | 'python' | 'rust' | 'container';
11606
+ visibility: HostingServiceVisibility;
11607
+ status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
11608
+ is_primary: boolean;
11609
+ target_port?: number | null;
11610
+ transport: 'http' | 'http2' | 'tcp';
11611
+ health_check_path?: string | null;
11612
+ startup_check_path?: string | null;
11613
+ readiness_check_path?: string | null;
11614
+ liveness_check_path?: string | null;
11615
+ capacity_model: HostingCapacityModel;
11616
+ container_cpu: number;
11617
+ container_memory_mb: number;
11618
+ min_replicas: number;
11619
+ max_replicas: number;
11620
+ schedule_cron?: string | null;
11621
+ termination_grace_seconds: number;
11622
+ depends_on: string[];
11623
+ public_paths: string[];
11624
+ volumes: HostingServiceVolume[];
11625
+ database_bindings: string[];
11626
+ secret_names: string[];
11627
+ active_deployment?: HostingServiceDeployment | null;
11628
+ deployments?: HostingServiceDeployment[];
11629
+ }
11630
+ interface HostingServiceDefinition {
11631
+ name?: string;
11632
+ slug: string;
11633
+ role?: HostingServiceRole;
11634
+ runtime?: 'node' | 'python' | 'rust' | 'container';
11635
+ visibility?: HostingServiceVisibility;
11636
+ is_primary?: boolean;
11637
+ target_port?: number;
11638
+ transport?: 'http' | 'http2' | 'tcp';
11639
+ health_check_path?: string;
11640
+ startup_check_path?: string;
11641
+ readiness_check_path?: string;
11642
+ liveness_check_path?: string;
11643
+ capacity_model?: HostingCapacityModel;
11644
+ container_cpu?: number;
11645
+ container_memory_mb?: number;
11646
+ min_replicas?: number;
11647
+ max_replicas?: number;
11648
+ schedule_cron?: string;
11649
+ termination_grace_seconds?: number;
11650
+ depends_on?: string[];
11651
+ public_paths?: string[];
11652
+ volumes?: HostingServiceVolume[];
11653
+ environment?: Record<string, string | number | boolean | null>;
11654
+ database_bindings?: string[];
11655
+ configuration?: Record<string, unknown>;
11656
+ command?: string[];
11657
+ arguments?: string[];
11658
+ game_build_id?: string;
11659
+ }
11660
+ interface HostingServiceStackRequest {
11661
+ preset?: 'single_server' | 'world_of_claudecraft' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
11662
+ game_build_id?: string;
11663
+ builds?: Record<string, string>;
11664
+ services?: HostingServiceDefinition[];
11665
+ }
11666
+ interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
11667
+ version: string;
11668
+ test?: {
11669
+ service: string;
11670
+ command: string[];
11671
+ };
11672
+ migration?: {
11673
+ service: string;
11674
+ command: string[];
11675
+ };
11676
+ }
11677
+ interface HostingServiceEstimate {
11678
+ billing_provider: HostingBillingProvider;
11679
+ estimated_monthly_floor_cents: number;
11680
+ estimated_monthly_floor_dollars: number;
11681
+ services: Array<Record<string, unknown>>;
11682
+ rates: {
11683
+ vcpu_hour_cents: number;
11684
+ memory_gib_hour_cents: number;
11685
+ requests_million_cents: number;
11686
+ persistent_storage_gib_month_cents: number;
11687
+ };
11688
+ note: string;
11689
+ }
11576
11690
  interface CreateHostingSiteRequest {
11577
11691
  name: string;
11578
11692
  slug: string;
@@ -11631,6 +11745,14 @@ declare class Hosting {
11631
11745
  static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
11632
11746
  static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
11633
11747
  static aiInstructions<T>(title_id: string, site_id: string, data?: Record<string, any>): AxiosPromise<Response<T>>;
11748
+ static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
11749
+ /** Calculate the always-on floor without creating resources or charges. */
11750
+ static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>>;
11751
+ /** Queue an immutable multi-service release. Publishing remains a separate operation. */
11752
+ static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>>;
11753
+ /** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
11754
+ static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>>;
11755
+ static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>>;
11634
11756
  static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>>;
11635
11757
  static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
11636
11758
  static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.9.9",
3
+ "version": "3.10.1",
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;
@@ -117,6 +121,119 @@ export interface HostingSite {
117
121
  active_release?: HostingRelease | null;
118
122
  domains?: HostingDomain[];
119
123
  databases?: HostingDatabase[];
124
+ services?: HostingService[];
125
+ runtime_routes?: Array<{ path_prefix: string; service: string; runtime_origin: string }>;
126
+ }
127
+
128
+ export interface HostingServiceVolume {
129
+ name: string;
130
+ mount_path: string;
131
+ size_gb: number;
132
+ access_mode?: 'ReadOnly' | 'ReadWrite';
133
+ }
134
+
135
+ export interface HostingServiceDeployment {
136
+ id: string;
137
+ hosting_service_id: string;
138
+ hosting_release_id: string;
139
+ game_build_id?: string | null;
140
+ version: string;
141
+ status: 'queued' | 'deploying' | 'ready' | 'active' | 'inactive' | 'failed';
142
+ image?: string | null;
143
+ azure_fqdn?: string | null;
144
+ error_message?: string | null;
145
+ ready_at?: string | null;
146
+ promoted_at?: string | null;
147
+ }
148
+
149
+ export interface HostingService {
150
+ id: string;
151
+ hosting_site_id: string;
152
+ name: string;
153
+ slug: string;
154
+ role: HostingServiceRole;
155
+ runtime: 'node' | 'python' | 'rust' | 'container';
156
+ visibility: HostingServiceVisibility;
157
+ status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
158
+ is_primary: boolean;
159
+ target_port?: number | null;
160
+ transport: 'http' | 'http2' | 'tcp';
161
+ health_check_path?: string | null;
162
+ startup_check_path?: string | null;
163
+ readiness_check_path?: string | null;
164
+ liveness_check_path?: string | null;
165
+ capacity_model: HostingCapacityModel;
166
+ container_cpu: number;
167
+ container_memory_mb: number;
168
+ min_replicas: number;
169
+ max_replicas: number;
170
+ schedule_cron?: string | null;
171
+ termination_grace_seconds: number;
172
+ depends_on: string[];
173
+ public_paths: string[];
174
+ volumes: HostingServiceVolume[];
175
+ database_bindings: string[];
176
+ secret_names: string[];
177
+ active_deployment?: HostingServiceDeployment | null;
178
+ deployments?: HostingServiceDeployment[];
179
+ }
180
+
181
+ export interface HostingServiceDefinition {
182
+ name?: string;
183
+ slug: string;
184
+ role?: HostingServiceRole;
185
+ runtime?: 'node' | 'python' | 'rust' | 'container';
186
+ visibility?: HostingServiceVisibility;
187
+ is_primary?: boolean;
188
+ target_port?: number;
189
+ transport?: 'http' | 'http2' | 'tcp';
190
+ health_check_path?: string;
191
+ startup_check_path?: string;
192
+ readiness_check_path?: string;
193
+ liveness_check_path?: string;
194
+ capacity_model?: HostingCapacityModel;
195
+ container_cpu?: number;
196
+ container_memory_mb?: number;
197
+ min_replicas?: number;
198
+ max_replicas?: number;
199
+ schedule_cron?: string;
200
+ termination_grace_seconds?: number;
201
+ depends_on?: string[];
202
+ public_paths?: string[];
203
+ volumes?: HostingServiceVolume[];
204
+ environment?: Record<string, string | number | boolean | null>;
205
+ database_bindings?: string[];
206
+ configuration?: Record<string, unknown>;
207
+ command?: string[];
208
+ arguments?: string[];
209
+ game_build_id?: string;
210
+ }
211
+
212
+ export interface HostingServiceStackRequest {
213
+ preset?: 'single_server' | 'world_of_claudecraft' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
214
+ game_build_id?: string;
215
+ builds?: Record<string, string>;
216
+ services?: HostingServiceDefinition[];
217
+ }
218
+
219
+ export interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
220
+ version: string;
221
+ test?: { service: string; command: string[] };
222
+ migration?: { service: string; command: string[] };
223
+ }
224
+
225
+ export interface HostingServiceEstimate {
226
+ billing_provider: HostingBillingProvider;
227
+ estimated_monthly_floor_cents: number;
228
+ estimated_monthly_floor_dollars: number;
229
+ services: Array<Record<string, unknown>>;
230
+ rates: {
231
+ vcpu_hour_cents: number;
232
+ memory_gib_hour_cents: number;
233
+ requests_million_cents: number;
234
+ persistent_storage_gib_month_cents: number;
235
+ };
236
+ note: string;
120
237
  }
121
238
 
122
239
  export interface CreateHostingSiteRequest {
@@ -285,6 +402,29 @@ class Hosting {
285
402
  return Requests.processRoute(HostingRoute.routes.aiInstructions, data, { title_id, site_id });
286
403
  }
287
404
 
405
+ public static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>> {
406
+ return Requests.processRoute(HostingRoute.routes.services, undefined, { title_id, site_id });
407
+ }
408
+
409
+ /** Calculate the always-on floor without creating resources or charges. */
410
+ public static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>> {
411
+ return Requests.processRoute(HostingRoute.routes.estimateServices, data, { title_id, site_id });
412
+ }
413
+
414
+ /** Queue an immutable multi-service release. Publishing remains a separate operation. */
415
+ public static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>> {
416
+ return Requests.processRoute(HostingRoute.routes.applyServices, data, { title_id, site_id });
417
+ }
418
+
419
+ /** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
420
+ public static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>> {
421
+ return Requests.processRoute(HostingRoute.routes.putServiceSecret, { value }, { title_id, site_id, service_id, name });
422
+ }
423
+
424
+ public static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>> {
425
+ return Requests.processRoute(HostingRoute.routes.deleteServiceSecret, undefined, { title_id, site_id, service_id, name });
426
+ }
427
+
288
428
  public static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>> {
289
429
  if (!gatewayToken) {
290
430
  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 },