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.
@@ -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;
@@ -107,6 +111,122 @@ export interface HostingSite {
107
111
  active_release?: HostingRelease | null;
108
112
  domains?: HostingDomain[];
109
113
  databases?: HostingDatabase[];
114
+ services?: HostingService[];
115
+ runtime_routes?: Array<{
116
+ path_prefix: string;
117
+ service: string;
118
+ runtime_origin: string;
119
+ }>;
120
+ }
121
+ export interface HostingServiceVolume {
122
+ name: string;
123
+ mount_path: string;
124
+ size_gb: number;
125
+ access_mode?: 'ReadOnly' | 'ReadWrite';
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
+ export interface HostingService {
141
+ id: string;
142
+ hosting_site_id: string;
143
+ name: string;
144
+ slug: string;
145
+ role: HostingServiceRole;
146
+ runtime: 'node' | 'python' | 'rust' | 'container';
147
+ visibility: HostingServiceVisibility;
148
+ status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
149
+ is_primary: boolean;
150
+ target_port?: number | null;
151
+ transport: 'http' | 'http2' | 'tcp';
152
+ health_check_path?: string | null;
153
+ startup_check_path?: string | null;
154
+ readiness_check_path?: string | null;
155
+ liveness_check_path?: string | null;
156
+ capacity_model: HostingCapacityModel;
157
+ container_cpu: number;
158
+ container_memory_mb: number;
159
+ min_replicas: number;
160
+ max_replicas: number;
161
+ schedule_cron?: string | null;
162
+ termination_grace_seconds: number;
163
+ depends_on: string[];
164
+ public_paths: string[];
165
+ volumes: HostingServiceVolume[];
166
+ database_bindings: string[];
167
+ secret_names: string[];
168
+ active_deployment?: HostingServiceDeployment | null;
169
+ deployments?: HostingServiceDeployment[];
170
+ }
171
+ export interface HostingServiceDefinition {
172
+ name?: string;
173
+ slug: string;
174
+ role?: HostingServiceRole;
175
+ runtime?: 'node' | 'python' | 'rust' | 'container';
176
+ visibility?: HostingServiceVisibility;
177
+ is_primary?: boolean;
178
+ target_port?: number;
179
+ transport?: 'http' | 'http2' | 'tcp';
180
+ health_check_path?: string;
181
+ startup_check_path?: string;
182
+ readiness_check_path?: string;
183
+ liveness_check_path?: string;
184
+ capacity_model?: HostingCapacityModel;
185
+ container_cpu?: number;
186
+ container_memory_mb?: number;
187
+ min_replicas?: number;
188
+ max_replicas?: number;
189
+ schedule_cron?: string;
190
+ termination_grace_seconds?: number;
191
+ depends_on?: string[];
192
+ public_paths?: string[];
193
+ volumes?: HostingServiceVolume[];
194
+ environment?: Record<string, string | number | boolean | null>;
195
+ database_bindings?: string[];
196
+ configuration?: Record<string, unknown>;
197
+ command?: string[];
198
+ arguments?: string[];
199
+ game_build_id?: string;
200
+ }
201
+ export interface HostingServiceStackRequest {
202
+ preset?: 'single_server' | 'world_of_claudecraft' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
203
+ game_build_id?: string;
204
+ builds?: Record<string, string>;
205
+ services?: HostingServiceDefinition[];
206
+ }
207
+ export interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
208
+ version: string;
209
+ test?: {
210
+ service: string;
211
+ command: string[];
212
+ };
213
+ migration?: {
214
+ service: string;
215
+ command: string[];
216
+ };
217
+ }
218
+ export interface HostingServiceEstimate {
219
+ billing_provider: HostingBillingProvider;
220
+ estimated_monthly_floor_cents: number;
221
+ estimated_monthly_floor_dollars: number;
222
+ services: Array<Record<string, unknown>>;
223
+ rates: {
224
+ vcpu_hour_cents: number;
225
+ memory_gib_hour_cents: number;
226
+ requests_million_cents: number;
227
+ persistent_storage_gib_month_cents: number;
228
+ };
229
+ note: string;
110
230
  }
111
231
  export interface CreateHostingSiteRequest {
112
232
  name: string;
@@ -197,6 +317,14 @@ declare class Hosting {
197
317
  static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
198
318
  static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
199
319
  static aiInstructions<T>(title_id: string, site_id: string, data?: Record<string, any>): AxiosPromise<Response<T>>;
320
+ static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
321
+ /** Calculate the always-on floor without creating resources or charges. */
322
+ static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>>;
323
+ /** Queue an immutable multi-service release. Publishing remains a separate operation. */
324
+ static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>>;
325
+ /** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
326
+ static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>>;
327
+ static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>>;
200
328
  static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>>;
201
329
  static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
202
330
  static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
package/dist/esm/index.js CHANGED
@@ -21341,6 +21341,11 @@ 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 },
@@ -21439,6 +21444,24 @@ class Hosting {
21439
21444
  static aiInstructions(title_id, site_id, data = {}) {
21440
21445
  return Requests.processRoute(HostingRoute.routes.aiInstructions, data, { title_id, site_id });
21441
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
+ }
21442
21465
  static resolve(hostname, gatewayToken) {
21443
21466
  if (!gatewayToken) {
21444
21467
  return Requests.processRoute(HostingRoute.routes.resolve, undefined, undefined, { hostname });